There are 2 good answers already, but the perhaps most important real-life issue is not mentioned yet.
First off, the OP might want to read the 2 preceding answers and this little blog post to understand what keepalives are. (The author doesn't elaborate on the part about TCPI/IP getting "faster" the longer the connection is open. It is true, longer-lasting connections benefit from IP window scaling, but the effect isn't significant unless the files are large, or the bandwith-delay product is unusually large.)
The big argument against HTTP Keepalive when using Apache is that it blocks Apache processes. I.e. a client using keepalives will prevent 'his' Apache process from serving any other clients, until the client closes the connection or the timeout is reached. In the same span of time, this Apache instance could have served many other connections.
Now, a very common Apache configuration is the Prefork MPM and a PHP / Perl / Python interpreter, and application code in the mentioned language. In this case each Apache process is "heavy" in the sense that it occupies several megabytes of RAM (Apache linked with interpreter and application code). This, together with the blocking of each keepalive'd Apache instance, is inefficient.
A common workaround is to use 2 Apache servers (both on the same physical server, or on 2 servers, as needed) with different configurations:
- one "heavy" with mod_php (or whatever programming language is used) for dynamic content, with keepalives off.
- one "lightweight" with a minimal set of modules, for serving static content (image, css, js etc), with keepalives on.
You can then expand on this separation of dynamic and static content when needed, for example by:
- using an event-driven server for static content, such as nginx.
- using a CDN for static content (could do all static content serving for you)
- implementing caching of static and/or dynamic content
Another approach with regards to avoid blocking Apache is to use a load balancer with smarter connection handling, such as Perlbal.
.. and much more. :-)
I found the answer. There is a utility called netsh
.
netsh http add iplisten ipaddress=xxx.xxx.xxx.xxx
By default there are no IP addresses on the list, so IIS7 will bind to all IP addresses. If you add one IP to the list, it will listen to just that IP or any IP added to the list. It is necessary to restart IIS7 for the change to take effect.
Edit:
To list the IP addresses, type the following command after the IP address is added:
netsh http show iplisten
The netsh
utility returns the following information:
IP addresses present in the IP listen list: xxx.xxx.x.x
Best Answer
The default connection timeout in IIS7 is 2 minutes. Click on your web site in IIS Mgr, click Advanced Settings, and expand Connection Limits. The Connection Timeout (Seconds) setting is what governs this. If IIS doesn't receive activity on a connection for this duration then it will time the connection out. This is regardless of whether or not the connection was requested as a keep-alive. You will, of course, have to have keep-alives enabled for this to be a "keep-alive timeout". Keep-alive is enabled by default in IIS.
You can also set it for the site in the applicationHost.config file using the
<limits>
and theconnectionTimeout
attribute.This will set the timeout value to 2 minutes.