RequirementRecently I worked on a project that involved putting a fairly complex hotmail preview widget on the ninemsn homepage. After completing development and integrated the widget on our homepage I realised that as the widget required the user to be signed in with their Live ID and we used RPS (Live ID for partner sites) we were getting very big client side cookies that were being used for profiling and authentication (total weight of these cookies were 800 Bytes).
As seen below using the Net tab.
If the browser makes 100 calls to the server requesting files, each one of these 100 calls will have the 800 Byte worth of cookie data as part of the header. So that’s 100 X 800 bytes worth of data being thrown to your server that hosts the files (most probably by your hosting company).
This is called ‘Inbound’ data and is usually free as part of the hosting plan (you usually pay for outbound data which is what hosting companies refer to when they say ‘data transfer limits’, this is basically the total files that are sent from the hosting companies servers to the users browser). Hoverer, if your hosting company does notice that your incoming data is generally high then are most likely to switch your payment plan to a plan that works on a ratio. For example, a 30:70 ratio which you pay for both incoming and outgoing data on a 30/70 split plan.
The plans can be a bit more complicated than this, but the bottom line is that you will end up paying for incoming data as well and this is where you need to shave off the extra cookies and extra calls made to your server.
Here are some tips:
1) Set up another domain and CNAME it to point to your main domain.
If you primary domain name is www.newbreedofgeek.com, buy another domain like www.just ageek.com and create a CNAME that points to the primary domain www.newbreedofgeek.com. So basically, going to www.just ageek.com is the same as going to www.newbreedofgeek.com
Now, all your cookies that you use on your side for various reasons will most probably be set on your primary domain level. Write some server side code or just hard code all your resource calls to the primary domain to come from the secondary domain.
If there is a image called company_logo.gif on the www.newbreedofgeek.com/default.aspx page on your site instead of calling it like this www.newbreedofgeek.com/ company_logo.gif call it like this www.just ageek.com/ company_logo.gif
Hope that makes sense. By doing this, when the request for the company_logo.gif comes to the hosting server it won’t carry any cookie info with it because the cookies have been set on the primary domain www.newbreedofgeek.com.
2) Merge resources together
ConclusionI hope these tips help as it certainly helped my company save thousands, if you have any questions or comments please leave them below and I’ll get back o you guys.