No Zuo No Die Why You Try

Tomcat 8's Performance Penalty

A really simple project: https://github.com/lwr/tomcat8-custom-loader

What’s the problem

You should read this thread (Warning: TL;DR)

https://issues.apache.org/bugzilla/show_bug.cgi?id=57251

Conclusions:

What it solves

Now use a custom loader from this project (currently 0.5) fix some problems:

How to use

Build the project first, using

mvn package

or

mvn install

Then

  1. drop the jar from target to your tomcat’s ${catalina.base}/lib
  2. edit ${catalina.base}/conf/context.xml
  3. add this line to context.xml

    <Loader loaderClass="com.github.lwr.tomcat8.CustomWebappClassLoader"/>
    

    (after edited)

    <!-- The contents of this file will be loaded for each web application -->
    <Context>
        ... ...
    
        <!-- Bellow is the added new line -->
        <Loader loaderClass="com.github.lwr.tomcat8.CustomWebappClassLoader"/>
    </Context>
    
  4. start / restart your tomcat to check the load time

About hacking and maintainability

It is not a perfect project, and it uses some hacks such as

And Tomcat do not guarantee any undocumented API changes so that they could be change eventually, so this workaround maybe broken in the future. I will try to fix it if this occurs.

I hope they will change their mind to bring back this NON-FEATURE (expand all jars while unpackWARS=false)