Let me quote from Wikipedia straight away…
<snip>
An ETag, or entity tag, is part of HTTP, the protocol for the World Wide Web. It is one of several mechanisms that HTTP provides for cache validation, and which allows a client to make conditional requests. This allows caches to be more efficient, and saves bandwidth, as a web server does not need to send a full response if the content has not changed…..
An ETag is an opaque identifier assigned by a web server to a specific version of a resource found at a URL. If the resource content at that URL ever changes, a new and different ETag is assigned. Used in this manner ETags are similar to fingerprints, and they can be quickly compared to determine if two versions of a resource are the same or are different. Comparing ETags only makes sense with respect to one URL - ETags for resources obtained from different URLs may or may not be equal and no meaning can be inferred from their comparison.
</snip>
In case, you are not much aware of ETags, read the above again… seriously… read it! Okay. You can see that it looks like Etag is meant to do good. Well… I won't disagree either. The only thing I want to add here is that IF you are using IIS and IF there is a Network Load Balancer involved, you may have to go an extra mile and ensure things are properly configured! If you don't configure it properly, you may end up with unnecessary retransmission of a file, degrading the performance instead!
So to check if things are NOT well configured, let's understand how it all appears when things are properly configured!
Install Fiddler from www.fiddlertool.com and run it. You can repeat the exercise once you are done reading this. For the time being let me put some snapshots, so that it is easy to understand.
Image may be NSFW.
Clik here to view.I have just browsed www.bing.com and fiddler tool captured the following traces…
Image may be NSFW.
Clik here to view.Image may be NSFW.
Clik here to view.Notice above… the request was for a specific page… Windows7_T.png and we got a 200 OK response from the server, along with an ETag.
Image may be NSFW.
Clik here to view.I have done F5 (Refresh) on my IE browser, and fiddler catches another few requests. [Notice that CTRL + F5 would fetch the latest file anyways, so you don't need to do CTRL + F5 for this test]
Image may be NSFW.
Clik here to view.Image may be NSFW.
Clik here to view.Notice how the response code changed to 304. Also notice that the If-None-Match header was sent to the server. The server in turn checked the tag, and sent a response header with 304 AND BODY Size = 0 Bytes! This is where you save your bandwidth. Had the Etag, been mismatched the server would have sent the entire file to your client, even if IE has the cached copy.
Image may be NSFW.
Clik here to view.Now that we know how things look like when everything is good, let me tell you how you can sync the ETAG on all your servers in the NLB.
Image may be NSFW.
Clik here to view.Locate adsutil.vbs (typically in %systemroot%\inetpub\adminscripts)
Image may be NSFW.
Clik here to view.In that directory, issue the following command:
cscript adsutil.vbs set w3svc/etag_changenumber 0
Image may be NSFW.
Clik here to view.Repeat this step on all the IIS 6 servers. On IIS 7, this is not required, since the value automatically defaults to 0.
Image may be NSFW.
Clik here to view.You can also follow the Workaround #1 in http://support.microsoft.com/kb/922703 in case you like to do it using GUI
Until next time, Image may be NSFW.
Clik here to view.
Rahul
Quote of the day:
The real hero is always a hero by mistake; he dreams of being an honest coward like everybody else. - Umberto Eco