Some time ago, I came across this quote: “Mistakes are the portals of discovery.” Today, I truly understood it.
We faced a situation of sync-over-async pattern for BPEL—and, in the process, learned one “don’t”s of application design.
In our flow, we have HTTPExport wired to LongRunningProcess. This resulted in sync-over-async switch.
A sync-over-async switch occurs when a component synchronously invokes another component with an asynchronous implementation, since the target component has an asynchronous implementation.
But the invocation style—synchronous runtime—will intercept this call and switch it to an asynchronous one. The switch can cause a lot of unexpected results, like thread pool depletion when processing high volumes.
Disadvantages of Sync-Over-Async Switch:
• Thread pool depletion
• Introduction of a new transaction boundary
• Asynchronous invocation means that a call can lead to duplicate messages
• Introduces message expiration
How to Avoid an Sync-Over-Async Pattern:
We should consider the situation below at the time of design.
There are certain components that will always perform a synchronous invocation given certain conditions. You should avoid pairing such components with components that have an asynchronous implementation.
A combination of components will invariably lead to a sync-over-async switch.
Scenario 1: A HTTP export will always perform synchronous invocation, so if we have a HTTP export invoke a long running BPEL, we end up with sync-over-async switch.
Scenario 2: Microflow invoking a MQ import for a request response operation. For a request response operation, microflow will always perform a synchronous invocation. And as a MQ import has an asynchronous implementation, you will end up with a sync-over-async switch.
Rule of thumb: Always avoid the following scenario:
Microflow-> long running BPEL (request response operation)
Microflow-> message binding imports like MQ import (request response operation)
WS export/HTTP-> long running BPEL
WS export/HTTP-> message binding imports like MQ import
Thanks for stopping by and taking the time to go through the post. Good day!
Manju Rahangdale has 6 years of experience in development, architecture, design, solutioning, and sustenance covering all aspects of SDLC. She is experienced in the analysis, configuration, and implementation of complex integrations like BPEL, ESB, and WebService using IBM Integration Designer.
Suvajit Mukhopadhyay has nearly 10 years of experience in BPM. He has shown varied expertise in the areas of pre-sales, architecture, design, development, and sustenance, with various Fortune 500 customers. He has proven experience with Smarter Process implementations in banking and financial services.