> ## Documentation Index
> Fetch the complete documentation index at: https://upstash-worktree-docs-descriptions.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Rate and Period

> Control how many Upstash Workflow steps start within a time window using rate and period limits, queuing excess steps for the next window.

The rate specifies the maximum number of requests allowed in a given period (time window).

```typescript Configure Retry Attempt Count theme={"system"}
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",
    rate: 10,
    period: 100,
  }
})
```

**Example**:
If `rate = 2` and `period = 1 minute`, then **a maximum of 2 steps** can be executed per minute.

The first 2 requests within the minute are executed immediately:

<Frame caption="Steps are executed within limit">
  <img src="https://mintcdn.com/upstash-worktree-docs-descriptions/KZjggLwxUHzudrXp/img/workflow/rate_1.png?fit=max&auto=format&n=KZjggLwxUHzudrXp&q=85&s=fc778773cb2fc957847c5adadd30420b" width="2342" height="848" data-path="img/workflow/rate_1.png" />
</Frame>

The 3rd request in the same minute is not executed immediately:

<Frame caption="A new step cannot execute immediately">
  <img src="https://mintcdn.com/upstash-worktree-docs-descriptions/KZjggLwxUHzudrXp/img/workflow/rate_2.png?fit=max&auto=format&n=KZjggLwxUHzudrXp&q=85&s=e7f823f72da28a00c2976a6ddf9dcef9" width="2342" height="848" data-path="img/workflow/rate_2.png" />
</Frame>

Instead of rejecting it, Workflow schedules the request in the next available time window:

<Frame caption="The new step is moved to the next time window">
  <img src="https://mintcdn.com/upstash-worktree-docs-descriptions/KZjggLwxUHzudrXp/img/workflow/rate_3.png?fit=max&auto=format&n=KZjggLwxUHzudrXp&q=85&s=06e6c26871e077e0c22ff7bc20083e4f" width="2342" height="848" data-path="img/workflow/rate_3.png" />
</Frame>

Note that step executions may take longer than the defined period.
The rate limit only controls how many steps are **started** within each time window,
it does not limit their execution duration.
