Web application deployment and redeployment is very slow when compared with Tomcat, especially on Windows.
It's to the point where several of my team members are actively looking to avoid Java EE technologies, specifically so they can develop entirely within Tomcat.
With profiling and Java VisualVM I was able to isolate the problem to WebappClassLoader, which appears to unpack all the JARs in WEB-INF/lib.
And within that operation, the call to getCanonicalPath for each JAR entry for validation appears to be the bulk of the problem.
It is especially acute on Windows, leading to the paradox that running Glassfish in a Linux VM is faster than running natively on Windows on the same hardware
Is there any way to optimize this?
- avoid pre-emptively unpacking all the JARs
- come up with a simpler validation check for JAR entries that doesn't rely on getCanonicalPath (e.g., ensure string only could be translated to a legal Java fully-qualified identifier)