Skip to content
InfoQ·

🛠️Cloudflare Adds On-Demand Profiling for Workers and Durable Objects

Debugging just got easier on Cloudflare Workers

TL;DR

Cloudflare now offers on-demand CPU and memory profiling for Workers and Durable Objects, allowing developers to capture and analyze real-time performance data. This feature helps identify and fix inefficiencies, improving app performance.

Cloudflare has introduced on-demand CPU and memory profiling for Workers and Durable Objects, generating interactive flamegraphs through the Workers Observability dashboard or the cf CLI. Developers can capture profiles for deployed Worker versions and download them for offline analysis with tools like pprof. This feature helps teams running production workloads on Cloudflare Workers by identifying unnecessary computation and memory consumption, improving app performance. For example, profiling an R2 binding Worker revealed a recursive JSON replacer that was corrected to make it 2.7 times faster.

Cloudflare Adds On-Demand Profiling for Workers and Durable Objects — InfoQ

Key Points

1

Cloudflare's profiling feature captures CPU or heap-allocation profiles for deployed Worker versions, generating interactive flamegraphs.

2

Profiles can be downloaded for offline analysis with pprof, a widely used profiling tool.

3

Developers can examine code executing under real production traffic, identifying unnecessary computation and memory consumption.

4

Profiling a specific named instance of Durable Objects is supported, though the target must receive sufficient traffic during the capture window.

5

Cloudflare's implementation accounts for Workers running across its distributed edge infrastructure.

Why It Matters

If you're running production workloads on Cloudflare Workers, this feature helps you identify and fix inefficiencies. For example, profiling an R2 binding Worker revealed a recursive JSON replacer that was corrected to make it 2.7 times faster. This is crucial for teams looking to optimize performance and reduce costs.

cloudflareworkersdurable-objectsprofilingperformance

Comments

Subscribe to join the conversation...

Be the first to comment

Enjoyed this article?

Get it daily. 7am. Free. Reads in 5 minutes.

Join 3,568 builders reading daily.

Also get