Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm testing a new Server. This isnt really a peak time for my server (2pm), but still its running a bit slow, I was checking the ESTABLISHED connections using the following command:

# netstat -ntu | grep :80 | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n

http://i.stack.imgur.com/cZuvP.jpg

My MaxClients are set to 50. So as you can see on the picture, only 10 people are eating most of my ram. I got a server with 4GB Ram (2.7GB free for apache) but each apache process is eating 53MB each, wich mean im only allowed to accept 50 process.

The KeepAlive = Off, but I notice those connections arent closing fast enough, is that normal?

share|improve this question
    
Your assumption that a single prefork process is using 53M == only 50 processes is invalid. There is a large amount of shared library space between the processes. I'd suspect you could have more than 50 MaxClients without an issue. –  Kyle Smith May 23 '11 at 20:25

1 Answer 1

If you are running Apache prefork, then you can just do

ps aux |grep http| wc -l

Secondly this command

netstat -ntu | grep :80 | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n

includes connections in ESTABLISHED, CLOSE_WAIT, FIN_WAIT, etc states.

If your Apache is slow then it can be the web application also, you can log the time taken by apache to serve the request and do further analyze.

share|improve this answer
    
The ps aux |grep http| wc -l command its giving me 53, wich means httpd running process on all states right? Uhm seems weird since my MaxClients are 50, unless maxclient only counts for ESTABLISHED connections, I dont know. Thanks for your answer. –  ilcreatore May 23 '11 at 19:17
4  
ilcreator, apache has a parent process which forks to the apache user, and then a controller process which manages all the forks, and then you're catching your own grep. That's 53. :) –  Kyle Smith May 23 '11 at 20:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.