Bottleneck
Lightweight Node.js task scheduler and rate limiter. Bottleneck controls both concurrency AND request rate (RPS/RPM) with configurable reservoir and reservoir refresh intervals. Unlike p-limit (concurrency only), Bottleneck can enforce 'max 10 RPS with max 5 concurrent' — crucial for agent systems consuming rate-limited APIs. Supports Redis-backed distributed limiting.
Score Breakdown
⚙ Agent Friendliness
🔒 Security
Local library — no external calls. Redis connection credentials must use environment variables. Bottleneck prevents agent systems from overwhelming rate-limited APIs.
⚡ Reliability
Best When
Your agent needs to respect both concurrency AND RPS/RPM limits from external APIs — Bottleneck handles both dimensions in one library.
Avoid When
You only need concurrency control (use p-limit) or durable job queuing (use BullMQ).
Use Cases
- • Enforce API rate limits in agent systems that must respect RPS and RPM constraints from LLM providers
- • Control both concurrency and throughput in agent batch processors calling rate-limited external APIs
- • Implement distributed rate limiting for agent API calls across multiple worker processes using Redis
- • Queue agent tasks with priority levels and rate constraints — high-priority agent requests execute first
- • Throttle agent webhook dispatchers to respect downstream system rate limits
Not For
- • Simple concurrency-only limiting — p-limit is simpler for just controlling parallelism
- • Persistent job queues with retry — use BullMQ for durable queuing with retries
- • Applications where eventual consistency of distributed limits is not acceptable
Interface
Authentication
Local utility library — no authentication. Redis connection for distributed mode uses Redis auth.
Pricing
Completely free and open source.
Agent Metadata
Known Gotchas
- ⚠ reservoir vs maxConcurrent: reservoir is a token bucket (refills over time), maxConcurrent is concurrent slots — both can be set simultaneously for combined control
- ⚠ Jobs submitted to a full queue (maxWaitingJobs exceeded) are immediately rejected — agents must handle rejection by implementing backpressure or retrying submission
- ⚠ Redis distributed mode uses Lua scripts for atomic operations — Redis version 5.0+ required for Lua WAIT command support
- ⚠ Priority ordering requires integer priority values — lower numbers = higher priority; missing priority defaults to 5
- ⚠ limiter.schedule() wraps a function (not a promise) — pass a function that returns a promise, not the promise itself
- ⚠ stopAll() cancels all queued jobs — use disconnect() to cleanly shut down Redis connection; stopping without disconnect leaks Redis connections
Alternatives
Full Evaluation Report
Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for Bottleneck.
Scores are editorial opinions as of 2026-03-06.