Search code examples
mulemulesoftmule-componentmule-esb

How to find max thread active for scatter-gather in mule


I am using mule version 3.9. My application uses HTTP listener component as an message source and uses scatter gather to collect data from database.
During performance testing, "Threadpoolexecutor did not accept within 30000 MILLISECONDS (java.util.concurrent.RejectedExecutionException)" is thrown. I think this is due to non-availability of enough threads for scatter gather component.

As per mule doc, maxThreadsActive for Scatter-Gather is the number of routes in a Scatter-Gather * maxThreadsActive for flow. Now, how to find maxThreadsActive for flow? No processing strategy is defined for flow. pls help.


Solution

  • Read the default threading profile documentation:

    maxThreadsActive The maximum number of threads to use.

    Type: integer
    Required: no
    Default: 16
    

    Having said that I recommend that instead of increasing the number of threads it is better to analyze a thread dump to understand what are the existing threads doing when they are all busy. Probably you have some operation that is taking more time than expected (the database query?). Increasing the number of threads should be evaluated with performance test to understand the improvement and cost. Threads are not free, they use memory and CPU.