tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <>
Subject Re: Suggested doc change for Connectors
Date Wed, 18 Jan 2017 12:00:20 GMT
On 18/01/2017 11:34, André Warnier (tomcat) wrote:
> Hi.
> This is a partial recap of the theme discussed on the list, in this
> thread :
> I would sugest a documentation change, basically in all pages related to
> Connector's configurations, from 9.0, and I believe all the way back to
> 6.0.
> The change relates to the "minSpareThreads" attribute of the Connectors,
> such as
> and the suggestion is based on :
> Basically, each of the Connector pages repeats the same text about this
> attribute :
> quote
> minSpareThreads   
> The minimum number of threads always kept running. If not specified, the
> default of 10 is used. If an executor is associated with this connector,
> this attribute is ignored as the connector will execute tasks using the
> executor rather than an internal thread pool. Note that if an executor
> is configured any value set for this attribute will be recorded
> correctly but it will be reported (e.g. via JMX) as -1 to make clear
> that it is not used.
> unquote
> So,
> - if there is an Executor, then this Connector attribute is ignored
> - but according to the above migration guide, if there is no Executor,
> it is also ignored.
> So basically, why have it ?

Creating a thread is a relatively time consuming task.

It ensures that, up to the maximum allowed threads, there are always
minSpareThreads available to handle a spike in incoming requests.

- Start with 10 idle threads
- 3 new connections arrive
- they each get handled by one of the threads
- Tomcat starts another 3 threads in the background to bring the spare
  pool back up to 10
- the 3 connections complete
- the spare pool is now 13

If you want the spare pool to be reduced back down to 10 (or some other
setting) when threads are idle then you need to use an appropriately
configured Executor.

The best settings will depend on the load profile. Keeping a thread idle
in the background uses relatively little resources. The more 'spikey'
your load is, the less benefit you'll get from stopping idle threads. At
some point, the load caused by creating and stopping threads will cause
more problems than just leaving the threads idle.

Maybe change the first sentence to:

The number of idle threads Tomcat keeps available to handle new
requests. Note that excess idle threads are not stopped. The total
number of threads will therefore increase over time with an upper limit
of maxThreads. If you require excess idle threads to be stopped, use an


> Of course, I don't know if there is some deeper code reason to keep
> mentioning it in the Connectors' documentations.  Which is why this is a
> suggestion.
> Maybe instead, it could be made clearer that if there is no Executor,
> the number of threads associated to a Connector may keep on growing over
> time, up to the maxThreads value, and never go down again.
> (And the nefarious/beneficial/neutral effects thereof ?)
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message