Bug 875814 - Use appropriate caching policy for GWT application resources
Summary: Use appropriate caching policy for GWT application resources
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-webadmin-portal
Version: 3.2.0
Hardware: Unspecified
OS: Unspecified
urgent
unspecified
Target Milestone: ---
: 3.2.0
Assignee: Alexander Wels
QA Contact: Jiri Belka
URL:
Whiteboard: ux
Depends On:
Blocks: 948448
TreeView+ depends on / blocked
 
Reported: 2012-11-12 15:42 UTC by Vojtech Szocs
Modified: 2022-07-09 06:07 UTC (History)
9 users (show)

Fixed In Version: sf11
Doc Type: Enhancement
Doc Text:
Certain GWT application resources did not have the appropriate caching headers applied due to Apache or JBoss configuration issues. Consequently, the browser could not cache resources that rarely (if ever) changed, and had to request them from the server each time the page was loaded. The proper caching policy is now defined in both the Apache and JBoss configuration, so the browser can properly cache the necessary resources, which results in fewer requests to the server.
Clone Of:
Environment:
Last Closed: 2013-06-10 21:19:50 UTC
oVirt Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHV-47176 0 None None None 2022-07-09 06:07:49 UTC
Red Hat Product Errata RHSA-2013:0888 0 normal SHIPPED_LIVE Moderate: Red Hat Enterprise Virtualization Manager 3.2 update 2013-06-11 00:55:41 UTC
oVirt gerrit 10449 0 None None None Never

Description Vojtech Szocs 2012-11-12 15:42:48 UTC
According to [1], we should enforce appropriate caching policy for key GWT application resources. Preferably, this should be done on JBoss AS level, e.g. through a custom servlet filter in "frontend" UI module (frontend/webadmin/modules/frontend). The implementation should also prefer HTTP/1.1 "Cache-Control" header [2].


a, Resources intended to be cached forever on the client

This includes:
- module permutations <md5>.cache.html
- ClientBundle composite images <md5>.cache.png / <md5>.cache.gif
- split points deferredjs/<md5>/<n>.cache.js

For such resources:
- the client doesn't need to ask server if the content has changed
- use "Cache-Control: max-age=31556926" (Representations may be cached by any cache. The cached representation is to be considered fresh for 1 year.)
- testing: ensure that the resource is not requested again from server, after being cached for the first time


b, Resources which always need to be checked for changes

This includes:
- permutation selector script <applicationName>.nocache.js
- application host page WebAdmin.html/UserPortal.html (dynamic host page servlet)

For such resources:
- the client can cache the resource, but must always ask server if the content has changed
- use "Cache-Control: no-cache" (Representations are allowed to be cached by any cache. But caches must submit the request to the origin server for validation before releasing a cached copy.)
- testing: ensure that the resource is always requested from server, with server responding either 304 (resource not modified) or 200 (new version of resource)
- testing: ensure that response ETag header is set appropriately by the server


c, Resources not intended to be cached on the client at all

This includes:
- GWT RPC calls (Generic API servlet)
- REST API calls [note: related to caching, but not related to GWT for the moment, maybe should be done in future]

For such resources:
- the client must never cache the resource, must always ask server to get its content
- use "Cache-Control: no-store" (Caches must not cache the representation under any condition.)
- testing: ensure that the resource is always requested from server, even if the content didn't change


[1] https://developers.google.com/web-toolkit/doc/latest/DevGuideCompilingAndDebugging#public_resources
[2] http://stackoverflow.com/questions/2970938/ideal-http-cache-control-headers-for-different-types-of-resources

Comment 2 Alexander Wels 2012-12-28 16:59:19 UTC
Code available here:
https://bugzilla.redhat.com/show_bug.cgi?id=875814

Comment 3 Einav Cohen 2013-01-03 02:49:19 UTC
(In reply to comment #2)
> Code available here:
> https://bugzilla.redhat.com/show_bug.cgi?id=875814

Alex, any chance that you meant to put here a link to gerrit (rather than a link to this BZ...)?

Comment 4 Alexander Wels 2013-01-03 13:18:03 UTC
(In reply to comment #2)
> Code available here:
> https://bugzilla.redhat.com/show_bug.cgi?id=875814

Yes, I did mean to put in the link to gerrit which is here:
http://gerrit.ovirt.org/#/c/10449

Comment 9 Vojtech Szocs 2013-03-14 17:14:17 UTC
rhev-3.2 patch verified on local development environment.

Comment 10 Jiri Belka 2013-04-03 08:10:17 UTC
OK, sf12, tested with Firebug.

Comment 11 Itamar Heim 2013-04-25 21:44:16 UTC
any difference in load time after closing-opening the browser due to the caching?

Comment 12 Jiri Belka 2013-04-30 13:34:21 UTC
I don't see any big difference.

Comment 15 errata-xmlrpc 2013-06-10 21:19:50 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2013-0888.html


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