Java: Tomcat slow serving static files?

Tomcat 7 supports serving static files outside of the WAR. See here (point 4.) Have you tried it?

Can you confirm that it's the Tomcat that generates such a delay (for instance using Tomcat's access log)? It shouldn't be hard to correlate slowly downloaded file with entry in access log on the server side.

What are the HTTP threads doing during the test? It would be amazing to dump stack traces when this phenomenon happens. If you see that some resource takes excessively long time to download, just perform dump and find the guilty thread (with tuned access log you can print the thread name).


Have an apache web server before the tomcat and serve images and js from there. Route the rest of traffic to tomcat through proxy settings or ajp.