What is a BPEL dehydration process ?
BPEL dehydration process is the action from the BPEL engine to compress and store the BPEL instances into the database. The incoming messages are stored in the database for processing later by worker threads.
- Storing the current status of the BPEL process(i.e. long running process, asynchronous process) into the database tables is known as dehydration
- SOA_INFRA schema is the dehydration store which contains tables to hold the meta data of the process.
- Long running process or processes waiting for response consumes memory and CPU
- While waiting for the response the bpel engine can store the process, thus freeing up server resources.
- To increase both Reliability and Scalability of the BPEL process.
- You can also use it to support clustering and failover.
- Over the life cycle of the BPEL instance, the instance with the current state of execution may be saved in database.
Note: BPEL Activity is dehydrated immediately after execution and recorded in the dehydration store. It provides better failover protection, but may impact performance if the BPEL process accesses the dehydration store frequently.
Synchronous Process
- Process gets dehydrated only at the end of the process.
- Using Dehydrate activity we can explicitly dehydrate process state if required.
Asynchronous Process
- Automatically dehydrated the process based on the activities used.
The dehydration points occurs:
-
When the activities are used : (not just after, depends on BPEL Engine)
- a mid-receive activities(without create instance). Please not that the first receive activity will not automatically dehydrate the BPEL process. This depends on the pattern used and on the specific BPEL properties optimization.
- Pick (onMessage & onAlarm) activity
- just before wait activity (depends on the duration)
- Dehydrate(11g) / Checkpoint(10g)
- Commit(Java embedded)
- a (implicit) transaction is committed
That is where an existing BPEL instance must wait for an event, which can be either a timer expiration or message arrival. When the event occurs (the alarm expires or the message arrives), the instance is loaded from the dehydration store and execution is resumed. This type of dehydration occurs only in durable processes, which have mid-process breakpoint activities. A transient process does not have any mid process breakpoint activities.
-
When calling a non-idempotent idempotent=false service or Partner Link
When Oracle BPEL Server recovers after a crash, it retries the activities in the process instance. However, it should only retry the idempotent activities. Therefore, when Oracle BPEL Server encounters a non-idempotent activity, it dehydrates it. This enables Oracle BPEL Server to memorize that this activity was performed once and is not performed again when Oracle BPEL Server recovers from a crash.
Idempotent activities are those activities where the result is the same irrespective of no. of times you execute the process.
Repeated invocations have the same effect as one invocation.
E.g. Read only services, Receive activity -
When RequiresNew BPEL transaction is completed or When the BPEL instance finishes
At the end of the BPEL process, Oracle BPEL Server saves the process instance to the dehydration store, unless you explicitly configure it not to do so. This happens to both durable and transient processes.
Note: A BPEL invoke activity is by default (true) an idempotent activity, meaning that the BPEL process does not dehydrate instances immediately after invoke activities. Therefore, if idempotent is set to true and Oracle BPEL Server fails right after an invoke activity executes, Oracle BPEL Server performs the invoke again after restarting. This is because no record exists that the invoke activity has executed. This property is applicable to both durable and transient processes. If idempotent is set to false, the invoke activity is dehydrated immediately after execution and recorded in the dehydration store. If Oracle BPEL Server then fails and is restarted, the invoke activity is not repeated, because Oracle BPEL Process Manager sees that the invoke already executed.
Types of BPEL Process
When and how dehydration occurs differ based on process types. Based on the dehydration we can categorize process in to 2 categories
- Transient Process: Oracle BPEL server dehydrates the process instance only at the end of the process. If server crashes in middle of the running process instance, the instances will not be visible in EM
- Durable Process: Oracle BPEL Server dehydrates the process instance in-flight at all midprocess breakpoint and non-idempotent activities, plus the end of the process. When the server crashes, this process instance appears in Oracle BPEL Control up to the last dehydration point (breakpoint activity) once the server restarts. If the server crashes before the process instance reaches the first midprocess breakpoint activity, the instance is not visible in Oracle BPEL Control after the server restarts.
Important Notes:
- Remember that theses dehydration statement must be avoided in synchronous BPEL process.
- Idempotence is a mathematical term that basically means that calling a function multiple times doesn’t change the result for example f(f(x))=f(x).
- What does it mean for messaging service system ? If a service receives the same message again, it should be able to handle it without changing the state of the system. For example; in a bank scenario you wouldn’t want that withdraw message to be processed more than once !
- An idempotent activity in BPEL (for example, an assign activity or an invoke activity) is an activity that can be retried
- To ensure data consistency, the dehydration database is done using the same transaction context in which the BPEL process is executed. However, BPEL engine use a separate transaction context for the audit logging information, which aids (a lot) for debugging failed instance.
- Skipping dehydration will increase performance with a cost of auditing.
- By Default, all BPEL processes are dehydrated regardless of whether they are Synchronous or Asynchronous process.
-
For Synchronous processes that do not need to be durable, you can turn off the dehydration mechanism by setting the following properties at process or engine level:
- Set inMemoryOptimization to true.
- Set completionPersistPolicy property to faulted or Off.
- Asynchronous process invocation messages are always saved to the dehydration store.
- Durable process are always dehydrated regardless of the settings of the persistence properties.
Dehydration Tables
- Cube_Instance: Stores the information about the composite instance that gets created.
- Cube_scope: Stores information about the scopes and variables declared and used.
- DLV_Message: All the incoming payload details are stored.
- Invoke_Message: All the outgoing message payload details are stored.
- Audit_Trail: Used to store information of the xml that is rendered in EM console.
Performance Recommendations:
Engine dispatch messages are generated whenever an activity must be processed asynchronously by the BPEL engine. If the majority of processed deployed on the BPEL server are durable with a large number of dehydration points (mid-process receive, onMessage, onAlarm, wait), greater performance may be achieved by increasing the number of engine threads.
Nice post ,keep update at
ReplyDeleteOracle SOA Online Training Bangalore
ReplyDeleteThanks for sharing this great information I am impressed by the information that you have on this blog. Same as your blog i found another one Oracle ADF . Actually I was looking for the same information on internet for Oracle ADF and came across your blog. I am impressed by the information that you have on this blog. It shows how well you understand this subject, you can learn more aboutOracle ADF . By attending Oracle ADF Training .
ReplyDeleteThanks for sharing this great information I am impressed by the information that you have on this blog. Same as your blog i found another one Oracle SOA Training
. Actually, I was looking for the same information on internet for Oracle SOA Interview Questions and Answers
and came across your blog. I am impressed by the information that you have on this blog. It shows how well you understand this subject, you can learn more about Oracle SOA Tutorial also.
Thanks for sharing this great information I am impressed by the information that you have on this blog. Same as your blog i found another one Oracle SOA Training
ReplyDelete. Actually, I was looking for the same information on internet for Oracle SOA Interview Questions and Answers
and came across your blog. I am impressed by the information that you have on this blog. It shows how well you understand this subject, you can learn more about Oracle SOA Tutorial also.
Your blog was very relevant. It covered all the areas of interest of the same topic and also provided all the necessary information that i could use further in my study. Here is a referred link same as yours oracle fusion soa training. Thanks for this helpful blog as my knowledge is truly enhanced.
ReplyDelete