7.4.3 Workflow Design
Workflow design impacts duration and use of resources. The following are design guidelines for workflow design:
Effective scripting
– Use s
cripting development design guidelines
to avoid unnecessary highly resource-demanding operations such as active wait loops, repetitive expensive calls to the same resources, and ineffective algorithms. Perform extensive testing on a vCO test server before
running new or updated workflows on a production system.
Workflow threading control
– Having many
distinct running workflows increases the amount of
resources are used. Workflows started individually and workflows started using the Asynchronous workflow or Nested workflow palette elements run
in different workflow instances. A sub-workflow in a master workflow is still running within the same workflow instance, but
uses fewer resources. Link workflows in higher-level workflows instead of calling individual workflows in sequence.
Reduce
the number of workflows waiting – If the reason
for the high concurrency is due to a high number of workflows waiting on external systems,
there are methods to avoid consuming resources while waiting:The
Wait Until date workflow palette element and the System.Sleep() methods keep the workflow in a running state in the execution queue. Even if the thread is in Sleep mode,
it still consumes memory. For long running workflows,
these can be replaced by the Waiting timer or Waiting Event palette elements. Using one of these elements passivates the workflow execution and saves
its state in the vCO database. The workflow is then removed from the running queue and memory is freed. The vCloud Director library’s
long running workflows make extensive use of Waiting Event.
When workflow activity needs
to be suspended until a determined time,
programmatically schedule
a workflow task.Although saving active resources, each passivation and activation consumes CPU resources and database access. The following are design guidelines for using the Waiting Timer or Waiting Event are:
Do not trigger a large number of these at the same time.
Do not set very short timers in loops.