Flow priority
Summarize
Summary of Flow Priority
Flow priority in ServiceNow allows you to specify the execution order of background flows relative to one another. By assigning priority levels—High, Medium, or Low—you can ensure that higher priority flows are executed before lower priority ones. By default, flows run with Medium priority, and background flows utilize available worker threads, queuing if none are available.
Show less
Key Features
- Priority Levels: Flows can be set to High, Medium, or Low priority.
- Worker Thread Management: Background flows utilize up to half of available worker threads, queuing when none are free.
- Delegation of Flows: If a flow remains queued beyond five minutes, it is delegated to another node but loses its priority.
- Automatic Pausing: Low-priority flows running longer than two minutes may be paused if high-priority flows are blocked.
- API Support: Flows initiated via the quick API method run at Medium priority, ignoring previous settings.
Key Outcomes
Setting flow priority effectively helps manage system resources and ensures critical business processes are addressed promptly. It is important to mix priority settings wisely to maintain efficiency and avoid blocking higher priority flows with lower ones. Use high priority for essential, infrequent flows, and low priority for high-volume, non-time-sensitive processes. Adjusting these priorities can lead to more efficient workflow management within your ServiceNow environment.
Specify the priority that you want a background flow to have in relation to other flows waiting to be run. Run a group of higher priority flows before running any lower priority flows.
You can only set a flow priority for flows that run in the background. Background flows run from the next available worker thread. By default, Flow Designer can use up to half of the available worker threads to run background flows. If there’s no available worker thread to run a flow, the flow is queued until there’s an available worker thread to run it.
- High
- Medium
- Low
Setting a flow priority determines the order that worker threads pick flows from the queue. Worker threads run several higher priority flows before running a lower priority flow. This priority scheme ensures that some lower priority flows get run even when there are higher priority flows in the queue. When there’s a large work queue to run, most low-priority flows must wait until the high priority flows are run. After the high priority flows have run, the worker threads can run lower priority flows.
Flows also lose their priority value when they pause for any reason. Flows that resume from a pause run at the default Medium priority. For example, a flow could start running at high priority, then pauses to Wait for a Duration. When the flow resumes running, it runs at a Medium priority.
Automatic pausing of low-priority flows
By default, the system checks for cases where high-priority flows are being blocked by running lower priority flows. Whenever a low-priority runs for longer than two minutes, the system checks whether any higher priority flows have run in the last five minutes. If no high-priority flows have run recently, then the system checks the number of flows waiting to run in the event queue. If there’s a backlog of at least 100 high-priority flows waiting to run in the event queue, the system pauses the running low-priority flow. Pausing a flow preserves its context and data. A paused flow returns to the event queue to run when there’s a worker available to process it.
If your low-priority flows aren’t running as expected, review the number of high-priority flows that your system generates and runs. See the design considerations for when to set a flow to high or low priority. If your low-priority flows are still not running, you can disable the pausing of low-priority with a system property. See Flow Designer system properties to change the value of the com.glide.hub.pause_low_priority_flows_enabled property.
Quick API support
The quick API method does not support flow priority values. Flows run by the quick API method ignore any previously defined flow priority settings and instead run at Medium priority.
Design considerations
Follow these design considerations when setting flow priority.
- Avoid setting all flows to run at high priority
- Use a mix of priorities rather than set all flows to high priority. Worker threads use the relative priority between flows to select work. If all of your flows run at high priority, then there are no lower-priority flows to make wait.
- Avoid setting flow priority for flows that have to pause
- Keep flows that have to pause at the default medium priority since a flow that pauses loses its priority value when it resumes running.
- Use high priority for business critical flows
- Limit high-priority to flows that have high business value, run rarely, and have a short runtime. Avoid setting high-volume flows to high priority as doing so limits the number of worker threads available to run other flows. A long-running high priority flow can also reduce the worker threads available to run other flows.
- Use low priority for high-volume flows
- Run high-volume flows at low priority so that other time-sensitive flows can run first. Low-priority flows shouldn't be time-sensitive.
- Use medium priority for time-sensitive flows
- Use the default flow priority when a flow has some time urgency when compared to other flows.