BotNetwork

Concurrency limits for bot workers

Cap in-flight LLM calls per process.

Guide1 min readUpdated

Why it matters

Unbounded concurrency in bot workers amplifies 429s and memory spikes; set per-process and per-dependency limits.

Practical steps

  1. Cap in-flight webhook handlers per process.
  2. Use a separate, lower limit for LLM calls.
  3. Queue overflow instead of accepting forever.
  4. Expose current in-flight gauges on /metrics.
  5. Load-test the limit you chose, not the limit you wish.

Watch out for

  • One giant async gather over an entire backlog.
  • Sharing one HTTP client without connection limits.

Related comparisons and tools