[concurrency-interest] How to dynamically adapt the pool size of a ForkJoinPool

Doug Lea dl at cs.oswego.edu
Mon Jun 4 09:36:27 EDT 2012

On 06/04/12 09:13, Alexander.Berger at finnova.ch wrote:

> How can I instruct a ForkJoinPool instance to release its extra worker threads
> (those that exceed parallelism)?

Assuming you are hacking on FJ source code...
Workers can only be removed after running idleness consensus.
They then wait SHRINK_RATE ns after last idleness or removal.
SHRINK_RATE is set to a relatively high value (about 4sec)
in part to avoid some (uncommon) hysteresis effects.
You could try lowering it.

Also note that unless there are a huge number of them
(so cause a resource problem), these extra workers are
probably not doing you enough harm in terms of throughput
to warrant intervention.


More information about the Concurrency-interest mailing list