Adding gzip compression to tomcat to improve speed.

Gzipping can result in a significant speed improvement in downloading of files from the tomcat server and is easily enabled in tomcat. When the client (browser) makes a http request it tells the server if it has the ability to deflate. If so the server can gzip files such as xml, css and javascript before they are sent to the client. Significant speed increases are seen in the OpenVPMS web application especially when served from a remote server.

To enable this feature edit the connector in tomcat's server.xml file and add the compression settings as below:

Connector port="8080" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="xxxx" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" useBodyEncodingForURI="true"
compressableMimeType="text/html,text/xml,text/css,text/javascript,text/plain" compression="on"
compressionMinSize="2048" noCompressionUserAgents="gozilla, traviata" />

If you are using firefox you can use the Yslow plugin to check if gzipping is enabled or not. Yslow can also be used to tell you the speed prior to and following enabling compression.

Syndicate content