Sunday, September 29, 2013

What is the use of Critical Section Groups in BW ? what is the need of Synchronization for Shared Variables? Scope of Synchronization in CS Groups? How to use CS groups with no performance implications?

Critical section groups are used to synchronize process instances so that only one process instance executes the grouped activities at any given time as shown in below screenshot-1.

In general, concurrently running process instances does not wait for the completion of other instance as shown in below screenshot-2.

Any concurrently running process instances that contain a corresponding critical section group wait until the process instance that is currently executing the critical section group completes as shown below.

 Screenshot-1

How Synchronization works with Critical section groups:
Multiple process instances can potentially access and assign values to Shared Variable resources, the Lock shared configuration object(by referencing shared configuration in configuration tab of the group) and critical section group allow you to synchronize access to Shared Variable resources.

Scope of Synchronization:
Critical section groups can be used to synchronize all process instances for a particular process definition in a single process engine or multiple process definitions or across multiple process engines by selecting the scope as Single Group or Multiple Groups in configuration pane.

What is the need of Synchronization:
Without a mechanism for locking, a process instance could update the value of a variable while another process instance is attempting to read the value. This would result in an unpredictable value for the variable.

You should use critical section groups to contain the Set Shared Variable and Get Shared Variable activities.This ensures that only one process instance attempts to assign a value to the variable and ensures that no process assigns a value to the variable when the current process attempts to read the value.

Best practices to use Critical Section Groups: 
There may be performance implications when using these groups. In general, you should use the following guidelines when creating critical section groups:
  • Keep the duration of a Critical Section group as short as possible. That is, put only a very few activities in a Critical Section group, and only use activities that execute very quickly.
  • Do not include any activities that wait for incoming events or have long duration, such as Request/Reply activities, Wait For activities, Sleep activities, or activities that require a long time to execute.
  • Avoid nesting Critical Section groups. If you must use nesting, ensure that Lock shared configuration resources are used in the same order in all process definitions.Deadlocks can occur if you do not specify the Lock resources in the same order in nested Critical Section groups for all process definitions.
                                                       Screenshot-2

Popular Posts

  © Blogger templates The Professional Template by Ourblogtemplates.com 2008

Back to TOP