Web Software Architecture and Engineering – Life on the Bleeding Edge

There is a lot of discussion on ETags. For those who don’t know, read:

However, ETags can become a problem when you run a cluster/farm, so each request to unique server returns a different ETag. Some of this has been fixed in IIS 7. Also, it seems, if you are using the Expiry (a better practice), having ETags results in a worse YSlow rating.
Our YSlow Rating was 68. We added Expire Header info, and the score went to 85. However, upon turning off ETags, we jumped further to 88.
Unfortunately, there didnt seem to be any good way to disable ETags on IIS 6. Most posts and articles referenced working the IIS Metabase, and still there was a MS Hotfix for those where the MetaBase edit would not stick. Ugh.
I wasn’t sure I wanted to do all that just for 3 point in YSlow, until I came across this site. See: http://blogs.iis.net/chrisad/archive/2006/12/18/iis7-deployments-calls-for-etag-usage-review-if-using.aspx. The site itself covers IIS 7, and was useless to me, until I saw the last comment.
“Remove ETags from the Http Response by setting a blank ETag header. In IIS Manager, right click Web Site (or any folder), click Properties, select HttpHeaders tab, add Custom Http Header called ETag but leave the value blank.”
Although this would still return an ETag in the HTTP Header, I tried this an voila, it worked. So simple, it was stupid! And now we’re getting an “A” in the ETags area in YSlow, and a better overall score.


Comments on: "Disable/Remove ETags on IIS 6 to Improve Performance" (8)

  1. This is a good article, and glad I found it as the ETag issue was causing me to pull hair after following all patches and meta editing and still getting an “F” for ETag – especially because I am not using a farm. What I don’t know is are we just fooling the YSlow script to give a better score and pat ourselves on the back, or does this truly resolve any issues with performance and caching in the case where a server farm is used? If it is the former, I would still like to find a true performance solution. If it is the latter, there should be better publication on this from Microsoft as a simple solution!

  2. Yahoo’s problems may not be your problems.

    Disabaling Etags might be good if you’ve got a server farm. Otherwise better leave it as it is.

    Here is a good explanation: http://www.codinghorror.com/blog/2007/08/yslow-yahoos-problems-are-not-your-problems.html

    ETags are a checksum field served up with each server file so the client can tell if the server resource is different from the cached version the client holds locally. Yahoo recommends turning ETags off because they cause problems on server farms due to the way they are generated with machine-specific markers. So unless you run a server farm, you should ignore this guidance. It’ll only make your site perform worse because the client will have a more difficult time determining if its cache is stale or fresh. It is possible for the client to use the existing last-modified date fields to determine whether the cache is stale, but last-modified is a weak validator, whereas Entity Tag (ETag) is a strong validator. Why trade strength for weakness?

  3. @Kavinda thank you very much for your reply – I think this is the type of advice that Yahoo! needs to include with its Yslow plugin. I always suspected the ETags config was just a wild goose chase, especially because I had configured all of them to be the same version and Yslow still claimed I had not “configured” ETags. It seems like Yslow is only happy if they don’t exist and doesn’t truly check if they are consistent across domains. I have to say, I haven’t noticed a measurable negative impact from removing the ETags, but I also have cache control enabled which likely reduces a lot of pings. It might also have to do with the amount of traffic – our site is no Yahoo!, but it isn’t some small blog either. It might be at the right balance for the performance difference.

    For files that rarely change or could easily be versioned (like images and 3rd party scripts) it really makes a lot of sense to set the expires way far out and just use a new version number when changes are made. This helped quite a bit with performance as navigation and background images and scripts used on all pages can be cached after the first hit, improving performance on both sides.

  4. Hi Author,

    Thanks for the right answer i was looking for, i was seeing the same problem of ETags in yslow, now as you said i did it in my server and now it is not a problem any more in YSLOW, i am not sure whether it is good or not? but it is no more reporting by yslow. Hey now i can see this error “use a content delivery network” do u have any idea how to fix this? my site performance score is 90% cheers!!!

  5. Thanks for this. Easy solution for those poor souls who still use IIS6!

  6. After I have restarted IIS 6 the custom added Etag header is gone….? Any ideas?

  7. never mind, i run iisreset /timeout:0 so i guess it was not saved properly after running iisreset without the option is worked…

  8. for apache server its simple, those who want quick solution to remove Etags.

    You can solve by adding below :

    Header unset ETag
    FileETag None

    Place it into your htaccess, near top

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: