Summary
Yahoo's YUI team reports on a recent experiment aimed at maximizing Web page performance by tuning how many page elements a browser loads in parallel.
Advertisement
Yahoo's YUI team has been sharing its Web application performance findings in a series of articles published over the past few months. The latest installment in their series, Maximizing Parallel Downloads in the Carpool Lane, suggests ways to optimize Web application performance by increasing the number page items a browser loads in parallel.
The most interesting general conclusion of the YUI performance articles series is that Web application performance is to a very great extent affected by client-side performance. The user's perception is impacted most by how fast the browser can load and render a page, and various Web page architectural techniques can measurably improve, or hinder, client-side performance.
The most recent installment in the YUI series addresses the problem of parallel downloads initiated by the browser:
The biggest impact on end-user response times is the number of components in the page. Each component requires an extra HTTP request, perhaps not when the cache is full, but definitely when the cache is empty. Knowing that the browser performs HTTP requests in parallel, you may ask why the number of HTTP requests affects response time...
The explanation goes back to the HTTP/1.1 spec, which suggests that browsers download two components in parallel per hostname... Viewing these HTTP requests reveals a stair-step pattern:
The authors note that while most browsers follow this recommendations, others, such as Safari, download eight items in parallel. In addition, the number of parallel downloads can be increased by browser configuration parameters for IE as well as for Firefox.
Instead of users having to adjust their browser settings, the article suggests a better technique, controlled entirely on the server:
Most web sites today use HTTP/1.1, but the idea of increasing parallel downloads beyond two per hostname is intriguing. Instead of relying on users to modify their browser settings, front-end engineers could simply use CNAMEs (DNS aliases) to split their components across multiple hostnames...
At the same time, the Yahoo team noticed in experiments that client performance degrades beyond some number of parallel downloads:
Maximizing parallel downloads doesn’t come without a cost. Depending on your bandwidth and CPU speed, too many parallel downloads can degrade performance....
One possible contributor for slower response times is the amount of CPU thrashing on the client caused by increasing the number of parallel downloads...
Another issue to consider is that DNS lookup times vary significantly across ISPs and geographic locations. Typically, DNS lookup times for users from non-US cities are significantly higher than those for users within the US. If a good percentage of your users are coming from outside the US, the benefits of increasing parallel downloads is offset by the time to make many DNS lookups.
Based on the results of experiments described in the article, the authors conclude that:
Our rule of thumb is to increase the number of parallel downloads by using at least two, but no more than four hostnames. Once again, this underscores the number one rule for improving response times: reduce the number of components in the page.
What techniques have you found most useful to increase client-side performance of your Web application?