# Edge Runtimes and V8 Isolates — Serverless & Edge

Source: https://www.skillbyai.com/en/serverless-edge/se-v8-isolates

> Explain how isolate-based edge runtimes differ from container-based functions and what that means for APIs and limits.

## Isolates instead of containers

Many edge platforms, Cloudflare Workers being the best known, do not start a container or a VM for each function. They run many customers' code inside one runtime process, each in its own **V8 isolate**: the same sandboxing mechanism that keeps browser tabs apart. An isolate has its own heap and globals but shares the engine process, so creating one is far cheaper than booting a container, and cold starts are usually a few milliseconds. The price is a restricted environment. Code targets **Web-standard APIs** (`fetch`, `Request`, `Response`, `URL`, Web Crypto, streams) rather than the full Node.js API; native binaries and raw listening sockets are not available, though platforms provide compatibility layers for many Node modules. CPU time and memory per request are tightly limited, and one isolate may serve many requests concurrently. Edge functions on other platforms, such as Vercel, Netlify and Deno Deploy, follow a similar Web-API model.

## A request handled at the nearest PoP

The request is routed to the nearest PoP, where an isolate running your code produces the response, usually without contacting any origin server.

![Three connected stages from left to right: an incoming request, a lightweight isolate running in the nearest point of presence, and the response returned to the user.](assets/figures/serverless-edge/section-5-map.svg) — Figure 5.1: request -> isolate in nearest PoP -> response

## Rooms in a hostel versus separate flats

A container is like renting a separate flat: private and flexible, but it takes time to get the keys and set up. An isolate is a room in a well-run hostel: the building, water and security are shared, a room is ready almost instantly, but you cannot install your own generator.

## Check compatibility before you pick a library

A package that uses Node's `fs`, native add-ons or raw TCP may not run on an edge runtime. Look for packages that state Web-standard or edge support, and on Cloudflare read about the `nodejs_compat` compatibility flag, which enables many Node APIs but not all of them.

**Quiz:** Why are cold starts on isolate-based edge runtimes typically much shorter than on container-based functions?

- [ ] Edge functions are written in a faster programming language
- [ ] Edge platforms keep a dedicated server running for every customer
- [ ] Edge functions cannot make network requests
- [x] A new isolate is created inside an already-running runtime process instead of booting a container or VM

*Answer:* A new isolate is created inside an already-running runtime process instead of booting a container or VM. Isolates share an existing engine process, so there is no OS or container to boot. Language choice and dedicated servers are not the reason.
