2. T h r e a d M a n a g e m e n t i n M u l e .
SEDA
Thread pools
Tuning Threading Profile
Processing Strategy
Async scope
SEDA(staged event-driven architecture)
decomposes a complex, event-
driven application into a set of
stages connected by queues
3. T h r e a d M a n a g e m e n t i n M u l e .
Configured exchange pattern
Outbound message processor
Transaction
Processing strategy
Factors that determine Thread Pool
If you are using synchronous processing, the same thread is used to carry the
message all the way through Mule. As the message is processed, if it needs to be sent to
an outbound endpoint, one of the following applies:
If the outbound endpoint is one-way, the message is sent using the same thread.
Once it has been sent, the thread resumes processing the same message. It does
not wait for the message to be received by the remote endpoint.
If the outbound endpoint is request-response, the flow thread sends the message
to the outbound endpoint and waits for the response. When the response arrives,
the flow threads resumes by processing the response.
4. If you are doing asynchronous processing, the receiver thread is used
only to place the message on a staged event-driven architectur (SEDA)
queue, at which point the message is transferred to a flow thread, and the
receiver thread is released back into the receiver thread pool so it can carry
another message. As the message is processed, if it needs to be sent to an
outbound endpoint, one of the following applies:
If the outbound endpoint is one-way, the message is copied and the
copy processed by a dispatcher thread, while the flow thread continues
processing the original message in parallel.
If the outbound endpoint is request-response, the flow thread sends
the message to the outbound endpoint and waits for the response.
When the response arrives, the flow threads resumes by processing the
response.
5. SCENARIO -1 SEDA ARCHITECTURE
Inbound connector is one-way
Outbound connector is one-way
No transactional flow
SCENARIO-2 SYNCHRONOUS-
ASYNCHRONOUS MODE
Receiver Thread is exchange-pattern
Dispacher Thread is one-way
7. Mule’s VM transport is an excellent mechanism to help break your flows
into smaller, composite flows that are decoupled with in-memory
queueing. This allows you to realize the benefits of SEDA at the
macro level, breaking your application into smaller flows that can be
individually tuned and are decoupled with VM queueing.
Tuning Threading Profile
Configuration level
Connector level
Flow level
Default Threading Profile
<configuration>
<default-threading-profile
maxBufferSize="100" maxThreadsActive="20"
maxThreadsIdle="10" threadTTL="60000"
poolExhaustedAction="ABORT" />
</configuration>
default queued asynchronous
Synchronous-thread-per-processor-processing-strategy
queued-thread-per-processor-processing-strategy
thread-per-processor-processing-strategy (with cores)
Processing Strategy
How to implement own SEDA