Bug 64157

Summary: Tomcat 7 performance: enable tomcat to pre-start pool of min spare threads optionally
Product: Tomcat 7 Reporter: Torres Yang <torres.yang>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: P2    
Version: trunk   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: Improved Tomcat 7 performance by allowing start min spare threads optionally

Description Torres Yang 2020-02-18 18:42:10 UTC
Hi Tomcat,

During our performance testing, we found out that tomcat 7 made a mistake on preStartMinSpareThread.

In Tomcat 6, tomcat doesn't pre-start and maintain a pool of min spare threads, instead thread pool increased as requests come in.

In Tomcat 7. tomcat made a mistake and pre-start and maintain a pool of min spare threads, which impacts the performance.

In details:

- In 2010, Tomcat added this commit to OPTIONALLY prestart the core numbers of workers https://github.com/apache/tomcat/commit/26fe8127fd51b9b09a8abefa43d63f1f02960e50#diff-aee166200d5b05354b92c2ba73a758f9 And defect track in Bugzila: https://bz.apache.org/bugzilla/show_bug.cgi?id=43642

- In 2017, Tomcat added this commit to ALWAYS prestart, ignoring the previous commit, probably by mistake https://github.com/apache/tomcat/commit/b0e35f94f5dbb24079d29afe0958a4ee02319927#diff-baa9c50854087e10ddd02bd58f546f2a 


This change contribute to tomcat performance degradation, and it would improved tomcat 7 if we are able to optionally start the min spare threads.


Here we attached a patch to solve this problem.
Comment 1 Torres Yang 2020-02-18 18:43:54 UTC
Created attachment 37024 [details]
Improved Tomcat 7 performance by allowing start min spare threads optionally
Comment 2 Remy Maucherat 2020-02-25 09:44:58 UTC
I don't understand why maintaining the set of min spare threads is bad or how it affects performance. Please provide metrics.
Comment 3 Mark Thomas 2020-04-27 16:08:18 UTC
Two months have passed with no further information being provided. Absent a text case that demonstrates the issue, I am resolving this as WORKSFORME. If the issue persists, feel free to re-open this provided the request test case is supplied.