You can check out - effect of gzipping on HTTP request and response to know about gzip. Here we will see how tomcat has feature to activate this feature.
Tomcat Service has this feature to compress the web pages before being downloaded by surfer, no special plug in or add on at both server or client (browser) side. Also browsers 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.
Tomcat Service has this feature to compress the web pages before being downloaded by surfer, no special plug in or add on at both server or client (browser) side. Also browsers 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.
Enabling Gzip compression tomcat (Settings)
Following are the steps to enable GZIP compression on Tomcat:- edit file /conf/server.xml
- Find connector tag. Something like this:
<Connector port="80" maxHttpHeaderSize="8192"
maxThreads="300" minSpareThreads="25" maxSpareThreads="100"
enableLookups="false" redirectPort="443" acceptCount="100"
connectionTimeout="120000" disableUploadTimeout="true"
URIEncoding="utf-8"/> - Add to the following to HTTP Connector configuration:
compression="on"
compressionMinSize="2048"
noCompressionUserAgents="gozilla, traviata"
compressableMimeType="text/html,text/xml"
- Final HTTP Connector configuration with compression enabled would look like this:
<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"/> - Restart the server
No comments:
Post a Comment