Boosting apache performance. Keepalive On or Off ?

Boosting apache performance in high load environments.

I suggest decreasing timeout value and keepalivetimeout, as well as other values listed and described below.

Original timeout has been set to 300 by default. I suggest decreasing it to 120 (2 minutes) so all connections will timeout after 2 minutes. period.

Timeout 120
By default, keepalive is turned on for apache daemon. This is good, but there are some cases that it should be turned off as there is no gain. Usually this happens when you are serving medium to large files with a lot concurrent connections. Play around and see what works the best. Please pay attention to keepalive timeout as well (we will shortly post sysctl tweaks for network stack as well).

KeepAlive On
Maxkeepaliverequests is the maximum number of http requests over one persistent connection. If you are serving a lot of small files, increasing this value will boost overal performance. If the persistent connectivity is closed and browser requests a new request, a new connection will open, thus, slowing down overal performance a bit. This value however doesn’t apply if you have keepalive’s turned off.

MaxKeepAliveRequests 1000

Keepalivetimeout is the value in seconds to wait for the next request over the same connection for the same client. If you are serving a lot of small files, increasing this value will help. In another case, if you have thousands of concurrent connections, decreasing this value will boost the performance.

KeepAliveTimeout 15

For high load servers, please test KeepAliveTimeout with 2…5 seconds and see how does it affect you.


Comments

  1. vipin sahu says:

    i want to use this feature with my .htaccess . how can i use ?

    thanks

  2. JennaH says:

    Does it matter where inside httpd i put those directive in?

  3. Dave says:

    @vipin

    it cannot be used in an .htaccess file

Leave a Reply