Cloudflare launches on-demand profiling for production Workers and Durable Objects

Interactive flamegraphs target live code on Cloudflare's edge infrastructure

By LineZotpaper
Published
Read Time4 min
Cloudflare has introduced on demand CPU and memory profiling for Workers and Durable Objects, allowing developers to investigate performance bottlenecks in production using interactive flamegraphs. Announced on October 9, 2026, the feature generates flamegraphs through the Workers Observability dashboard or the cf CLI, helping teams identify expensive functions and memory allocations without relying solely on logs and aggregate metrics.

The key distinction from local profiling tools is that profiling targets an already running isolate rather than starting a fresh one. This allows developers to examine code executing under real production traffic.

Durable Objects receive additional support for profiling a specific named instance, which is useful when investigating problems tied to stateful workloads. However, the target must receive sufficient traffic during the capture window, and TypeScript developers should enable source maps to make function names easier to interpret.

The implementation must account for Workers running across Cloudflare's distributed edge infrastructure, where a script may have multiple isolates across data centres and physical machines. A profiling request therefore needs to identify the requested Worker version and locate a suitable active isolate. Durable Objects add another challenge because they are stateful and can move between locations; Cloudflare routes profiling requests to the machine hosting the specific object.

The runtime does not hold an isolate lock for the entire capture. For CPU profiling, it starts a V8 profiler that samples at one millisecond intervals, releases the lock while requests continue executing, and reacquires it to stop profiling and collect results. This lets the platform observe live execution without suspending normal request processing during the capture.

CPU profiling samples call stacks to reveal where execution time is being spent, helping identify expensive functions, redundant computation, and potential optimisation opportunities. Memory profiling, by contrast, highlights allocations associated with functions, helping developers find code that creates excessive objects or contributes to memory pressure.

Cloudflare used the feature internally to identify unnecessary computation and memory consumption. Profiling an R2 binding Worker revealed a recursive JSON replacer that repeatedly traversed nested data, making the function perform redundant work. Correcting the implementation made it a claimed 2.7 times faster. Another profile exposed an unnecessary duplicate metrics call that accounted for approximately 1 percent of CPU time. Memory profiling identified a separate problem in which partially disabled Prometheus instrumentation was reportedly still consuming substantial memory. Removing the remaining code reduced the Worker's 99.9th percentile memory usage from 133 MB to 118 MB, bringing it below the 128 MB limit.

Cloudflare's offering complements established tools rather than replacing them. Chrome DevTools supports local CPU profiling, making it useful during development, but reproducing production traffic and data can be difficult. pprof, widely used in Go and other supported profiling workflows, provides powerful offline profile analysis; Cloudflare also allows downloaded profiles to be examined with pprof. Its main differentiator is the ability to initiate profiling against live Workers and Durable Objects through the platform's existing operational interface.

The feature also complements logs, metrics and distributed tracing. These tools help identify when a service is slow or consuming excessive resources, while a profile can help pinpoint the functions responsible.

On demand capture is not continuous monitoring. Short profiling windows can miss intermittent problems, while heap profiles record allocations during capture rather than providing a complete picture of retained memory. Cloudflare says it is working towards continuous profiling, which could make it easier to investigate rare performance problems without having to anticipate when they occur.

For teams running production workloads on Cloudflare Workers, the release adds a practical debugging capability: moving from detecting resource pressure to identifying the code responsible, without first having to reproduce the issue locally.

§

Analysis

Why This Matters

  • The feature reduces reliance on reproducing performance issues locally, enabling direct production debugging for serverless functions.
  • It provides precise, function level resource bottleneck identification, saving development time spent on logs and metrics.
  • It represents an advance in serverless observability, moving from detecting a symptom to pinpointing the cause in live edge environments.

Background

Serverless platforms typically offer limited debugging tools beyond logs and aggregate metrics. On demand profiling is common in traditional application performance management tools but is technically difficult to implement on highly distributed edge infrastructure without degrading performance. Cloudflare Workers is a major serverless platform running across a global network of data centers. This feature closes part of the gap between traditional runtime debugging and serverless production environments.

Key Perspectives

Cloudflare: The feature is positioned as a differentiator for engineering teams that need to debug performance issues directly in production. It draws on internal experience optimising their own Workers and Durable Objects. Developers: Teams running production workloads benefit from the ability to investigate CPU and memory bottlenecks during live traffic, particularly for stateful Durable Objects where issues are tied to specific instances. Critics: The feature is on demand rather than continuous, so transient bugs may be missed. The reliance on source maps for TypeScript adds configuration overhead. Memory profiling captures allocations during the window rather than total retained memory, limiting its scope for some classes of memory leak.

What to Watch

  • Adoption rates of the profiling dashboard and CLI among Cloudflare Workers users.
  • Cloudflare's progress towards continuous profiling, which it states it is working on.
  • Responses from competing serverless platforms such as AWS Lambda and Google Cloud Functions regarding equivalent production debugging features.

Sources

Checked

10 claims in this story checked against 1 source: 9 supported.

Show each claim
  1. SupportedCloudflare introduced on-demand profiling for production Workers and Durable Objects.InfoQ: “Cloudflare has introduced on-demand CPU and memory profiling for Workers and Durable Objects”
  2. SupportedThe feature generates interactive flamegraphs through the Workers Observability dashboard or the cf CLI.InfoQ: “the feature generates interactive flamegraphs through the Workers Observability dashboard or the cf CLI”
  3. SupportedThe feature was announced on October 9, 2026.InfoQ: “Announced on October 9, 2026”
  4. SupportedProfiling targets an already-running isolate, allowing developers to examine code under real production traffic.InfoQ: “profiling targets an already-running isolate rather than starting a fresh one. This allows developers to examine code executing under real production traffic.”
  5. SupportedA Durable Object can be profiled by targeting a specific named instance.InfoQ: “Durable Objects receive additional support for profiling a specific named instance”
  6. SupportedCPU profiling samples at one-millisecond intervals while normal requests continue executing.InfoQ: “it starts a V8 profiler that samples at one-millisecond intervals, releases the lock while requests continue executing”
  7. SupportedFixing the recursive JSON replacer made the R2 binding Worker a claimed 2.7 times faster.InfoQ: “Correcting the implementation made it a claimed 2.7 times faster.”
  8. SupportedA duplicate metrics call accounted for approximately 1 percent of CPU time.InfoQ: “Another profile exposed an unnecessary duplicate metrics call that accounted for approximately 1% of CPU time.”
  9. Partly supportedRemoving the remaining Prometheus instrumentation code reduced 99.9th-percentile memory use from 133 MB to 118 MB, below the 128 MB limit.InfoQ: “Cloudflare claims that removing the remaining code reduced the Worker's 99.9th-percentile memory usage from 133 MB to 118 MB, bringing it below the 128 MB limit.”
  10. SupportedCloudflare is working towards continuous profiling, which could help investigate rare performance problems.InfoQ: “Cloudflare says it is working towards continuous profiling, which could make it easier to investigate rare performance problems”

Zotpaper

Written by Harper Lane on the Tech & AI desk. Claims checked by Ines Fairley, verification. Edited by Angus Burke, chief sub. Plate by Ollie Flash, picture desk.

1 source9 of 10 claims matched to a sourcefirst published
Meet the newsroomHow we workSubscribe