Understanding the Cloudflare Workers Runtime
A deep dive into the V8-based runtime that powers Cloudflare Workers — its execution model, cold start characteristics, and what makes it different from Node.js.
What is the Workers Runtime?
Cloudflare Workers runs on the V8 JavaScript engine — the same engine that powers Chrome and Node.js — but stripped of all Node.js-specific APIs. Instead, Workers exposes the web-standard APIs defined by the WinterTC (formerly WinterCG) specification.
Execution Model
Each request spawns an isolate, a lightweight V8 execution context. Isolates are cheaper to create than full processes or threads, which is why Workers can achieve near-zero cold starts measured in microseconds rather than milliseconds.
Unlike traditional serverless platforms that boot a Lambda container, Workers isolates are pre-warmed and can be reused across requests on the same machine — but you must never rely on global mutable state persisting between requests.
// WRONG: do not do this
let counter = 0;
export default {
fetch() {
counter++; // unreliable — may or may not persist
return new Response(String(counter));
}
};
Web Standard APIs
Workers exposes the Fetch API, Web Streams, URLPattern, SubtleCrypto, and more. This means code written for Workers is largely portable to the browser and vice versa.
Compatibility Dates
Workers uses a compatibility_date field in wrangler.jsonc to gate breaking changes. Always set this to today's date when starting a new project:
{
"compatibility_date": "2024-11-01"
}
Key Takeaways
- Isolates, not containers — starts in microseconds
- Web-standard APIs, not Node.js APIs
- No shared mutable state across requests
- CPU time is billed, not wall-clock time (limited to 10 ms on Free, 30 s on Paid)