Skip to content

Token-bucket rate limiting per actor #83

@pathosDev

Description

@pathosDev

HTTP rate-limiting (`rateLimit` middleware) ships in the framework already. Per-actor rate limiting is a common adjacent need:

  • Cap an actor that processes work-items at N ops/sec.
  • Fair-share between many entities sharing an external resource (e.g. DB connection pool, third-party API).

Scope:

  • New mailbox decorator or actor-context method: `context.throttle({ qps: 100, burst: 200 })`.
  • Token bucket with burst — well-understood algorithm.
  • Excess messages either: stash + retry, or drop, or pause-mailbox-until-tokens-available. Configurable.
  • Cluster-aware variant: split the budget across all routees of a cluster router (separate sub-issue if needed).

Estimate: 2 days.

Out of scope: distributed token bucket across the whole cluster — that's a Redis-counter-style problem, separate issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpriority: lowNice-to-have / niche / demand-driven

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions