Skip to main content

Distribute workflow execution with round-robin logic using data tables

Workflow preview

Workflow preview
100%
Distribute workflow execution with round-robin logic using data tables preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Key Features Implements a simple round robin distribution mechanism using a Data Table to track the last route used. Supports multiple downstream workflows or resources, balancing workload across t...

Best for

  • DevOps automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

n8n-nodes-base.manualtrigger, n8n-nodes-base.code, n8n-nodes-base.noop, n8n-nodes-base.switch, n8n-nodes-base.stickynote, n8n-nodes-base.datatable, n8n-nodes-base.merge

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Adrian Kendall.

Original n8n.io source

1.1 Workflow description

Title
Distribute workflow execution with round-robin logic using data tables
Workflow name
Distribute workflow execution with round-robin logic using data tables

Key Features

Implements a simple round-robin distribution mechanism using a Data Table to track the last route used.

Supports multiple downstream workflows or resources, balancing workload across them sequentially.

Uses Switch and Code nodes for flexible routing logic.

Designed for easy customization — replace placeholder “Route” nodes with sub-workflow calls or API triggers.

Works with any trigger type, and includes merge logic to preserve input data.

Nodes in Use

Node Name Type Purpose
When clicking ‘Execute workflow’ Manual Trigger Test entry point for manual execution.
Calculate the next route to use Data Table Retrieves the last used route number.
Code in JavaScript Code Increments the route counter (0–3 cycle).
Update last_used in the datatable Data Table Updates the “Last_Used” field to track next route.
Round Robin Router Switch Routes workflow execution to the correct path based on Last_Used value.
Route 1 / Route 2 / Route 3 NoOp Placeholder routes — replace with your own workflows.
Merge trigger data to pass to subworkflow if needed Merge Combines trigger data with routing data for sub-workflows.
Sticky Notes Annotations Explain workflow logic and intended replacements.

How It Works

The workflow starts when triggered manually (or by another workflow).

The Data Table node fetches the current value of Last_Used, which identifies which route was last used.

The Code node increments that value, resetting to 0 after 3, creating a round-robin cycle.

The Data Table update node stores the new Last_Used value.

The Switch node reads Last_Used and routes execution to the correct downstream branch.

Each route can represent a duplicated workflow, resource, or API endpoint.

Optionally, the Merge node reattaches trigger data before sending it to sub-workflows.

Step-by-Step

Trigger the workflow manually or via webhook/cron/etc.

Retrieve current route index using the Data Table node.

Increment route counter with the JavaScript Code node:

If Last_Used = 3, it resets to 0.

Otherwise, increments by 1.

Update Data Table with the new Last_Used value.

Route execution using the Switch node based on that value.

Send data to corresponding subworkflow (Route 1, Route 2, Route 3).

Replace the NoOp nodes with your target workflow or HTTP call nodes for real routing.

Use Cases

Distribute load across multiple API endpoints to prevent throttling.

Run identical sub-workflows on different worker instances for parallel processing.

Simulate load balancing during testing of N8N workflows.

Sequentially alternate between external systems or servers handling similar tasks.

Act as a proof-of-concept for balancing strategies before scaling up.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - When clicking ‘Execute workflow’

Type / Role
n8n-nodes-base.manualTrigger - manualTrigger
Config choices
Version 1

Block 2 - Code in JavaScript

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 3 - Route 2

Type / Role
n8n-nodes-base.noOp - noOp
Config choices
Version 1

Block 4 - Round Robin Router

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.3

Block 5 - Route 1

Type / Role
n8n-nodes-base.noOp - noOp
Config choices
Version 1

Block 6 - Route 3

Type / Role
n8n-nodes-base.noOp - noOp
Config choices
Version 1

Block 7 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 8 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 9 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 10 - Calculate the next route to use

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1

Block 11 - Update last_used in the datatable

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1

Block 12 - Merge trigger data to pass to subworkflow if needed

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

3. Summary Table

Workflow Distribute workflow execution with round-robin logic using data tables
Complexity intermediate
Nodes 12
Categories DevOps
Author Adrian Kendall
Published 22 Oct 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/10048/10048.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Distribute workflow execution with round-robin logic using data tables do?

Key Features Implements a simple round robin distribution mechanism using a Data Table to track the last route used. Supports multiple downstream workflows or resources, balancing workload across t...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your DevOps use case.