Pricing a runaway Cloudflare bill before hard caps ship: Workers loops vs always-awake Durable Objects
Lenny Enderle (@lenny_enderle) prices runaway scenarios from the docs: a Worker looping at 1,000 req/s for a day is about $34 plus the $5 plan, while 1,000 Durable Objects kept awake all month is about $4,050. Until hard caps ship, he lists a per-invocation CPU limit, WebSocket hibernation and your own usage counter as guards.
- Products
- WorkersDurable Objects
- Source
- Author experience𝕏 thread
- Author
- Lenny Enderle (@lenny_enderle)
Key points
- What exists today, per the thread: budget alerts — since July pay-as-you-go accounts get one by default at $10 — which only send email, do not pause or cap usage, and can arrive a day late because usage is processed once a day.
- Runaway Worker (his assumption): 1,000 req/s for 24 h at 7 ms CPU each = 86.4 million requests and about 605 million CPU ms; requests 76.4M × $0.30/M = $22.92, CPU 575M × $0.02/M = $11.50, about $34 plus the $5 plan.
- Durable Objects are billed for the 128 MB allocation while awake: 1,000 objects awake all month = 324 million GB-s, minus 0.4 million included, × $12.50/M ≈ $4,050. He says one WebSocket accepted the old way (accept()) is enough to keep an object awake, and quotes the docs’ examples of $419.30 a month for 100 objects with non-hibernating WebSockets versus $20.65 with hibernation (different workloads).
- Guards he lists, none a hard cap: a per-invocation CPU limit (bounds each request, not the total), the WebSocket Hibernation API, and counting usage in your own Durable Object to refuse requests past a limit. He says he has not tried the previewed caps.
- In replies, @mptielemans notes another quiet cost: run_worker_first: true routes every hashed JS/CSS asset through the Worker and bills it; Lenny agrees and points to negative patterns such as !/assets/*, which @mptielemans says need Wrangler 4.20+. FlareCost adds limits.cpu_ms in Wrangler config.
Original sources
Published
Original post
Read on 𝕏Lenny Enderle (@lenny_enderle) prices runaway scenarios from the docs: a Worker looping at 1,000 req/s for a day is about $34 plus the $5 plan, while 1,000 Durable Objects kept awake all month is about $4,050. Until hard caps ship, he lists a per-invocation CPU limit, WebSocket hibernation and your own usage counter as guards.
Lenny Enderle
@lenny_enderle · Original 𝕏 post
cloudflare is about to finaly get hard spend caps, starting with workers and durable objects. a preview screenshot went around on oct 26. i can't find them shipped yet. until they do, the only guard is an alert email. so i priced what a runaway bill looks like, straight from the docs. 🧵
Thread: budget alerts default to $10 for pay-as-you-go accounts since July, are email-only and informational, and can arrive a day after the threshold is crossed.
Read on 𝕏Lenny Enderle
@lenny_enderle · Original 𝕏 post
what exists today: budget alerts. since july, pay-as-you-go accounts get one by default at $10, and you can set your own threshold. it sends an email. the docs say it's informational only and doesn't pause or cap usage. usage is processed once a day, so the email can arrive a day after you cross the line.
Thread: a Worker loop at 1,000 req/s for 24 h at 7 ms CPU is about $34 plus the $5 plan ($22.92 requests, $11.50 CPU).
Read on 𝕏Lenny Enderle
@lenny_enderle · Original 𝕏 post
runaway workers first. say a loop hits one worker at 1,000 req/s for 24 h, 7 ms cpu each (my assumption): 86.4m requests, ~605m cpu-ms requests: 76.4m x $0.30/m = $22.92 cpu: 575m x $0.02/m = $11.50 about $34 plus the $5 plan. annoying, not a catastrophe.
Thread: 1,000 Durable Objects awake all month = 324M GB-s, about $4,050; one WebSocket accepted the old way keeps an object awake.
Read on 𝕏Lenny Enderle
@lenny_enderle · Original 𝕏 post
durable objects are different. duration is billed for the 128 mb an object is allocated, for as long as it's awake and can't hibernate. 1,000 objects awake all month: 324m gb-s, minus 0.4m included, x $12.50/m = ~$4,050. no traffic spike needed. one websocket you accept() the old way is enough to keep an object awake.
Thread: the docs’ examples — $419.30 a month for 100 objects with one WebSocket each and a message every second, versus $20.65 with hibernating WebSockets for 10,000 clients — show you pay for time awake.
Read on 𝕏Lenny Enderle
@lenny_enderle · Original 𝕏 post
cloudflare's own docs have both cases. 100 objects, one websocket each, a message every second: $419.30 a month. 100 objects with hibernating websockets, 10,000 clients in total, a message a minute each: $20.65. different workloads, so not a controlled test. but you pay for time awake, not for clients.
Thread: guards today are a per-invocation CPU limit, WebSocket hibernation and your own usage counter; prices from the docs, 30-day month.
Read on 𝕏Lenny Enderle
@lenny_enderle · Original 𝕏 post
what you can do today, none of it a hard cap: - set a per-invocation cpu limit on workers (the docs mention it against "runaway bills" and "denial-of-wallet") - use the websocket hibernation api so idle objects aren't billed for duration - for anything public, count usage in your own durable object and refuse past a limit caveats: the cpu limit bounds each request, not the total. prices from the docs (updated oct 2 and oct 18), 30-day month. i haven't tried the real caps, they're not out.
Thread sources: budget alerts docs, billing changelog (20 July 2026), Durable Objects and Workers pricing, and Sid Chatterjee’s 26 October preview.
Read on 𝕏Lenny Enderle
@lenny_enderle · Original 𝕏 post
sources: budget alerts https://t.co/9dtPEqXM68 billing changelog (20 jul 2026) https://t.co/XYTyHY8i5T durable objects pricing https://t.co/eyqfs5hD1X workers pricing https://t.co/Zt6TIwBJIu preview screenshot: sid chatterjee, oct 26 https://t.co/r4PSIH2q4Z
Reply from @mptielemans: run_worker_first: true routed every hashed JS/CSS file through the Worker, about half of each page load’s requests, all billed.
Read on 𝕏Martin
@mptielemans · Original 𝕏 post
@lenny_enderle quiet one we hit wasn't a loop: run_worker_first: true routed every hashed js/css file through the worker, ~half of each page load's requests, all billed. does your math assume assets skip the worker?
Lenny: his math assumes assets skip the Worker; with run_worker_first they all invoke it, so the request count can be 2x; negative patterns like !/assets/* keep them out.
Read on 𝕏Lenny Enderle
@lenny_enderle · Original 𝕏 post
@mptielemans good catch, yes my math assumes assets skip the worker. docs say static asset requests are free, but with run_worker_first they all invoke the worker and get billed. so with ~half of every page load being hashed js/css, the request count can be 2x what you'd guess. negative patterns like !/assets/* keep them out of the worker
@mptielemans: they used ["/*", "!/assets/*"], moved a noindex header to a _headers file, and says negated patterns need Wrangler 4.20+.
Read on 𝕏Martin
@mptielemans · Original 𝕏 post
@lenny_enderle same fix we landed on: ["/*", "!/assets/*"]. catch was the worker also set a noindex header on those assets, so that had to move to a _headers file. and negated patterns need wrangler 4.20+, worth a line in the thread
FlareCost (@FlareCost): set limits.cpu_ms in Wrangler config to cap CPU per request (Paid defaults to 30 s); CPU past the included 30M ms is $0.02 per million.
Read on 𝕏FlareCost
@FlareCost · Original 𝕏 post
@lenny_enderle Useful thread. One guard that works today: set limits.cpu_ms in your Wrangler config to cap CPU per request (Paid defaults to 30 s), so a runaway invocation gets stopped early. CPU past the included 30M ms is $0.02 per million: https://t.co/XwoC8hcigH
More to read
Anti-abuse code that burned the Durable Objects allowance: heartbeats, rejected requests and D1 scans
Frank Zeng (@frankzeng2020) says an AI-written anti-abuse module pushed Durable Objects to 1.19 million requests against the 1 million included each month, costing him an extra $0.15; a budget alert email caught it, and the audit also found a D1 query path scanning 925 million rows a day and a signing key re-imported on every request. He shares a read-only self-audit prompt.
hiromsaeden: an unindexed D1 query loop billed $2,129.00; a $953.74 courtesy credit left $645.38 due.
Cloudflare Community user hiromsaeden, in a post-mortem of a personal hobby project on Workers and D1, says an unindexed GROUP BY aggregate query scanned about 877,000 rows to return 30 rows, and an unintended loop triggered about 315,000 runs across two billing cycles. In the Oct 15 – Nov 15 cycle alone, 1,447,580,203,670 rows (1.44 trillion rows) were read, on top of the previous cycle’s usage. The author says the October invoice IN-83890481 was $529.88 USD, paid in full out of pocket; the November invoice IN-89082487 was $1,599.12 USD ($1,447.58 D1 Rows Read + $6.16 Workers CPU + $145.38 tax); and the total billed was $2,129.00 USD against an expected budget of about $20/month. After noticing the issue on Nov 2–3, the author deleted the Worker and the D1 database; Support confirmed all reads had stopped. In case #02408621, Support offered a $275.00 courtesy credit for October and advised holding it until the November invoice was issued on Nov 15. In case #02434399, Support applied a one-time courtesy credit of $953.74 (which included the held $275.00), leaving a final balance of $645.38 USD, and said the review was complete and no further adjustments can be made. The author, having already paid $529.88, says the remaining $645.38 cannot be afforded and the account will be downgraded on Nov 22. The author also says a budget alert fired once at the $37 mark but did not stop the charges, and that D1 currently has no hard spending cap. There is no Cloudflare staff reply on the public thread; the Support actions are reported by the author.
Cloudflare Cost Hub: free-tier vs paid allowances, cost drivers and month-end forecasts
An MIT-licensed dashboard that signs in with Cloudflare OAuth, reads account analytics across products, colour-codes usage as free, within paid allowance or billable, ranks per-instance cost drivers, forecasts month-end cost and emails threshold and budget alerts.