Bug 704294

Summary: enable GZIP compression for the 25 MB xxxxx.cache.html and other large text files (e.g. SmartClient js files) served up by coregui
Product: [Other] RHQ Project Reporter: Ian Springer <ian.springer>
Component: Core UIAssignee: Charles Crouch <ccrouch>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: ccrouch, hbrock, hrupp
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-03 12:56:39 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 678340    

Description Ian Springer 2011-05-12 13:31:07 EDT
This will make initial load of the RHQ GUI significantly faster for users with slow network connections between their RHQ Server and their web browser.

There are a few ways this can be done:

1) Configure Tomcat to do the compression at the HTTP(S) connector level - see http://tomcat.apache.org/tomcat-5.5-doc/config/http.html
2) Configure a servlet filter that does the compression - see http://raibledesigns.com/rd/entry/the_battle_of_the_gzip
3) Configure GWT to do the compression (only available in GWT 2.1 or later, so this is not an option util we upgrade GWT) - see http://code.google.com/p/google-web-toolkit/wiki/PrecompressLinker

I think 1) is the way to go, since the Tomcat code is most likely fairly battle-hardened.
Comment 1 Ian Springer 2011-05-12 14:41:21 EDT
Approach 1 has been implemented - [master b93c06c].

Specifically, the following attributes were added to the http and https connectors in the RHQ Server's Tomcat/JBossWeb server.xml:

compression="51200"
compressableMimeType="text/html,text/xml,text/plain,text/javascript,text/css"

which tells Tomcat to GZIP compress html, plaintext, javascript, or css files larger than 50K, if the client browser supports GZIP compressed responses (I'm pretty sure all of our supported browsers do).

Before configuring compression, the very first load of coregui took about 30 seconds for me. After adding it, it took only 10 seconds (3x faster!). And my browser was on the same machine as my RHQ Server - the savings for remote clients will be even greater.
Comment 2 Ian Springer 2011-05-12 14:43:26 EDT
Note, we should consider switching to approach 3) once we've upgraded to GWT 2.1 or later, since the GWT preecompress filter supports precompression of the files as well as caching of the compressed files, whereas Tomcat always (re)compresses the files on demand.
Comment 3 Mike Foley 2011-05-24 09:06:52 EDT
documenting the verification as follows:

1)  I see gzip in the HTTP request header (from Firebug), as documented below

Server	Apache-Coyote/1.1
X-Powered-By	Servlet 2.4; JBoss-4.2.0.CR2 (build: SVNTag=JBoss_4_2_0_CR2 date=200704160918)/Tomcat-5.5
Date	Tue, 24 May 2011 12:50:06 GMT
Expires	Wed, 23 May 2012 12:50:06 GMT
Cache-Control	max-age=31536000
Etag	W/"27453741-1306165444000"
Last-Modified	Mon, 23 May 2011 15:44:04 GMT
Content-Type	text/html
Content-Encoding	gzip        <<<<<<<<<<<<<<<VERIFICATION<<<<<<<<<<
Vary	Accept-Encoding
Request Headersview source
Host	localhost:7080
User-Agent	Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.6.17-1.fc14 Firefox/3.6.17
Accept	text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language	en-us,en;q=0.5
Accept-Encoding	gzip,deflate
Accept-Charset	ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive	115
Connection	keep-alive
Referer	http://localhost:7080/coregui/
Cookie	RHQ_Session=-703695851; JSESSIONID=984E5DDB15234CB39D8743336288AC5A; sahisid=sahi_3c40d04800a93045340834b0dc8d6aea7e65


2) a Firefox plugin called "YSlow" grades RHQ with a "B" for gzip compression.
Comment 6 Heiko W. Rupp 2013-09-03 12:56:39 EDT
Bulk closing of old issues that are in VERIFIED state.