Adsense

Make Tomcat Page Load Faster

If you use Tomcat server to serve remote clients over the Internet you can significantly improve page loading time by enabling content compression. A content become compressed when it transports over the Internet. All modern browsers support HTTP/1.1 GZIP compression and if your server also enables it, the page load time decreases dramatically. They just popping out in a browser, like if they were served from a local server.

Enable compression In Tomcat for certain file types

Enable compression by adding compression="on" or compression="force". Please notice that MIME type of content type to be compressed is defined in compressableMimeType variable. Those variables are optional for Tomcat Connector and are defined in server.xml file. This file is the part of Tomcat configuration files and situated in conf directory under Tomcat home directory.

Two more useful parameters are, example:

compressionMinSize="2048"
noCompressionUserAgents="gozilla, traviata"

Skip compression for small files in Tomcat

Compression minimal size is good to skip compressing too small files - the compression overhead will take away all benefits and can result in even bigger file.

Look at the next example below:


<Connector port="8443" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="5" maxSpareThreads="25"
enableLookups="false" disableUploadTimeout="true"
acceptCount="100" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" compression="on"
compressionMinSize="2048"
noCompressionUserAgents="gozilla, traviata"
compressableMimeType="text/html,text/xml" />

Comments :

0 comments to “Make Tomcat Page Load Faster”

Post a Comment