SHOW HN: A usage circuit breaker for Cloudflare Workers
Details
- External ID
- 47322794
- Source
- HN
- Company
- —
- Product
- —
- Website domain
- —
- Launched
- March 10, 2026
- Cohort
- —
- Upvotes
- 29
- Upvotes percentile
- 0.7902829028290282
- Tags
- —
- Fetched at
- Sept. 7, 2026, 9:26 p.m.
- Updated at
- Sept. 7, 2026, 9:26 p.m.
Description
I run 3mins.news (https://3mins.news), an AI news aggregator built entirely on Cloudflare Workers. The backend has 10+ cron triggers running every few minutes: RSS fetching, article clustering, LLM calls, email delivery.The problem: Workers Paid Plan has hard monthly limits (10M requests, 1M KV writes, 1M queue ops, etc.). There's no built-in "pause when you hit the limit", CF just starts billing overages. KV writes cost $5/M over the cap, so a retry loop bug can get expensive fast.AWS has Budget Alerts, but those are passive notifications, by the time you read the email, the damage is done. I wanted active, application-level self-protection.So I built a circuit breaker that faces inward, instead of protecting against downstream failures (the Hystrix pattern), it monitors my own resource consumption and gracefully degrades before hitting the ceiling.Key design decisions:- Per-resource thresholds: Workers Requests ($0.30/M overage) only warns at 80%. KV Writes ($5/M overage) can trip the breaker at 90%. Not all resources are equally dangerous, so some are configured as warn-only (trip=null).- Hysteresis: Trips at 90%, recovers at 85%. The 5% gap prevents oscillation, without it the system flaps between tripped and recovered every check cycle.- Fail-safe on monitoring failure: If the CF usage API is down, maintain last known state rather than assuming "everything is fine." A monitoring outage shouldn't mask a usage spike.- Alert dedup: Per-resource, per-month. Without it you'd get ~8,600 identical emails for the rest of the month once a resource hits 80%.Implementation: every 5 minutes, queries CF's GraphQL API (requests, CPU, KV, queues) + Observability Telemetry API (logs/traces) in parallel, evaluates 8 resource dimensions, caches state to KV. Between checks it's a single KV read — essentially free.When tripped, all scheduled tasks are skipped. The cron trigger still fires (you can't stop that), but the first thing it does is check the breaker and bail out if tripped.It's been running in production for two weeks. Caught a KV reads spike at 82% early in the month, got one warning email, investigated, fixed the root cause, never hit the trip threshold.The pattern should apply to any metered serverless platform (Lambda, Vercel, Supabase) or any API with budget ceilings (OpenAI, Twilio). The core idea: treat your own resource budget as a health signal, just like you'd treat a downstream service's error rate.Happy to share code details if there's interest.Full writeup with implementation code and tests: https://yingjiezhao.com/en/articles/Usage-Circuit-Breaker-for-Cloudflare-Workers
Enrichment
- Theme
- Codex monitoring and optimization tools
- Vertical
- Horizontal
- Function
- Dev tools
- Audience
- Developer
- AI stance
- Not AI
- Project type
- Commercial product
- Normalized one-liner
- rate limiting library for cloudflare workers
- Manually corrected
- False
Could you build this?
Yes It is a utility script/middleware for Cloudflare Workers that monitors request counts against KV/rate limits and short-circuits execution before exceeding paid thresholds.
Discussion
9 comments analyzed.
Competitors mentioned: Kubernetes ResourceQuotas, k8s autoscaling, Cloudflare/workerd
Concerns raised: Not ready for users to try out - blog post only, no working demo, Adds complexity and statefulness to deployed apps, Potential for more failure cases with increased state
Feature requests: Standardize quota signals in Containerfile/k8s/Helm spec, Add QUOTACMD Dockerfile instruction for quota status handling, Per-worker limits in addition to global limits, Circuit breaker for CI/CD pipelines like GitHub Actions
Competitors
Other products that read as similar to this one — 60 launches clear the similarity bar, closest 8 shown.
Attention rank: #10 of 61 (itself plus its competitors, highest first — normalized so YC and Product Hunt are compared fairly).
Launched 119 days after the earliest competitor.
- Hypermonitor - Cloud Incident Intel · ph · 2026-09-16 · 10 upvotes · similarity 0.43
- Quietfail · ph · 2026-09-29 · 2 upvotes · similarity 0.42
- UsageFlow · hn · 2025-11-20 · 5 upvotes · similarity 0.42
- I built a fuse box for microservices · hn · 2026-02-18 · 28 upvotes · similarity 0.41
- SeenOnMain · ph · 2026-09-14 · 2 upvotes · similarity 0.39
- Cronhq · ph · 2026-09-21 · 84 upvotes · similarity 0.39
- RELIASTRA · ph · 2026-09-11 · 1 upvotes · similarity 0.39
- OpsGlance · ph · 2026-09-15 · 2 upvotes · similarity 0.39
Other launches for this product
- No other launches for this product.
Same idea, different domain
Nobody's really built a dev tools tool for Sales yet.