Friday, March 30, 2007

Best Practices to Improve Page Load Time (Keep-Alive)

Best Practices to Improve Page Load Time (Keep-Alive)

Best Practice 1: TCP Keep-Alives should be kept on.

Keep-Alives are turned on by default for IIS. Unfortunately, they seem to be one of the first things some people turn off while troubleshooting problems such as memory leaks.

When keep-Alives are on, a TCP connection is opened and then used for several files, with only the one round-trip-delay used to open the port.

When Keep-Alives are off at the server, the browser will open a TCP port then Get a file. In the response packet will be an HTML header: connection = close. This tells the browser that Keep-Alives are off and the TCP connection will be closed at the end of the file transfer. So, the browser will be forced to open a new TCP port for every file GET. This costs an extra round-trip-delay for every file.

The following VRTA chart shows two variations of the HotMail Today page BBPLT2 (immediately before & after Dec 21, 2004) In the top chart Keep-Alives were off. Notice the Page-Load-Time across the fixed WAN delay of 300ms is 18.5 seconds. Also notice the vertical column showing 33 TCP ports being opened. The second charts the same page with Keep-Alives now turned on. Notice there are now only 16 ports and the PLT has dropped to 13 seconds

Known Issues:

Turning Keep-Alives on causes the number of concurrent TCP connections to increase. Here's an update from Jason Pratt in Japan.

"We rolled out a similar QFE for the Japanese sites earlier this month that allowed for more TCP connections for clients to retrieve images, etc. And we saw problems with the servers handling the increased connections, so we threw some servers temporarily in there to respond to the increased number of connections.

Today we conducted some testing on our MSN.Com Japan servers to try to get a better idea of TCP connection limits for IIS6.

Previously, we ran into problems when these servers hit between 8,000 and 9,000 current connections. When this happened, IIS would reset connections, reject connections, etc. We’ve had this limit on all of our servers in APJ – the limit appears to not really vary by Application, etc – all systems are similarly affected.

We made some registry changes for HTTP sys to the MaxConnections key - http://support.microsoft.com/default.aspx?scid=kb;en-us;820129. We set this equal to 30,000 connections on our servers (DL580 – 4x700MHz, 1G Ram).

By removing servers from the cluster, we were able to increase load and connections on the remaining servers. We were able run at 28,000 current connections successfully. The only reason we ran into problems above this point is that we were saturating the FE NIC – all other perf counters on the server seemed to indicate the server was healthy, etc, and Keynote was returning consistently good results. The increase in memory utilization associated with this was negligible. Based on what we saw, we believe that the only reason we weren’t able to go higher was the NIC utilization. "

0 Comments:

Post a Comment

<< Home