Multi-Threading Flow Design
  • 03 Mar 2022
  • 2 Minutes to read
  • Dark
    Light

Multi-Threading Flow Design

  • Dark
    Light

Article summary

Overview

Multi-Threading in Decisions refers to instances where the system executes multiple different Threads simultaneously to process batches of items within a Flow. Typically, asynchronous processes are created to run multiple independent processes, however, not all asynchronous processes run on different threads. Some run multiple synchronous processes in parallel.


Example

Configuring a Flow with the Run Flows For List [Batch Processing] Step

The Run Flows For List step utilizes a built-in Flow to process a list of items using backend parallel processing. 

  1. In a Designer Project, click CREATE FLOW and select Flow to create a new Flow. 
  2. Attach a Create Data step from the FAVORITE STEPS category of the Toolbox panel. Click SHOW EDITOR.
  3. In the Data Definitions window, enter "AccountList" under NAME, select Account as the TYPE, and check IS LIST. Click Save and close the window.
  4. Attach a Run Flows For List [Batch Processing] step from the Toolbox by navigating to SYSTEM > ADVANCED to the Done path.
     
  5. On the Properties panel, set the Input Type and Output Type fields to Account.
     
  6. Under the INPUTS category, map the desired AccountList to InputList. If desired, Constant map the Remove Null Results option.
  7. Under the FLOW category, change Run Behavior to ASyncAndWait and declare a Queue Name.  
  8. Under Thread Count, define the desired number of Threads for the step to utilize in parallel. Then, click the EDIT [THREAD FLOW NAME] button. 
    Note on Thread Count
    Note that since each individual Thread on the Run Flows For List step is a separate Flow process, running too high of a number may impact System performance. It is advised to use a lower Thread Count number such as "4" to test the impact of the step on the System. 

  9. From the newly opened Flow Designer, define the desired process logic; map the resulting value to INPUTS > Output Data on the End step. This example will use the Fetch Entities step to obtain Account items.

    About Process Logic 
    As the description underneath the Action Bar suggests, the Thread processing Flow takes in the Input defined on the Run Flows For List step and processes through them to return a value for each item.

  10. Save and close the Flow to return to the main Flow. Configure the rest of the Flow as desired. 


Configuring a Flow with the [Start Linked Flow Async] Step

The Start Linked Flow Async step is one of the most commonly utilized steps to achieve asynchronous behavior. By using this step, users may achieve Multi-Threaded processing through the use of Job Queues on the step. 

  1. From the Flow Designer, add a [Start Linked Flow Async] step from the FLOWS category of the Toolbox tab.
  2. On the Properties panel under WORK QUEUE, check the Manage Execution Threads box.
  3. Define a new ThreadJobName.
     



For further information on Flows, visit the Decisions Forum.

Was this article helpful?