Enable GZIP compression in tomcat
11:02 AMhis applies to all the version of tomcat and this feature enabled for NimsoftSD and helped a lot to improve their application performance.
What is GZIP?
It is a compression format created by Jean-Loup Gailly and Mark Adler. Version 0.1 was first publicly released on October 31, 1992.
GZIP is based on the DEFLATE algorithm, which is a combination of LZ77 and Huffman coding. DEFLATE was intended as a replacement for LZW and other patent-encumbered data compression algorithms which, at the time, limited the usability of compress and other popular archives.
How does it helps in improving performance of my web page?
Modern browser like Internet Explorer, Firefox, Opera etc supports gzip compressed content. These browsers are capable of uncompressing gzip data into plain text. Servers like Apache, Tomcat, JBoss etc supports gzip compression too. Hence if gzip is enabled in such servers, the response if first compressed and then send to client. Hence this increase performance by many folds.
How to enable GZIP in my tomcat server?
Here is how to enable GZIP compression on Tomcat: edit file /conf/server.xml and add to the HTTP Connector configuration something like this:
compression=
"on"
compressionMinSize=
"2048"
noCompressionUserAgents=
"gozilla, traviata"
compressableMimeType=
"text/html,text/xml"
An example of a HTTP Connector configuration with compression enabled could be:
<Connector port=
"8080"
maxHttpHeaderSize=
"8192"
maxThreads=
"150"
minSpareThreads=
"25"
maxSpareThreads=
"75"
enableLookups=
"false"
redirectPort=
"8443"
acceptCount=
"100"
connectionTimeout=
"20000"
disableUploadTimeout=
"true"
compression=
"on"
compressionMinSize=
"2048"
noCompressionUserAgents=
"gozilla, traviata"
compressableMimeType=
"text/html,text/xml"
/>
0 comments