What is singleton? Singleton is a common software pattern that is used to ensure only a single instance of an object exists no matter how many times it is instantiated. FlowWright applies this concept to workflow processes to solve certain problems in regards to runtime data collection. A FlowWright step collects a great deal of data each time it executes, and it stores this runtime data within an execution iteration. If a step re-iterates many times, data created and stored can grow enormously resulting in unacceptable memory and processing use .
An example scenario is depicted below. This is a type of looping workflow called an "artificial loop" wherein a decision is made, then a task is routed and if the task is rejected, then the workflow goes back to the decision set and then forward again to the task step:
If the task is repeatedly rejected, then this workflow loops endlessly. In this case, each time the decision or task step executes, instances of each repeated step are added to the runtime information associated with the workflow. This simple example illustrates how data and processor demands can escalate even with a single simple workflow instance. Larger and more complex workflows with recursion can impact resources to a much greater degree.
These sorts of use cases are candidates for introducing singleton workflows. A singleton workflow automatically trims off and only keeps the last execution iteration for each of the steps within the workflow process. How is this done within FlowWright? Very easily! Go-to the “Start” step within the workflow designer and look at the properties for the step, as shown below:
One of the last options you will see is “Use single execution iteration” with options to turn On/Off. By default, it's turned off. Turn the option "on" and let FlowWright engines do the rest of the work in implementing Singleton.
We have customers who have automated IT processes, where the workflow process will wake up every hour and run a batch of SQL processes, then go to sleep until the next hour. You can imagine with such a process running 24 times a day and 365 days per year there are 8,760 iterations per step. By using the “Singleton” workflow approach, all executed iterations are trimmed off and only the last execution iteration is kept. So, the workflow process is kept lean and process at high performance without needing excessive resources.
Have questions on how to implement Singleton workflows into your processes? Let's talk.