concept thread pool in category mule

appears as: thread pool, thread pools, thread pools, thread pool
Mule in Action, Second Edition

This is an excerpt from Manning's book Mule in Action, Second Edition.

Mule allows you to optionally pool your service component objects by configuring what’s called a pooling profile. Pooling ensures that each component instance will handle only one request at a time. It’s important to understand that this pooling profile, if used, influences the number of requests that can be served simultaneously by the service. The number of concurrent requests in a service is constrained by the smallest of these two pools: the component pool and the thread pool (refer to chapter 11 for more on this subject).

Table 11.5. Configuring a processing strategy

Name

Description

maxBufferSize The maximum number of messages to queue when the thread pool is at capacity
maxThreads The maximum number of threads that can be used
minThreads The minimum number of threads to keep ready when the flow is idle
poolExhaustedAction What to do when the thread pool runs out
threadTTL How long to keep an inactive thread in the pool prior to evicting it
threadWaitTimeout How long to wait for a thread when the poolExhaustedAction is WAIT

If you “zoom” in on a thread pool, you discover that there’s a buffer alongside the threads themselves, as represented in figure 11.4. Each thread pool is associated with a buffer that can queue pending requests in case no thread is available for processing the message right away. It’s only when this buffer is full that the thread pool itself is considered exhausted. When this happens, Mule will react differently depending on your configuration; it can, for example, reject the latest or oldest request. You’ll see more options in section 11.2.3.