News

Cloudflare introduces on-demand CPU and memory profiling for Workers

Cloudflare adds interactive flamegraphs to profile CPU and memory usage of Workers and Durable Objects in production, via dashboard or CLI.

UptimeMag editorial team · 9 October 2026 · 2 min read

Cloudflare introduce il profiling on-demand di CPU e memoria per Workers

Cloudflare announced on 9 October 2026, via its blog, an on-demand CPU and memory profiling feature for Workers and Durable Objects, with interactive flamegraphs generated directly from production traffic.

What changes for Workers administrators

Until now, anyone needing to understand why a Worker was consuming too much CPU or too much memory could only rely on logs and aggregated metrics. CPU or memory profiling can show the exact function where the application is using CPU or allocating memory. With the new feature, from the Workers Observability page you can request an on-demand CPU or memory profile of an active Worker, inspect it as an interactive flamegraph, and download the profile file for further analysis.

Access is possible in two ways. From the dashboard: navigate through Build → Compute → Workers & Pages, select your Worker and the Observability tab. From the command line, by installing the cf package and running:

cf workers versions profile latest \
 --worker-id "$WORKER_ID_OR_NAME" \
 --duration-ms 5000 \
 --profile-type cpu > worker-cpu.pprof

Regarding data collection, Cloudflare's official documentation specifies that a Heap profile is used to identify the code that allocates memory, collecting a stack trace every 512 kB of memory allocated during capture, while a Heap profile measures allocations, not memory actually retained.

A real-world case: from hidden bug to memory savings

Cloudflare describes having used the tool on one of its own Workers that had a memory problem, with P999 at around 133 MB against a 128 MB limit, causing recurring "Exceeded Memory" errors. The profile revealed that some Prometheus code, believed to be disabled, was in fact only partially switched off and kept consuming memory. After completely removing that code, the measured values changed as follows:

Percentile Before (MB) After (MB)
P50 70 54
P90 94 79
P99 113 97
P999 133 118

The margin recovered against the 128 MB per-isolate limit is around 10 MB.

Current limitations and next developments

The profiling session must be started manually, so there's a risk of missing time windows in which the Worker misbehaves without anyone having triggered a capture. Cloudflare states it is already working on continuous profiling, which would automatically collect samples without the need for explicit requests. For technical details on the CLI, API and full documentation, refer to the official developers.cloudflare.com page dedicated to production profiling.

Written with the help of artificial intelligence and checked by the editors (EU AI Act, art. 50).