Concurrency and fair queues

Trigger.dev provides flexible concurrency control to manage multiple task runs efficiently. Configure tasks to run sequentially or in parallel, and use concurrency keys to create custom queue logic for different users or tiers.

Concurrency diagram

Mastering concurrency controls

One at a time

Execute your tasks one at a time

This is a useful technique where you wait for a run to complete before the following task is executed.

One at a time concurrency docs

concurrentLimit: 1

In parallel

Execute your tasks in parallel

By setting a high concurrency value along with batch triggering, you can execute many tasks in parallel. This approach is ideal for high-priority tasks with variable spikes.

Parellel concurrency docs

concurrentLimit: 3

Per-tenant queuing

Configure separate queues per user using concurrency keys

There are many situations where you may want different concurrencies; if certain users are on higher tier plans for example. With concurrency keys you can create bespoke queue logic for each of your users.

Per-tenant concurrency docs

Granular control over your user’s concurrency allows you to prioritise your most valued user’s tasks.

Concurrency and queues example code

import { task } from "@trigger.dev/sdk/v3";
export const oneAtATime = task({
id: "one-at-a-time",
queue: {
concurrencyLimit: 1,
},
run: async (payload) => {
//...
},
});

Ready to start building?

Build and deploy your first task in 3 minutes.

Get started now
,