
|
View Full Version : some configurations to httpd.conf . what do you guys think?
fantasian 10-10-2004, 08:50 AM these are some of my settings in httpd.conf which i tried to do since my apache was constantly crashing ( high traffic)
MinSpareServers 150
MaxSpareServers 300
StartServers 300
MaxClients 1000
keepalive off
do you guys think this is a good setting or how would i configure apache so that it doesnt crash or if it does crash, make it so it doesnt crash too frequently.
here is my apache status as of now:
Current Time: Sunday, 10-Oct-2004 08:50:10 EDT
Restart Time: Sunday, 10-Oct-2004 08:43:51 EDT
Parent Server Generation: 0
Server uptime: 6 minutes 19 seconds
Total accesses: 9651 - Total Traffic: 29.3 MB
CPU Usage: u1.73 s.46 cu0 cs0 - .578% CPU load
25.5 requests/sec - 79.1 kB/second - 3180 B/request
183 requests currently being processed, 0 idle servers
Steven 10-10-2004, 02:45 PM I would also check for very large log files.
fantasian 10-10-2004, 06:05 PM you mean apache log files?
yeh theres a few pretty big log files.. should i disable it? if so.. how?
wheimeng 10-10-2004, 06:37 PM MinSpareServers 150
MaxSpareServers 300
That is awesome :D I wonder what's the load of the server :P
fantasian 10-10-2004, 08:03 PM load of the server fluctuates alot.. sometimes its 0.5 then it could shoot up to 7 and slowly decrease, but then it would shoot up again and so on.
i'm on p4 3.06ghz w/ht
dotSecurity 10-10-2004, 10:02 PM When you run top during the high load periods, what process is showing the highest CPU usage?
fantasian 10-10-2004, 10:13 PM hmm i dont really know how to read TOP, but here's what its at right now:
22:12:40 up 3 days, 12:28, 1 user, load average: 1.82, 2.61, 2.36
236 processes: 228 sleeping, 1 running, 5 zombie, 2 stopped
CPU0 states: 8.1% user 9.0% system 0.0% nice 0.0% iowait 82.2% idle
CPU1 states: 7.1% user 3.1% system 0.0% nice 0.0% iowait 89.1% idle
Mem: 1029240k av, 999036k used, 30204k free, 0k shrd, 58188k buff
653824k actv, 12k in_d, 19940k in_c
Swap: 2096472k av, 254644k used, 1841828k free 539664k cached
PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND
1100 root 24 0 2748 596 504 S 3.3 0.0 5:50 0 httpd
4947 mysql 15 0 72148 49M 1532 S 2.7 4.9 6:24 0 mysqld
22648 root 15 0 1268 1268 868 R 0.5 0.1 0:00 0 top
23329 nobody 19 0 0 0 0 Z 0.3 0.0 0:00 1 httpd <defunct>
23348 nobody 20 0 0 0 0 Z 0.1 0.0 0:00 0 httpd <defunct>
23432 nobody 22 0 0 0 0 Z 0.1 0.0 0:00 1 httpd <defunct>
23475 nobody 24 0 0 0 0 Z 0.1 0.0 0:00 1 httpd <defunct>
1 root 15 0 112 80 56 S 0.0 0.0 0:07 0 init
2 root RT 0 0 0 0 SW 0.0 0.0 0:00 0 migration/0
3 root RT 0 0 0 0 SW 0.0 0.0 0:00 1 migration/1
4 root 15 0 0 0 0 SW 0.0 0.0 0:01 1 keventd
5 root 34 19 0 0 0 SWN 0.0 0.0 0:02 0 ksoftirqd_CPU0
6 root 34 19 0 0 0 SWN 0.0 0.0 0:00 1 ksoftirqd_CPU1
11 root 25 0 0 0 0 SW 0.0 0.0 0:00 0 bdflush
7 root 15 0 0 0 0 SW 0.0 0.0 1:09 0 kswapd
8 root 15 0 0 0 0 SW 0.0 0.0 0:03 0 kscand/DMA
9 root 16 0 0 0 0 SW 0.0 0.0 13:14 1 kscand/Normal
10 root 15 0 0 0 0 SW 0.0 0.0 6:07 0 kscand/HighMem
12 root 15 0 0 0 0 SW 0.0 0.0 0:11 1 kupdated
13 root 24 0 0 0 0 SW 0.0 0.0 0:00 0 mdrecoveryd
dotSecurity 10-10-2004, 10:24 PM Try the following settings:
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 3
freeflight2 10-11-2004, 01:56 AM MaxSpareServers 300
StartServers 300
MaxClients 1000 you really should think first before coming up with such numbers... bigger is not always better.
for a site with 1M page views/month 3/3/10 would be enough - the higher you go the more resources your apache will eat and will start swapping.
sysadm 10-11-2004, 04:38 AM try this
MinSpareServers 5
MaxSpareServers 10
StartServers 15
MaxClients 300
MaxRequestsPerChild 10000
keepalive off
regards,
sysadm
Man, you are killing your server. Try my setting below:
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 10
MinSpareServers 5
MaxSpareServers 10
StartServers 2
MaxClients 150 <----- if your server is very busy, try to increase this to 256 or 400
MaxRequestsPerChild 30
KeepAlive directive is very important here. If you want speed in persistent connections you should keep this "On". In fact KeepAliveTimeout is much more important. Keeping this low will result in increased # of TCP connections but shorter life in each TCP connection. (Courtesy of burkul from Ev1)
You can also tweak your php setting and by adding this to your php.ini configuration
output_handler = ob_gzhandler
Actually, there are many things to do in order your server to run smoothly...
MMCache, PRM, and so on...
Thanks,
Jones M.
Originally posted by fantasian
these are some of my settings in httpd.conf which i tried to do since my apache was constantly crashing ( high traffic)
MinSpareServers 150
MaxSpareServers 300
StartServers 300
MaxClients 1000
keepalive off
do you guys think this is a good setting or how would i configure apache so that it doesnt crash or if it does crash, make it so it doesnt crash too frequently.
here is my apache status as of now:
Current Time: Sunday, 10-Oct-2004 08:50:10 EDT
Restart Time: Sunday, 10-Oct-2004 08:43:51 EDT
Parent Server Generation: 0
Server uptime: 6 minutes 19 seconds
Total accesses: 9651 - Total Traffic: 29.3 MB
CPU Usage: u1.73 s.46 cu0 cs0 - .578% CPU load
25.5 requests/sec - 79.1 kB/second - 3180 B/request
183 requests currently being processed, 0 idle servers
fantasian 10-11-2004, 06:56 AM Originally posted by freeflight2
for a site with 1M page views/month 3/3/10 would be enough - the higher you go the more resources your apache will eat and will start swapping. [/B]
i actually deliver about 2 million impressions a day. thats why i chose to set the settings so high
'net' and 'sysadmin' posted two different settings.. which would be better?
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 10
MinSpareServers 5
MaxSpareServers 10
StartServers 5
MaxClients 400
MaxRequestsPerChild 30
Above setting tested with server that runs some popular plain HTML sites and a PHP adserver serving over 1.4 million banners daily.
Try it and even this one will not work for you, this is better than your first setting.
Net
Originally posted by fantasian
i actually deliver about 2 million impressions a day. thats why i chose to set the settings so high
'net' and 'sysadmin' posted two different settings.. which would be better?
lwknet 10-11-2004, 08:19 AM it really should depend on what you serve on your web server, setting min/max spare server to high num isn't neccessary killing your server performance, its especially good for image/staticpages serving, otherwise it will fork so much hence adding load to your cpu and time for memory allocation and sometimes you may experience connection drop from it (fork'ing isn't fast enough to satisfy the pending connections) preforking greatly shift the cpu load to a little more memory usage, max requestsperchild should also depend on your situation, generally 10-100 is good for everything, you may set it higher for ststic/image serving to make the most out of every child preocess and a bit lower for dynamic pages to reduce memory fault by badly written scripts
assuming your server is only for www w/ 1GB of ram for mainly static/image, a celeron 2.0 is enough
Timeout 30
KeepAlive On
MaxKeepAliveRequests 70
KeepAliveTimeout 5
MinSpareServers 50
MaxSpareServers 100
StartServers 50
MaxClients 150
MaxRequestsPerChild 100
if its for dynamic pages, a P4 2.8 is enough
Timeout 300
KeepAlive Off
MaxKeepAliveRequests 1
KeepAliveTimeout 1
MinSpareServers 30
MaxSpareServers 80
StartServers 30
MaxClients 100
MaxRequestsPerChild 30
in any cases, try to avoid using swap
fantasian 10-12-2004, 03:15 PM ok thanks guys. besides changing httpd.conf do you guys recommend any other tweaks to the server to boost performance for high http driven websites? It's usually the same pages that get reloaded and viewed at over and over again.. so i guess is it possible to cache the html file?
hiryuu 10-12-2004, 06:13 PM You haven't really specified what you're serving or what you're serving it on, so it's hard to say. If this is just static files, use thttpd, or squid+apache, which has far less per-request overhead than apache. If it's PHP heavy, MMcache will help.
I'm really surprised to see such small MaxRequestsPerChild. I have it up at 3000.
Actually, mine is setup to 10000 before but after I got this info, I changed it. See below:
Force processes to reset with MaxRequestsPerChild = 30
Forcing your processes to die after a while makes them start over with low RAM usage, and this can reduce total memory usage in many situations. The less dynamic content you have, the more useful this will be. This is a game of catch-up, with your dynamic files constantly increasing total RAM usage, and restarting processes constantly reducing it. Experiment with MaxRequestsPerChild - even values as low as 20 may work well. But don't set it too low, because creating new processes does have overhead. You can figure out the best settings under load by examining "ps axu --sort:rss". A word of warning, using this is a bit like using heroin. The results can be impressive, but are NOT consistent - if the only way you can keep your server running is by tweaking this, you will eventually run into trouble. That being said, by tweaking MaxRequestsPerChild you may be able to increase MaxClients as much as 50%.
Originally posted by hiryuu
You haven't really specified what you're serving or what you're serving it on, so it's hard to say. If this is just static files, use thttpd, or squid+apache, which has far less per-request overhead than apache. If it's PHP heavy, MMcache will help.
I'm really surprised to see such small MaxRequestsPerChild. I have it up at 3000.
|