On 2010-06-09 14:32:31 user45339 asked:
Apache2 slow serving static while healthy
My Apache status looks like;
201 requests/sec - 98.8 kB/second - 504 B/request 85 requests currently being processed, 345 idle workers _____CCW_C_____C__C__C_R____C_WC_________C__C____CW__C__CCC_____ __C____W______C___C___CW__C_C______C__W_C__C_____CCC____C______R CC_C_______C___C____C______________C______C__C________________C_ ___________________C______________________C_______C___C_____C___ CC____C__C___R_____C_C_CC__________C___C___________R____C_C_C___ ______C______W_W__W___C____________________C__WCC__R__R_C_______ R__RC________________________C___R____W__C____.................. ....................................................
Server load is average 2 on a 4 core machine.
IO utilization is 10-15% and doesn’t have many jumps over 70%.
Machine has almost 4 gb free and uses 0 swap.
The site on the machine is a PHP site. All PHP code is optimized and fast mostly when it gets accessed, however sometimes requests get stuck. Stuck meaning; no response for at least 10 sec. We debugged the PHP code, but it is quite optimal and fast. We spend a lot of time on it until we decided to test the requesting of:
<html><body>test</body></html>
test.html page.
This static resource also gets ‘stuck’ in the same manner the php pages get ‘stuck’.
How is that possible given the health of the system and the fact that it is a static file?
I tested the network, but, when the PHP shows ‘slowness’ in the site monitoring, the html test files also take (far longer) than 10 sec to load using;
time lynx -dump http://127.0.0.1/test.html
We are kind of desperate to solve this problem, but we cannot seem to tackle it.
He received 2 answers
eventually accepting:
The answer with the highest score with 1 points was:
Maybe Apache runs out of file handles? How many file handles you have allowed it to have? The default 1024 can be a bottleneck quite soon. In Linux you up the limits in
/etc/security/limits.conf
file.Is there lots of disk activity during the stalls? If you have Apache access log and other logs very verbosely enabled, maybe it’s the filesystem committing the latest changes? That should not affect Apache in any way, but you never know.
And just to make sure, take a look at
/proc/sys/kernel/random/entropy_avail
during the stalls. You can see it with for examplewatch -n1 'cat /proc/sys/kernel/random/entropy_avail'
. If it says0
, your kernel has ran out of entropy and that blocks Apache until there is more entropy available.If that’s the case you can install
rng-tools
and run therngd
daemon, which shovels semi-random numbers from /dev/urandom to /dev/random in the situations where the real entropy is not available.
Of course, you should really check out the original question.
The post Apache2 slow serving static while healthy [ANSWERED] appeared first on Tech ABC to XYZ.