Reducing the number of HTTP requests necessary to render your page
is the best way to accelerate the user experience. You can achieve this by
maximizing the browser’s ability to cache your components, but the
ETag header thwarts caching when a web
site is hosted on more than one server. In this chapter, I explain what
ETags are and how their default implementation slows down web
What’s an ETag?
Entity tags (ETags) are a mechanism that
web servers and browsers use to validate cached components. Before
jumping into the details of ETags, let’s review how components are
cached and validated.
As the browser downloads components, it stores them in its
cache. On subsequent page views, if the cached component is “fresh,”
the browser reads it from disk and avoids making an HTTP request. A
component is fresh if it hasn’t expired, based on the value in the
Expires header. Let’s look at an
When a component is requested, the server of origin has the
option to send an Expires header
back in the response:
Expires: Thu, 15 Apr 2010 20:00:00 GMT
Chapter 5 recommends
setting an expiration date in the far future. How far is “far” depends
on the component in question. An ad image might have to expire daily,
whereas a company logo could expire in 10 years. The HTTP
suggests servers should not set an Expires date more than one year in the future, but this is a guideline; ...
Get High Performance Web Sites now with O’Reilly online learning.
O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.