Cloudflare Workers: On-Demand Profiling Arrives
Alps Wang
Oct 9, 2026 · 1 views
Unlocking Serverless Performance Insights
Cloudflare's introduction of on-demand CPU and memory profiling for Workers and Durable Objects is a substantial advancement in serverless observability. The ability to generate interactive flamegraphs directly from production environments, accessible via both the dashboard and CLI, provides developers with unprecedented visibility into application performance. This feature directly tackles the often-frustrating challenge of diagnosing resource-intensive issues in a black-box serverless environment. The practical examples of identifying recursive function inefficiencies and dormant but resource-consuming code demonstrate the tangible benefits of this tooling. The integration with existing observability workflows and the promise of future continuous profiling suggest a commitment to providing robust developer experience.
However, the current implementation has some inherent limitations. The requirement for the Worker to have 'plenty of traffic' for successful profiling is a significant hurdle for less popular or newly deployed Workers, potentially leaving them in a state of un-debuggable underperformance. Furthermore, the memory profiler's focus on allocations during the profiling window means startup-related memory bloat might still go undetected. The reliance on developers to explicitly initiate profiling also means that intermittent or rare performance anomalies could be missed. While the prospect of continuous profiling is exciting, its absence means developers are still reactive rather than proactive in identifying all potential issues. The explanation of the complex routing and isolate management for profiling requests, while necessary for understanding the technical underpinnings, also highlights the inherent complexity of profiling distributed serverless systems.
Key Points
- Cloudflare now offers on-demand CPU and memory profiling for Workers and Durable Objects.
- Profiles are generated as interactive flamegraphs, accessible via the Cloudflare Dashboard and CLI.
- This feature allows developers to identify specific functions consuming excessive CPU or allocating significant memory in production.
- The profiling process is designed to run without stopping the Worker, ensuring minimal disruption.
- Key use cases include optimizing code, fixing out-of-memory errors, and improving overall performance.
- Requires sufficient traffic on the Worker version to be profiled effectively.
- Memory profiling only captures allocations during the profiling window.
- Continuous profiling is planned as a future enhancement to address limitations of on-demand profiling.

📖 Source: Introducing on-demand CPU and memory profiling with flamegraphs for Workers and Durable Objects
Related Articles
Comments (0)
No comments yet. Be the first to comment!
