![]() |
DO you use keep alive mod at apache?
are you using it? Some ppl say it's making requests going faster. Any experience here?
http://httpd.apache.org/docs-2.0/mod...html#keepalive |
The only thing keepalive does is not run the 4-way close handshake on the TCP connection directly after fulfilling a request. It instead waits for a passive close, OR in the case of a timeout it does an active close.
There are benifits to this. For one, since the client would then be sending the 4-way handshake (FIN/ACK/FIN/ACK), the server would be doing a passive close on the TCP connection so the kernel would not put that child processess into TIME_WAIT. Additionally since most browsers use non-blocking sockets and async recvs, you can ususally get a few requests for each child fork(). However DO NOT set the Keepalive timeout too high! You do NOT need the default value of 15 seconds. Since Apache uses a pre-forking model to handle calls to accept, it is faster to just hand the request to a new child process if more than 2-3 seconds elapse in between requests. Just make sure that your MinServers and SpareServers are set to resonable values so that you don't run into a ramp-up effect of processess trying to fork(). The less time that Apache spends in the select() accept() loop the better because Apache uses a Mutex to protect the serialization of sockets which ends up blocking, so since most clients support HTTP/1.1 and Keepalive, it is usually a slight speed increase beacuse it does not get stuck polling the mutex. If for some reason the client only supports HTTP/1.0 (its usually a bot at this point), the Keepalive will timeout and apache will make an active close on the connection. so you only lost the initial timeout value over not using keepalive at all. |
Thnx a lot,
Andre |
Basically what I'd say is if you use the server for TGP galleries, then go for it (KeepAlive On), if you serve mainly seperate files, turn it off.
Let's take an example with a gallery of 20 thumbs. With KeepAlive Off, the browser will open 1 connection for the HTML, will parse it then will open 1 connection to get each thumbs (which totals 21 connections). On the other hand, with KeepAlive On, the browser will open 1 connection for the HTML, parse it and reuse the connection to get the thumbs. Thus in a perfect world it would use only 1 connection instead of 21. In reality it doesn't work exactly like that, because usually browsers will open 2 connections at the same time to speed up things. But it still saves you a lot of connections and thus processing time and server ressources. But if you serve for instance .exe files or something like that, chances are thin a browser could reuse the connection and thus is pointeless. Just be sure to follow thepiper's advices and you'll be alright! |
Here's an interesting link. The relevant part is the persistent connection/pipelining section.
http://www.w3.org/Protocols/HTTP/Per.../Pipeline.html |
All times are GMT -7. The time now is 12:37 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123