Bug 56787

Summary: Simplified jndi name parsing
Product: Tomcat 7 Reporter: Sheldon Shao <xshao>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: NEW ---    
Severity: enhancement    
Priority: P2    
Version: trunk   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: Patch
Screenshot got from JProfiler where tomcat is starting

Description Sheldon Shao 2014-07-29 09:48:09 UTC
Created attachment 31855 [details]
Patch

Tomcat uses JNDI to look up resource. The name of a resource needs to be parsed into a Name object. By default it is a CompositeName. 
Parsing a string to a CompositeName is low performance due to the following reason,

1. Call too many times of the method "String.startsWith"
2. Create StringBuffer instance for each component

The patch provides a simplified Name implementation. The parsing is around 6 times faster than the default one. The result was get on my Macbook Pro by running TestSimpleName.testAB().

The issue is impacting the start up of tomcat server. Because there are many resource looking up when server is starting.

The patch can improve the server start time.
Comment 1 Sheldon Shao 2014-07-29 09:49:53 UTC
Created attachment 31856 [details]
Screenshot got from JProfiler where tomcat is starting
Comment 2 Mark Thomas 2014-08-05 11:33:31 UTC
Marking this as an enhancement.

The profiler results appear to show that this is a fairly small part of the overall start time. I do have some concerns about the size of the patch compared to the expected benefit.

Could you provide some insight into: size of the application; start time without this patch; and start time with this patch?
Comment 3 hzhang9 2014-09-16 02:16:46 UTC
One of our application contains around 1800 jar files, and the benefit from the patch in this application is 300 ms faster on server startup.

(In reply to Mark Thomas from comment #2)
> Marking this as an enhancement.
> 
> The profiler results appear to show that this is a fairly small part of the
> overall start time. I do have some concerns about the size of the patch
> compared to the expected benefit.
> 
> Could you provide some insight into: size of the application; start time
> without this patch; and start time with this patch?