Bug 56787 - Simplified jndi name parsing
Summary: Simplified jndi name parsing
Status: NEW
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Catalina (show other bugs)
Version: trunk
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-29 09:48 UTC by Sheldon Shao
Modified: 2014-09-16 02:16 UTC (History)
0 users



Attachments
Patch (47.58 KB, patch)
2014-07-29 09:48 UTC, Sheldon Shao
Details | Diff
Screenshot got from JProfiler where tomcat is starting (442.75 KB, image/png)
2014-07-29 09:49 UTC, Sheldon Shao
Details

Note You need to log in before you can comment on or make changes to this bug.
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?