tomcat

How to enable gzip compression under Tomcat

You can enable compression in Tomcat adding following lines to connector configuration in server.xml

         compression="on" 
         compressionMinSize="2048" 
         noCompressionUserAgents="gozilla, traviata" 
         compressableMimeType="text/html,text/xml"

An example of connector configuration
    <Connector port="80" protocol="HTTP/1.1"
   			 	compression="on" 
	         	compressionMinSize="2048" 
               connectionTimeout="20000" URIEncoding="UTF-8"
               redirectPort="8444" />

Hibernate and MySQL Connection Timeouts

Some days ago i had have issue with my persistent level. The issue was with mysql connection timeout and hibernate c3p0 default connection setup.
Problem:
After 8 hours of inactivity of my application i have a broken pipe exception.
Root of problem:
MySQL automatically times out, and closes unused connections after 8 hours, and out of the box, Hibernate does not set up C3P0 to appropriately test/refresh its connection pool when connections go stale.
Solution:

Syndicate content