Cloudflare has added on-demand CPU and memory profiling to Workers and Durable Objects. Announced on October 9, the feature gives developers a clearer view of where a running application spends resources, down to individual functions.
That is useful when a slow page leaves you guessing. A request can spend time waiting on a database, downloading assets or running code. A CPU profile helps investigate that last part; it does not turn every delay into a CPU problem.

Image credit: Cloudflare, illustration accompanying the announcement.
Find the expensive code
In a Worker’s dashboard, open Observability → Flamegraph, choose a CPU or Heap profile, select the running version and start a capture. The graph groups work by function and call stack. Wider sections show larger contributions, making costly paths easier to spot. Profiles can also be downloaded for analysis with pprof, and source maps help connect generated JavaScript back to the original code.
There is a practical catch: the Worker needs traffic before and during collection. Profiling samples an already active instance; pressing the button does not run a request for you. The dashboard’s log time filter also does not replay an earlier period. This is a capture of activity happening now.
What the memory view measures
Cloudflare’s production profiling documentation distinguishes a Heap profile from a heap snapshot. It samples allocations, showing which functions create memory. It does not tell you how much memory remains retained afterward.
For a small site, a sensible first use is to capture CPU activity while loading a troublesome page, inspect the busiest functions, make one targeted change and compare another capture. Raising a CPU limit allows more execution time; finding unnecessary work is what can reduce it.
Source: Cloudflare’s October 9 profiling announcement.
Image credit: Cloudflare, illustration accompanying the announcement.



No comments yet