Easy to Learn Java: Programming Articles, Examples and Tips

Start with Java in a few days with Java Lessons or Lectures

Home

Code Examples

Java Tools

More Java Tools!

Java Forum

All Java Tips

Books

Submit News
Search the site here...
Search...
 
Search the JavaFAQ.nu
1000 Java Tips ebook

1000 Java Tips - Click here for the high resolution copy!1000 Java Tips - Click here for the high resolution copy!

Java Screensaver, take it here

Free "1000 Java Tips" eBook is here! It is huge collection of big and small Java programming articles and tips. Please take your copy here.

Take your copy of free "Java Technology Screensaver"!.

Make Tomcat page load faster

JavaFAQ Home » Java Installation, tunning, options... Go to all tips in Java Installation, tunning, options...


Bookmark and Share

Improve page loading time on Tomcat server.

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 Smile

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" />


 Printer Friendly Page  Printer Friendly Page
 Send to a Friend  Send to a Friend

.. Bookmark and Share

Search here again if you need more info!
Custom Search



Home Code Examples Java Forum All Java Tips Books Submit News, Code... Search... Offshore Software Tech Doodling

RSS feed Java FAQ RSS feed Java FAQ News     

    RSS feed Java Forums RSS feed Java Forums

All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest 1999-2006 by Java FAQs Daily Tips.

Interactive software released under GNU GPL, Code Credits, Privacy Policy