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 http://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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s