Application Performance Series- Part 5- Use Cookie free Domains for Components

This is part 5 of a multiple part series on web performance improvements. The first Introductory blog can be found here. In previous part we discussed about CDN and how they improve the performance of the web application. In this part we will discuss the benefits of cookie-free domains.

When the browser makes a request for a static image it also sends cookies together with the request. The server doesn’t have any use for those cookies. So they only create network traffic for no good reason. We should make sure static components are requested with cookie-free requests.

To achieve this we should create a sub-domain and host all static components there. If the domain is www.example.org, we can host static components on static.example.org. However, if we have already set cookies on the top-level domain example.org as opposed to www.example.org, then all the requests to static.example.org will include those cookies. In this case, we can buy a whole new domain, host static components there, and keep this domain cookie-free.

Some of good examples are:
Yahoo! uses yimg.com
YouTube uses ytimg.com
Amazon uses images-amazon.com
Another benefit of hosting static components on a cookie-free domain is that some proxies might refuse to cache the components that are requested with cookies.
On a related note, if you wonder if you should use example.org or www.example.org for your home page, consider the cookie impact. Omitting www leaves you no choice but to write cookies to *.example.org, so for performance reasons it’s best to use the www sub-domain and write the cookies to that sub-domain.

0 Comments

Leave a Comment