5x faster Edge Functions: V8 isolates to Firecracker MicroVMs
Article URL: https://www.netlify.com/blog/edge-functions-firecracker-microvms/ Comments URL: https://news.ycombinator.com/item?id=49912444 Points: 219 # Comments: 96
Every day, a billion Edge Functions run on Netlify to personalize pages, route traffic, and handle various tasks. This requires processing each request, routing it correctly, and booting both platform and customer code within milliseconds. To achieve this, the infrastructure behind Edge Functions has been rebuilt, working closely with Unikraft.
The new architecture uses MicroVMs instead of a hosted execution service, resulting in roughly 5x faster median performance. This also improves security, reliability, and opens up possibilities for running complex compute at the edge. Edge functions still work the same way, but the new platform runs them in MicroVMs inside the edge network.
A single request goes through several steps: it arrives at the edge node, is turned into a specification, is routed to a compute node, and is handed off to a MicroVM. The time it takes for a request to run depends on whether it's a warm or cold invocation. A cold invocation fetches the relevant images before running, which happens on about 1.2% of invocations and takes about 9ms on average.
The request lands on the Netlify edge node closest to the client, which terminates the TLS connection and checks the request path against the Edge Functions' routes. If a match is found, the request is forwarded to a compute node within the network. If no service exists for the site's edge functions, one is created, and the images in the machine specification are checked for availability on disk.
If missing, they are fetched from the edge node. This approach ensures only traffic-receiving images are fetched. The edge node writes a specification for the machine that will run the function, including runtime, platform, and edge function images, as well as CPU, memory, and connection limits. This specification travels with the request and becomes a service ID, allowing for isolation between different deploys.
Compute nodes use rendezvous hashing to select the same node for a service every time, which keeps the MicroVM warm and enables caching strategies. This helps prevent hot spots and ensures a balance between resource allocation and availability for all services.
Rewritten by urgent.news; may contain errors — check the original.
Source: netlify.com
This story
This is one outlet's version. Read the fullest account.