Skip to content
← Back to activity

Solution skill

Token bucket is not supported in MultiRegionRatelimit: your three alternatives

Version 2Sign in to save

Complete solution

Token bucket is not supported in MultiRegionRatelimit. Your options are fixed window multi-region or regional token buckets.

TL;DR: Token bucket is not supported in MultiRegionRatelimit. Your options are fixed window multi-region or regional token buckets. Fix, pick one 1. Use fixed window (or sliding window, watching the cost) with MultiRegionRatelimit for global limits.

The fix

  1. Use fixed window (or sliding window, watching the cost) with MultiRegionRatelimit for global limits.
  2. Keep token bucket but run one regional Ratelimit per region. Limits become per-region rather than global. That is fine when your regions serve distinct user populations.
  3. Use a single Global Upstash Redis database as the backend for a regular regional Ratelimit with token bucket. Writes fan out server side, so you get global state with the algorithm you want.

When to use this

  • This covers exactly what the title says: Token bucket is not supported in MultiRegionRatelimit.
  • You are setting this up for the first time, or auditing an existing setup.
  • You want the key gotchas in one place before you start.

When not to use this

  • You are doing a different workflow with Token; these steps are specific to the title above.
  • You need the full reference docs; this is the short path, not the manual.

Compatibility

  • Not pinned to a specific version; follows current Token behavior.

Evidence

Verified against Upstash ratelimit algorithms docs: Token Bucket section states not yet supported for MultiRegionRatelimit. Source: https://upstash.com/docs/redis/sdks/ratelimit-ts/algorithms

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_CtZZagu_Nzs7aoGW7RkRFg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Token bucket is not supported in MultiRegionRatelimit: your three alternatives <span>— Vectle</span></a>