flash service

High_Performance_Web_Sites

Issue link: https://read.uberflip.com/i/1146286

Contents of this Issue

Navigation

Page 47 of 169

26 | Chapter 3: Rule 3: Add an Expires Header any component that changes infrequently, including scripts, stylesheets, and Flash components. Typically, an HTML document won't have a future Expires header because it contains dynamic content that is updated on each user request. In the ideal situation, all the components in a page would have a far future Expires header, and subsequent page views would make just a single HTTP request for the HTML document. When all of the document's components are read from the browser's cache, the response time is cut by 50% or more. I surveyed 10 top Internet sites in the U.S and recorded how many of the images, scripts, and stylesheets had an Expires or a Cache-Control max-age header set at least 30 days in the future. As shown in Table 3-2, the news isn't good. Three types of components are tallied: images, stylesheets, and scripts. Table 3-2 shows the num- ber of components that are cacheable for at least 30 days out of the total number of components of each type. Let's see to what extent these sites employ the practice of making their components cacheable: • Five sites make a majority of their images cacheable for 30 days or more. • Four sites make a majority of their stylesheets cacheable for 30 days or more. • Two sites make a majority of their scripts cacheable for 30 days or more. The overall percentage from Table 3-2 indicates that 74.7% of all components were either not cacheable or were cacheable for less than 30 days. One possible explana- tion is that these components shouldn't be cached. For example, a news site such as cnn.com, with 0 out of 138 images cacheable, may have many news photos that should be constantly refreshed in case of updates, rather than cached in the user's browser. The Last-Modified header allows us to see when a component was last modified. If components weren't cached because they change frequently, we'd expect to see recent Last-Modified dates. Table 3-2. Components with an Expires header Web site Images Stylesheets Scripts Median Last-Modified∆ http://www.amazon.com 0/62 0/1 0/3 114 days http://www.aol.com 23/43 1/1 6/18 217 days http://www.cnn.com 0/138 0/2 2/11 227 days http://www.ebay.com 16/20 0/2 0/7 140 days http://froogle.google.com 1/23 0/1 0/1 454 days http://www.msn.com 32/35 1/1 3/9 34 days http://www.myspace.com 0/18 0/2 0/2 1 day http://www.wikipedia.org 6/8 1/1 2/3 1 day http://www.yahoo.com 23/23 1/1 4/4 - http://www.youtube.com 0/32 0/3 0/7 26 days

Articles in this issue

Links on this page

Archives of this issue

view archives of flash service - High_Performance_Web_Sites