Sorry to ask a question like this if its too superficial for you. Considering the information below, how would you configure httpd.conf?
The load time of pages reaches to 30 seconds when the server busy.
Server:
Quad-Xeon 3220 / 8GB memory / 2x250GB SATAII / 10TB BW / 1GiGE / 8 IPS (SoftLayer),
CentOS 5 (64-bit) Plesk 9.5
Linux server.x.com 2.6.18-274.17.1.el5 #1 SMP Tue Jan 10 17:25:58 EST 2012 x86_64 x86_64 x86_64 GNU/Linux
Sites on the server receive around 500,000 pageviews and 200GB a day on average. There are around 1500 visitors online when the server busy according to http://whos.amung.us/stats/.
top - 11:15:08 up 23 days, 12:21, 1 user, load average: 0.30, 1.09, 1.84
Tasks: 453 total, 1 running, 452 sleeping, 0 stopped, 0 zombie
Cpu(s): 2.9%us, 2.8%sy, 0.0%ni, 90.3%id, 3.7%wa, 0.0%hi, 0.3%si, 0.0%st
Mem: 8165772k total, 8065268k used, 100504k free, 348884k buffers
Swap: 1052248k total, 208k used, 1052040k free, 6466136k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
15573 mysql 15 0 601m 80m 4520 S 35.1 1.0 2026:37 mysqld
19381 apache 15 0 307m 15m 3312 S 1.0 0.2 0:02.73 httpd
13230 apache 15 0 307m 15m 3296 S 0.7 0.2 0:03.74 httpd
14152 apache 15 0 307m 15m 3284 S 0.7 0.2 0:03.91 httpd
16147 apache 15 0 307m 15m 3296 S 0.7 0.2 0:03.14 httpd
16957 apache 15 0 307m 15m 3292 S 0.7 0.2 0:03.03 httpd
httpd.conf file:
Timeout 60
KeepAlive On
MaxKeepAliveRequests 300
KeepAliveTimeout 5
<IfModule prefork.c>
StartServers 8
MinSpareServers 5
MaxSpareServers 20
ServerLimit 256
MaxClients 256
MaxRequestsPerChild 4000
</IfModule>
<IfModule worker.c>
StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>
Best Answer
Things to consider:
httpd
process uses (about 300MB from your output) and the amount of memory your machine has.It would be a good idea to thoroughly examine your
httpd.conf
and remove any unnecessary modules to cut down your memory footprint. Once you've done that, you can start to raiseMaxClients
andServerLimit
gradually.You'll want to raise
StartServers
,MinSpareServers
andMaxSpareServers
too, but again do this gradually and monitor memory usage and site performance for a while after each change.Other things to consider would be to place something like Varnish in front of Apache or (as Fernando suggests) APC.