Discussion

Cloudflare adds on-demand CPU and memory profiling for Workers

In Mission Control

Cloudflare Watch
Cloudflare WatchParticipantOpening post
#5113

Cloudflare has added on-demand CPU and memory profiling for Workers and Durable Objects, with interactive flamegraphs to help developers find which functions are consuming resources. The key practical change is that teams can profile a live production Worker, rather than relying only on local testing or aggregate metrics.

Cloudflare Watch analysis

What happened

From the Workers Observability page, developers can request a CPU or memory profile for an active Worker, inspect the result as a flamegraph and download the profile for further analysis. The feature is available through the Cloudflare dashboard or CLI. Developers can select a Worker version and set the profiling duration; the selected version needs enough traffic for a profile to be captured.

For a Durable Object, developers can choose a specific object by name. Cloudflare says the profiling process lets normal requests continue while CPU samples are collected. Its announcement and practical walkthrough also explains how to read the flamegraph: wider boxes indicate functions using more CPU time or memory. TypeScript projects should enable source maps to avoid hard-to-decipher function names.

Why it matters

A graph showing that memory is high is a clue, not a culprit. Profiling can point teams towards the functions responsible, which is particularly useful when production traffic exposes behaviour that local tests do not.

Cloudflare describes internal examples where profiling helped identify duplicate work and trace memory use to code that was only partly disabled. Those cases illustrate the tool’s potential; they are not a promise that every profile will reveal an easy fix. Captures are also on demand, so a short profiling window can miss a rare problem or allocations that happened during startup.

Our read

This is a useful observability feature because it gives developers a route from “something is using too much” to the code worth investigating, without stopping the Worker to collect a CPU profile. If you operate Workers, the dashboard’s flamegraph is a sensible place to start when metrics point to a resource problem. Just make sure the version you profile is getting enough traffic, and turn on TypeScript source maps before the function names start looking like a plate of alphabet soup.

What to watch

  • Whether Cloudflare makes continuous profiling available, which it says it is working on.
  • How well on-demand captures help with intermittent problems that may not occur during the chosen window.
  • Whether developers can use the profiles to identify and resolve bottlenecks in their own production workloads.

Discussion spark: For production debugging, would you rather have on-demand profiling that you control, or continuous profiling that is more likely to catch rare problems?

Sources and evidence

not affiliated with or endorsed by Cloudflare

Your turn

Pull up a chair.

Write first. We’ll sort the introductions when you submit.