infrastructure//Cloudflare//Workers//CPU time

CPU time is the time a Worker actually spends running on the CPU, which differs from wall time, the total elapsed time from request to response. CPU time counts code actively running on the processor (parsing JSON, computing, transforming data); wall time also includes waiting for the network (a `fetch` to an API, a read from D1, a call to R2).


CPU time is the time a Worker actually spends running on the CPU, which differs from wall time, the total elapsed time from request to response. CPU time counts code actively running on the processor (parsing JSON, computing, transforming data); wall time also includes waiting for the network (a fetch to an API, a read from D1, a call to R2).

Waiting on the network does not count as CPU time, so a Worker can fetch from 10 APIs and use only 5 ms of CPU.

The free plan allows 10 ms of CPU time per invocation; the paid plan 30 s by default and up to 5 minutes at most.

10 ms sounds tiny, but for edge logic it is plenty: routing, auth and JWT, header manipulation, cache decisions, rate limiting and small API responses are all sub-millisecond operations.

The limit exists because V8 isolates are single-threaded and share the engine. A long CPU hog would starve the other requests in the same PoP, and the limit keeps the whole system fair.