billflare.

Introducing on-demand profiling: Cloudflare production examples

Dominik Picheta introduces on-demand CPU and memory profiling for Workers and Durable Objects, sharing Cloudflare examples of removing duplicate work and unnecessary allocation paths.

Products
WorkersDurable Objects
Source
Official docsCloudflare Blog
Author
Dominik Picheta

Key points

  • Cloudflare announces on-demand CPU and memory profiles for active Workers and Durable Objects, with interactive flamegraphs and downloadable profiles.
  • The article demonstrates dashboard and Cloudflare CLI capture. Production traffic exposes behavior that local tests may not reproduce.
  • In the R2 binding Worker, profiling revealed redundant recursive JSON traversal. Cloudflare reports that removing it made the replacer function 2.7 times faster.
  • A separate internal Worker retained a supposedly disabled Prometheus code path. Removing it reduced reported P999 memory from 133 MB to 118 MB.
  • Capture observes an already-loaded isolate rather than starting one. Durable Objects can target a specific live actor.
  • Sessions must be started explicitly; memory profiles cover allocations during that window. The article says continuous profiling is in development.

Original sources

  1. Published

    Introducing on-demand profiling: Cloudflare production examples

    Open original source

    Dominik Picheta introduces on-demand CPU and memory profiling for Workers and Durable Objects, sharing Cloudflare examples of removing duplicate work and unnecessary allocation paths.

  2. Cloudflare announces availability on X and links the launch article, describing profiling as a way to investigate memory leaks and performance bottlenecks.

    Read on 𝕏

    Cloudflare

    @Cloudflare · Original 𝕏 post

    On-demand CPU and memory profiling for Cloudflare Workers and Durable Objects is now available. Now you can quickly track down memory leaks and performance bottlenecks. https://t.co/As9WdNM8iH
Community resourceWorkers +1

cloudflare-cost-notify: a Worker cron that posts daily billable usage and free-tier counts to Discord

yutamoty/cloudflare-cost-notify is an unlicensed GitHub repository, pushed on 16 November 2026. A Cloudflare Worker cron at 00:00 UTC (described as 09:00 JST) reads the Billable Usage API and GraphQL Analytics API and posts yesterday’s cost, the day-over-day change, month-to-date spend, and Workers request / R2 storage / R2 Class A and B counts to a Discord webhook. A default $0.00 alert threshold turns the message red. Because the repository has no license, this entry is a summary only and the README is not archived in sources.json.

D1

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.

Author experienceD1 +2

Michael Liyang: record every AI call in D1 and downgrade before the budget runs out

@Michael_liyang argues that on a free tier the danger is not one expensive call but not knowing which call is expensive: write each call's usage to D1 by user and model, have a daily Cron check budgets and downgrade first, and look at which user is burning quota rather than only the total.