Linux – apache2 slow responding (debian)

apache-2.2debianlinuxmod-pythonnetworking

I'm running an apache2 2.2.9 webserver with modpython and mpm_worker_module.

The current config for the mpm is

ServerLimit 32
StartServers         10
MaxClients          800
MinSpareThreads      25
MaxSpareThreads      75
ThreadsPerChild      25
MaxRequestsPerChild   0

The server has 1G of ram and a 100Mbit connection.

Checking netstat -na | grep ESTABLISHED | wc -l gives me a number between 50 – 60.
The load is about 1.0
Every pageload is also cached by memcached.

I can't see why the server is so slow in responding to new connections, sometimes droping them completely?

Also tried disabling iptables to make sure it's not because of a full state table or something like that.

The only thing in dmesg is a lot of spam about "TCP: Treason uncloaked!"

Even connections to localhost with apache2ctl status fails, so it shouldn't be modpython related.
When the status do work, it shows around 110-128 requests being processed.
About half are status C (closing connection), lots of _ (Waiting for connection), the rest being R and W

Best Answer

What does the error_log report? It's the best place to start debugging these kind of problems.

top is also a good way to debug this. Run top and check if the Apache processes are using too much CPU. Then type M to sort the processes by memory usage and check if they're consuming too much RAM.

Check also if you are swapping:

free

The memcached runs on the same server? If so, how much memory does it have allocated?

Also, are you having trouble with i/o wait? Check the %wa value when running top.

Regarding the network, are you having errors or CRCs? Check it with netstat:

netstat -i

Take a look the RX-ERR, RX-DRP, TX-ERR and TX-DRP columns. Ideally, these values should be 0.

Hope this helps.

Related Topic