When deploying our application (Java, Spring) on Tomcat 7 it is fine. Now that we upgraded to Tomcat 8 it is very slow when serving static content. Looking at developer tools (see snapshot below), each request of static content (small .js and .css files) it takes as much as we have configured for connectionTimeout in server.xml. Because default is 20000, it may take 20 secs. for each file. When dropping this to 1000 it will be faster, and take 1 sec. for each one.
This happens in different development machines using default configurations. Other processes (web services requests, etc.) are performing ok.
I wonder what and where to start looking.
This is indeed caused by an issue in the Ziplet compression filter due to a servlet spec 3.1
change (setContentLengthLong function).
I've created a pull request to fix it.
This pull request is merged into main and released on April 18th 2016 (ziplet-2.1.0)
The plugin described below (pjl-comp-filter) was used as a CompressionFilter, which turned out not to be compatible with Tomcat 8 as per an open issue in Github for ziplet (its successor) : https://github.com/ziplet/ziplet/issues/6
I replaced it with one of these solutions and it worked :
Which compression (is GZIP the most popular) servlet filter would you suggest?
So former configuration, non working with Tomcat 8 was :
Dependency in pom.xml :
<dependency>
<groupId>org.sourceforge</groupId>
<artifactId>pjl-comp-filter</artifactId>
</dependency>
And web.xml :
<filter>
<filter-name>CompressingFilter</filter-name>
<filter-class>com.planetj.servlet.filter.compression.CompressingFilter</filter-class>
<init-param>
<param-name>includeContentTypes</param-name>
<param-value>text/html,multipart/form-data,text/css,application/x-javascript</param-value>
</init-param>
<init-param>
<param-name>compressionThreshold</param-name>
<param-value>256</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CompressingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With