nokeepalive

·

KeepAlive is an Apache rule that controls whether an HTTP connection is kept alive for subsequent requests. It's switched on or off - and the timeout configured - in Apache's main configuration file.

HubMed serves lots of RSS feeds, but has a small number of Apache processes. It hands off requests for RSS feeds to another server, but because of KeepAlive each Apache process is then tied up for a second or two waiting for a subsequent request on the same connection, which means no-one else can connect.

This seems to work for closing the connection once a redirect has occurred:

RewriteRule FROM TO [R=302,L,NE,E=nokeepalive:1]>

(where FROM is the request matching pattern and TO is the redirect path).

It doesn't seem to matter what nokeepalive is set to, just that it's set to something.

Also, you can prevent KeepAlive for requests to a certain directory:

<Directory "/path/to/directory">SetEnv nokeepalive</Directory>

These might work as well, for preventing KeepAlive for certain types of request (I haven't tested them):

SetEnvIf Request_Method "HEAD" nokeepalive
or
<Limit HEAD>SetEnv nokeepalive</Limit>
In theory KeepAlive should make fetching lots of small files from the same server faster, using one connection. The trouble is that browsers often open up multiple connections at once, which each grab a few files quickly then hang on to the kept-alive connections for too long. There doesn't seem to be an easy way round this - limitipconn maybe...