Disable TLD scanning at appengine initialization

2019-03-10 05:36发布

问题:

This thread is similar to: Disable taglib scanning in google app engine (Jetty)

The author of that thread accepted a wrong answer.

We were trying to reduce the appengine startup time of my instances I've come accross the taglib TLD classpath scanning.

My application has 50mb of jars. The scanning of the tld takes 20% of the startup time:

(Image from Yourkit capture of the startup time). You can also set logger.properties level to ALL and you will see the classpath scanning issue going on.

Is there a way to disable that on appengine? God forbid us to have anything to do with taglibs, JSP, or anything like that! We have a very slick velocity + spring-mvc container.

Again, the issue is very clear: appengine doesn't respect "org.mortbay.jetty.webapp.NoTLDJarPattern" configuration in web.xml

This thing is killing our service! Our boot time is going over 60 seconds and we need to do anything to reduce that.

回答1:

Posting my comment from above as answer:

Rename your JARs to match the NoTLDJarPattern used by AppEngine's webdefault.xml.

It's not pretty, but naming all your JARs e.g. jetty-(...).jar should prevent them from being scanned for TLDs.

Alternatively, repackage all JARs into one big JAR and just give that a name covered by AppEngine's NoTLDJarPattern.