Back to feed
Dev.to
Dev.to
6/29/2026
Adding more Claude subagents made my pipeline slower — here's the specific reason why

Adding more Claude subagents made my pipeline slower — here's the specific reason why

Short summary

Scaling Claude Code subagents from 4 to 8 triggered session state collisions across stateless Cloudflare Workers instances, raising error rates from 0.8% to 4.3%. KV-based session storage fixed routing but created latency penalties (180ms → 620ms p99) and unsustainable costs ($150/month). The optimal solution combines Durable Objects for session affinity, DO Storage checkpoints, and KV as read-only routing; the inflection point is around 6 subagents.

  • Session state in stateless workers collides at scale; Cloudflare routing doesn't guarantee sticky sessions below ~6-subagent threshold
  • KV storage trades latency for cost; Durable Objects with checkpoints optimize both cost and performance
  • Three-layer architecture (DO active + DO Storage checkpoint + KV routing) isolates distinct failure modes for easier debugging

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Comments

Failed to load comments. Please try again.

Explore more