Cost optimization · Content tag
Browse cases and guides discussing cost optimization.
14 matching items
Cases · 3
D1 row reads: an author reports a $108 bill in seven days.
@shivek_khurana reports a $108 Cloudflare D1 bill over seven days after a workflow read more rows than needed. The author says adding an index reduced reads by about 90%.
Reported amount · USD
$108
D1 row reads: a $134.14 invoice from unindexed queries.
Justin Ahinon reports that his April 21, 2026 Cloudflare invoice was $134.14, with $127.60 from 127,599,130,859 D1 row reads on a 765,000-row database. He attributes it to full table scans in queries that ran on every page load.
Reported amount · USD
$134.14
RetainDB: a reported $36k bill from a queue loop with 81 users.
Reddit user alameenswe, building RetainDB on Workers, KV, Durable Objects and Queues, reports a Cloudflare bill of about $36k for one month with 81 users; the post body says $35,000. He attributes it to a queue consumer that re-queued async writes, 12 unbatched Durable Object writes per memory write and a kv.list() authentication fallback.
Reported amount · USD
$36,000
per month
Guides · 11
Layered defenses after a Durable Object alarm loop
星星之火可以燎原 (@fireandstart) reads a public Durable Object alarm-loop recap and argues for layered defenses rather than relying on being more careful next time.
How I keep Cloudflare under $5: where surprise bills come from
Ashish Sharma (@sarmaasis) runs several sites on the $5 Workers Paid plan and lists, product by product, the usage patterns he says quietly run up a Cloudflare bill, ending with a 12-item checklist.
Put the spending ceiling into AI-generated code
Prasenjit Sarkar (@stretchcloud) uses the Durable Objects alarm loop to argue that alarms bill without traffic, that a single console cap cannot cover multi-vendor agent work, and that generated code needs execution quotas, idempotency checks and a kill switch.
Idle projects can still bill: check background tasks and storage
@An_yhl reads @shmily7’s follow-up as a reason to audit abandoned AI projects: check scheduled background work and storage reads and writes, stop what is unused instead of just closing the page, and turn on alerts knowing they will not stop anything.
Removing unneeded Durable Objects from MCP servers on Workers
Justin (@interjc) describes moving read-only MCP servers from McpAgent, which starts a Durable Object per session, to stateless createMcpHandler, and shares a prompt for auditing Workers bindings and runaway usage patterns.
Cloudflare costs $5 a month, but the bill is not capped
不追高 (@Ariella1213) writes an X article explaining that Workers Paid’s $5 is a minimum, that per-product limits and budget alerts do not cap the account bill, and how denial-of-wallet requests, write amplification, delayed stops and background retries add cost.
Four layers of cost protection for small Cloudflare projects
David Z (@davezfr) writes an X article for vibe coders on budget alerts, stop conditions for paid paths, automatic pausing, and letting a personal agent verify and pause.
AI Gateway spend limits
Cloudflare documents cost-based budgets on an AI Gateway that block requests, or fall back to a cheaper model, once cumulative spend in a time window reaches the limit.
Cloudflare cost playbook
A community playbook for Cloudflare cost retrospectives, cost models, and code review.
Optimize costs
Cloudflare lists ways to find and reduce usage-based charges by product.
D1 billing incident and circuit breakers
Nathan Schram describes D1 write risks and circuit-breaker approaches.