> ## Documentation Index
> Fetch the complete documentation index at: https://upstash-context7-agent-09df3c1c-9c05-4093-9d6e-e4e2644ee98c-1.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Parallelism

The parallelism limit controls the maximum number of calls that can be executed concurrently.
Unlike rate limiting (which works per time window), parallelism enforces concurrency control with a token-based system.

```typescript Configure Retry Attempt Count theme={null}
import { Client } from "@upstash/workflow";

const client = new Client({ token: "<QSTASH_TOKEN>" })

const { workflowRunId } = await client.trigger({
  url: "https://<YOUR_WORKFLOW_ENDPOINT>/<YOUR-WORKFLOW-ROUTE>",
  flowControl: {
    key: "user-signup",
    parallelism: 10,
  }
})
```

**Example**:
If `parallelism = 3`, at most 3 requests can run concurrently.

When tokens are available, requests acquire one and start execution:

<Frame caption="A failing step is automatically retried three times">
  <img src="https://mintcdn.com/upstash-context7-agent-09df3c1c-9c05-4093-9d6e-e4e2644ee98c-1/Ji1veGkAk12VnsTe/img/workflow/parallelism_1.png?fit=max&auto=format&n=Ji1veGkAk12VnsTe&q=85&s=f0061c595f283c78a23dc3707ba84380" alt="Workflow steps within the parallelism limit" width="2342" height="1126" data-path="img/workflow/parallelism_1.png" />
</Frame>

When all tokens are in use, additional requests are not failed — they’re queued in a **waitlist**:

<Frame caption="A failing step is automatically retried three times">
  <img src="https://mintcdn.com/upstash-context7-agent-09df3c1c-9c05-4093-9d6e-e4e2644ee98c-1/Ji1veGkAk12VnsTe/img/workflow/parallelism_2.png?fit=max&auto=format&n=Ji1veGkAk12VnsTe&q=85&s=bb446d6003fe0a15832ce83d0a78845c" alt="Workflow step waiting at the parallelism limit" width="2342" height="1126" data-path="img/workflow/parallelism_2.png" />
</Frame>

The step in the waitlist will wait for a step to complete and hand off it's token to a pending request:

<Tip>
  Token handoff does not guarantee strict ordering.
  A later request in the waitlist may acquire a token before an earlier one.
</Tip>

<Frame caption="A failing step is automatically retried three times">
  <img src="https://mintcdn.com/upstash-context7-agent-09df3c1c-9c05-4093-9d6e-e4e2644ee98c-1/Ji1veGkAk12VnsTe/img/workflow/parallelism_3.png?fit=max&auto=format&n=Ji1veGkAk12VnsTe&q=85&s=879e497241491f123683f29454cc8fbc" alt="Workflow step starts when capacity is available" width="2342" height="1126" data-path="img/workflow/parallelism_3.png" />
</Frame>
