Bug 676902 - Add Cache-Control: max-age header for static pages to decrease page load time
Summary: Add Cache-Control: max-age header for static pages to decrease page load time
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise MRG
Classification: Red Hat
Component: cumin
Version: 1.3
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: 2.0
: ---
Assignee: Trevor McKay
QA Contact: Jan Sarenik
URL:
Whiteboard:
Depends On:
Blocks: 693778
TreeView+ depends on / blocked
 
Reported: 2011-02-11 18:22 UTC by Trevor McKay
Modified: 2011-06-23 15:40 UTC (History)
4 users (show)

Fixed In Version: cumin-0.1.4519-2.el5
Doc Type: Bug Fix
Doc Text:
Cause Static resources in cumin use the "If-Mpdified-Since" http header but are not setting a cache expiration date. Consequence Static content is not transferred for resources which are cached by the browser, but there is still round trip communication to the server when a resource is loaded. This overhead is unnecessary and negatively affects cumin performance. Change Add a Cache-Control max-age header to all static resources served by cumin. Result Setting the expiration times on static resources results in a significant improvement in the number of pages per second that can be served by cumin.
Clone Of:
Environment:
Last Closed: 2011-06-23 15:40:16 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2011:0889 0 normal SHIPPED_LIVE Red Hat Enterprise MRG Grid 2.0 Release 2011-06-23 15:35:53 UTC

Description Trevor McKay 2011-02-11 18:22:58 UTC
Description of problem:

Static pages currently benefit from "If-Modified-Since" headers which allow a web browser to query the server for a page and only receive the content if it has changed.  This is good, but it still requires a round trip to the web server.  It is typical of cumin to include a dozen or more individual gets for static resources on a page, and these gets can be avoided.

Using the Cache-Control: max-age=N header to give a page an expiration date in seconds avoids the round trip.  Initial value for for max-age will be 86400, one day in seconds.  This header should be applied to static resources of the following types:

text/css, image/gif, image/jpeg, text/javascript, image/png

How to reproduce:

1) Navigate through cumin web pages using a browser extension like Firebug to examine HTTP requests/responses.

2) Note that for GET of static resources such as mootools.js or wooly.css the status code returned from the cumin web server is "304 Not Modified" after an initial page is visited with a fresh browser (the first status will be "200 OK")

Expected Result:

Using a version of cumin with this feature applied, Firebug should indicate that static resources like those above are automatically retrieved from the local cache without a query to the server.  Note, different tools may indicate this is in different ways.  Firebug will show cached requests as greyed out, and also contains cache fetch information for requests benefiting from the cache.

The response headers can also be examined in Firebug to verify that the "Cache-Control max-age=N" header is present in responses for static pages.

Comment 1 Trevor McKay 2011-02-11 18:30:18 UTC
Fixed in trunk, revision 4519.

Comment 2 Trevor McKay 2011-02-14 15:45:58 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause
    Static resources in cumin use the "If-Mpdified-Since" http header but are not setting a cache expiration date. 

Consequence
    Static content is not transferred for resources which are cached by the browser, but there is still round trip communication to the server when a resource is loaded.  This overhead is unnecessary and negatively affects cumin performance.

Change
    Add a Cache-Control max-age header to all static resources served by cumin.

Result
    Setting the expiration times on static resources results in a significant improvement in the number of pages per second that can be served by cumin.

Comment 3 Jan Sarenik 2011-04-07 08:41:27 UTC
Verified in cumin-0.1.4683-1.el5

Comment 4 errata-xmlrpc 2011-06-23 15:40:16 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHEA-2011-0889.html


Note You need to log in before you can comment on or make changes to this bug.