Increase thread pool size in Spring StateMachine 3.0.1

336 Views Asked by At

We upgraded from Spring Statemachine 2.5.0 to Spring StateMachine 3.0.1 in our project. Our application run a series of processes, each process runs through its business logic within its own state machine. When we were using State Machine 2.5.0, each state machine ran under its own thread. It is very common for us to have 50-75 of these processes running at once, each under its own thread, and each with its own State Machine.

When we migrated to 3.0.1, we saw that our processes/statemachines run under threads named parallel-# ,where # is 1 to the number of CPU cores (4 in our case).

As our processes execute, each within its own statemachine, there are times where a particular state has to perform rather expensive shortest path operations in sequence. This operation is synchronous and can cause the state's Action to process for upwards of 20 seconds. We have seen situations where we may have 50 state machines trying to run, but the 4 parallel threads are so busy that the other 46 Statemachines are just stalled. When we were running 2.5, this worked out OK because each Statemachine had its own thread.

Is there are way to increase the thread pool in Spring Statemachine 3.0.1, or is there some way to schedule processing time back to the idle state machines?

Matt Brown

0

There are 0 best solutions below