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 using netstat commands to help optimize my httpd.conf correctly.

Here are the results:

netstat -an | grep -c :80
579
netstat -anp |grep 'tcp\|udp' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
134 207.x.xx.134 //This was the highest result. Also this is my servers IP address

I am aware that my own IP address is returning 134 httpd connections. I have gone through the entire website's scripts and removed any css,js,php links that start with 'http://' - but I still get such a high amount of connections!

I also found this command on a forum, but have no idea what it is displaying:

ps auxww | grep httpd | wc -l
37

And here is my httpd.conf:

Timeout 30
TraceEnable Off
ServerSignature Off
ServerTokens ProductOnly
FileETag None
StartServers 2
<IfModule prefork.c>
MinSpareServers 2
MaxSpareServers 4
</IfModule>
ServerLimit 250
MaxClients 800
MaxRequestsPerChild 50
KeepAlive On
KeepAliveTimeout 1
MaxKeepAliveRequests 10

What can I alter to maximize my Hybrid Server? (Running Intel(R) Xeon(R) CPU E5620 @ 2.40GHz - 2GB Ram - MYSQL heavy).

Thanks.

share|improve this question
add comment

2 Answers 2

up vote 2 down vote accepted

A few comments but note that much of this is educated guess work given the little information to go on. Feel free to try things and ignore them if they don't work for you:

  • MaxRequestsPerChild is very low. Unless you have a specific reason for this value put it to a reasonably high value (1000, 10000, etc...) or 0 to disable it entirely.
  • A KeepAliveTimeout of 1 is reasonable though having it slightly higher (2-5) or disabling KeepAlive may work better depending on your application.
  • A MaxClients of 800 and ServerLimit of 250 is far to high for a 2GB server let alone one that is running a RAM hungry MySQL. For example, if you wish to devote about 1GB to Apache a more reasonable value for these settings is 40-80. The exact value will depend on how much memory each Apache instance takes. The danger of having these values very high is that during high loads the machine will begin to use swap memory which will drop your server's performance to near 0.
  • The ps auxww | grep httpd | wc -l line merely counts how many Apache child processes are running (37 in this case). The mod_status extension is a more powerful/useful tool in determining how many child processes are running and what they are doing.
  • I'm guessing that you have 134 connections from your own IP due to MySQL connections, although depending on what you are running there may be other sources as well. Removing the links with "http" in them doesn't make sense and shouldn't affect this number (unless you have some specific Apache proxies setup for this content).
  • When using netstat you may wish to include a grep ESTABLISHED pipe to only list currently established connections otherwise you include a large number of old TIME_WAIT connections. For example, on one of my servers there are currently 1300 connections listed, of which only 3 are actually currently active.

netstat -anp |grep 'tcp\|udp' | grep ESTABLISHED | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n

share|improve this answer
    
Good info, thanks! –  Moe Apr 29 '11 at 18:46
    
BTW - the netstat isn't displaying my SQL connection. I changed my mysql_connection to "localhost" to "127.0.0.1" and now when i Run netstat It returns -- # 120 207.xx.xx.134 # 823 127.0.0.1 –  Moe Apr 30 '11 at 4:16
add comment

your command is wrong -- netstat -anp - the web server is not using udp at all just tcp. for a better test I would pick a few urls that are hitting the database and/or possible test a full flow and benchmark it with ab

ab ... # http://httpd.apache.org/docs/2.0/programs/ab.html
share|improve this answer
add comment

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.