Forum Moderators: phranque

Message Too Old, No Replies

Apache tuning

what is the goal? what am i looking for?

         

Doood

8:50 pm on May 9, 2011 (gmt 0)

10+ Year Member



I'm retuning apache prefork mpm settings and watching the server-status page and top but I'm not exactly sure what results I should be trying to achieve.

Am I trying to get the highest requests per second? Or what? I'm not really sure.

Traffic has slowed recently and the site on this server won't load at times now so it need some tuning.

It's a dual quad core xeon, 8gb ram.

Right now the server-status shows this,
Server uptime: 2 hours 17 minutes 56 seconds
Total accesses: 1052333 - Total Traffic: 274.7 MB
CPU Usage: u991.31 s108.59 cu3.6 cs0 - 13.3% CPU load
127 requests/sec - 34.0 kB/second - 273 B/request
29 requests currently being processed, 85 idle workers

Top shows,
top - 15:40:10 up 20 days, 3:27, 1 user, load average: 0.52, 0.38, 0.33
Tasks: 208 total, 1 running, 207 sleeping, 0 stopped, 0 zombie
Cpu(s): 9.7%us, 1.2%sy, 0.0%ni, 88.6%id, 0.0%wa, 0.2%hi, 0.3%si, 0.0%st
Mem: 8192580k total, 7784516k used, 408064k free, 95148k buffers
Swap: 2031608k total, 140k used, 2031468k free, 7098528k cached


Does that look good or bad overall?

I've made a few changes over the past couple days and saved results each time if it would help to see those.

robzilla

10:32 pm on May 9, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Those stats don't look troublesome at all to me, so what you probably need to be looking for is what happens during those moments when "this server won't load". Consider installing a resource monitoring tool like Munin to be able to see whether this happens at regular intervals, and what type of resource is having trouble. Once you've pinpointed one of those moments, you can dig into your server and access logs, and watch top the next time you expect another spike (that is, if they appear to be regular). Of course, a tool like Munin will itself also take up some of those precious resources as it refreshes its graphs every 5 minutes -- but if these spikes occur on a daily basis, you need only run it for a few days to find a pattern if there is one.

One other thing I tried once, with success, was downloading a screen recorder to my desktop computer, and having it watch and record the top screen (sorted by CPU or memory) while I was away from the computer. When I got back, I skipped through the recording and quickly found the process responsible for the spikes I had been noticing.

g1smd

11:15 pm on May 9, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Make sure the "site not loading" time isn't simply because some file or database backup process is running.

Doood

4:00 am on May 10, 2011 (gmt 0)

10+ Year Member



Well I've been tinkering with it for about 2 months now and finally today it runs better. That's why I was asking about what goal I'm shooting for with the server-status page, but I guess if pages are loading fine then I should leave it alone for now.

For months I've been watching top apachetop iftop vmstat sar, analyzing logs, .etc and never can figure out why it stops responding on port 80.

I think maybe it's just full of connections and most of those are coming from countries that are being blocked. So they're filling up all the connections but not doing anything and not loading any pages, just maxing it out.

phranque

6:39 am on May 10, 2011 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



have you tried using this?
ab - Apache HTTP server benchmarking tool:
http://httpd.apache.org/docs/2.2/programs/ab.html [httpd.apache.org]

you might also check out this Tuning Apache thread:
http://www.webmasterworld.com/apache/4219267.htm [webmasterworld.com]

robzilla

8:17 am on May 10, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I think maybe it's just full of connections and most of those are coming from countries that are being blocked. So they're filling up all the connections but not doing anything and not loading any pages, just maxing it out.

You need to be sure, though, before you start tweaking anything. A handy tool for keeping an eye on current connections is TCPTrack (on Linux:
yum install tcptrack
, then
tcptrack -i eth0
). If you do have a lot of open connections from unwanted IPs, as you suspect, then make sure their idle time is limited.