Bug 53492 - Make JspC shell multithreaded
Summary: Make JspC shell multithreaded
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Jasper (show other bugs)
Version: trunk
Hardware: PC Mac OS X 10.4
: P2 enhancement with 5 votes (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2012-07-01 07:20 UTC by Dan Fabulich
Modified: 2018-09-04 20:47 UTC (History)
1 user (show)

patch (7.09 KB, application/octet-stream)
2012-07-01 07:20 UTC, Dan Fabulich
patch (7.09 KB, patch)
2012-07-01 07:21 UTC, Dan Fabulich
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Fabulich 2012-07-01 07:20:32 UTC
Created attachment 29016 [details]

Jasper works great multi-threaded. Using two threads per core substantially improves throughput on my test machine, reducing the time it takes to build from 9 minutes to 2 minutes.

The attached patch adds a new -threadCount command-line argument to JspC, as well as a setThreadCount setter, suitable for use in an Ant task. It accepts a positive integer, or a core factor like "2.0C" which means two threads per core. 2.0C is the default.

Note that on my machine it didn't help that much unless JspC was also configured to -compile the classes.

I've attached a patch.
Comment 1 Dan Fabulich 2012-07-01 07:21:16 UTC
Created attachment 29017 [details]

Bugzilla screwed up the mime type; trying again
Comment 2 Dan Fabulich 2012-07-01 07:22:55 UTC
I'd love to have this backported to Tomcat 7 as well. The patch should apply cleanly to the 7.0.x branch.
Comment 3 Mark Thomas 2018-07-02 20:41:46 UTC
Sorry it took so long.

Fixed in:
- trunk for 9.0.11 onwards
- 8.5.x for 8.5.33 onwards
- 7.0.x for 7.0.91 onwards
Comment 4 Mike Bryant 2018-09-04 19:55:16 UTC
I have found that if more than one thread is being used in 8.5.33 then the XML fragment that is created from an ant task can be corrupted. For example, there are multiple <servlet-class> elements for a <servlet> and they are empty. Sometimes there is a <servlet-class></servlet-name> element too.
Comment 5 Mark Thomas 2018-09-04 20:31:48 UTC
See bug 62662
Comment 6 Mike Bryant 2018-09-04 20:47:17 UTC
Thanks for adding that 62662 comment, Mark. My searching did not uncover it and it's nice to reference it here!