krause krause - 8 months ago 90
Java Question

Tomcat 8 not responsive serving static content

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.

Developer tools snapshot


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) :

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 :


And web.xml :