Production profiling for Workers and Durable Objects: operation guide
Cloudflare explains how to locate expensive functions and memory allocations in deployed Workers and Durable Objects using on-demand profiles and flamegraphs.
- Products
- WorkersDurable Objects
- Source
- Official docsCloudflare Docs
Key points
- CPU profiles locate compute-heavy functions. Heap profiles sample allocations during capture; they are not snapshots of retained memory.
- Keep the deployed version or target object active with representative traffic. Capture observes a loaded isolate; it does not invoke code or replay historical logs.
- In the dashboard, open Observability → Flamegraph for a Worker or a Durable Object instance. Choose CPU or Heap, a version, and 1–50 seconds.
- Cloudflare CLI uses cf workers versions profile with --worker-id and --profile-type cpu or heap. latest means the newest created version, which may not be deployed.
- For a Durable Object, supply its owning Worker and both --namespace-id and --actor-id. Download pprof data for further inspection.
- Wider flamegraph frames indicate more CPU time or allocations, not chronological order. Use Table to compare Self and Total; enable source maps for readable TypeScript names.
Original sources
Original source · Last updated
Open original source
More to read
mcwangcn reports $1,300 in D1 charges after a bot attack.
@mcwangcn says D1 writes previously cost over a thousand dollars and separately mentions Workers CPU charges without giving an amount. He later shares a Cloudflare bill and says $1,300 of its $3,600 came from D1 after a bot attack.
A prompt to set up Cloudflare budget and usage alerts
Merill Fernando (@merill) shares a prompt that asks a coding agent to install Cloudflare’s CLI, check for a billing budget alert and add usage alerts based on last month’s usage, and lists what it set up for him.
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.