I’m told I have too many sleeping processes, and that I need to better close queries. I don’t know exactly what that means, any feedback appreciated, but my processes seem high because my server is busy. Here is what I’m seeing at this moment:
free RAM
4.5 GB
swap used
0 MB
tcp conn
4112
apache thds
2001
mysql thds
211
top - 19:04:07 up 19 days, 15:39, 1 user, load average: 2.76, 3.19, 3.15
Tasks: 2256 total, 5 running, 2251 sleeping, 0 stopped, 0 zombie
Seems like I got a lot sleeping, but maybe a side-effect of the traffic?
If it is an issue, how can I fix this?
Cheers
Ryan
Are you using persistent connections for mysql? Do you have a slow queries log?
Don’t think I have a slow queries log. Where would I find that?
Also, using mysql_connect, so pretty sure no persistent connections.
Cheers
Ryan
Wow, that is a lot of sleeping processes - can you get more of a process list from the server to find out what exactly all the processes are (ps aux)
If may be that you’ve got way too many Apache helpers running, or something similar. The number of active processes will vary on traffic, and sleeping doesn’t mean that its not in use - it just means that it doesn’t have cpu time (its not literal idle process, its just one that can’t be run right now)
Well, I typically have 5K+ tcp connections at a time, and do about 500K pages daily.
Does that seem to fit?
Cheers
Ryan
What is your Apache Keep Alive timeout set to? Is it possible you’ve got a lot of connections held longer than they really need to be?
I’ll take a look. What is the usual expectation for a high-traffic site?
Cheers
Ryan
Personally, for a high traffic site, I’d be wanting to keep it low… for our high traffic sites I keep it under 5 seconds, so that I dont’ end up with too many resources held by idle connections.
My keepalivetimeout is set to 3
but my KeepAlive is set to off
Is that okay?
Ryan
Means KeepAlive is turned off then - so you don’t need to worry about processes being held up on keepalive requests.
Lol. Okay, so that isn’t the issue.
Ryan