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

          Priority: P2
            Bug ID: 54065
          Assignee: dev@tomcat.apache.org
           Summary: getResource with WARDirContext is very expensive
          Severity: normal
    Classification: Unclassified
          Reporter: strub...@yahoo.de
          Hardware: PC
            Status: NEW
           Version: 7.0.32
         Component: Catalina
           Product: Tomcat 7

I stumbled across this issue due to the fact that my application looses 15%
overall performance when I switch from web-application version="2.5" to "3.0" -
no other code change, just the 1 line in web.xml!

My scenario is a tomcat server with 16 webapps using a 
shared.loader=${catalina.base}/applib/*.jar
for all my common jars.


When version=3.0" is specified in my web.xml, Catalina tries to look for
web-fragment.xml and also invokes processResourceJARs(resourceJars) with all
JARs. This subsequently seems to lead to getting a WARDirContext#doListBindings
additionally to the FileDirContext#doListBindings. With version="2.5" I don't
get any WARDirContext.

The problem seems to be that this looks for resources in JNDI, even that I
don't have any defined. And WARDirContxt#getEscapedJndiName seems to be pretty
expensive.

    private Name getEscapedJndiName(String name) throws InvalidNameException {
        return new CompositeName(name.replace("'", "\\'").replace("\"", ""));
    }

not sure if the CompositeName ct is so expensive, but we should at least try to
avoid the double String replacement. This method gets invoked 553 times on my
simple page for just a single page impression.

Not sure if there is a way to cache valid JNDI entries maybe? I have not yet
thought about that stuff, I just see that a regular
ApplicationContext#getResourcePaths() is now way more expensive than it used to
be.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to