Wasm – all roads lead to serverless

Writing my previous post about serverless at the edge was an education. The space is moving quickly and the reality is that the big clouds are at the periphery of this. They’re keeping a close eye on things though; post-Kubernetes container solutions are new but growing quickly.

Another way of doing containers in serverless mode that has been picking up steam is Wasm or WebAssembly. I’m not sure if I’m dumb or if the tech isn’t described well, but it took a while for me to understand what Wasm even is. Per the official website: “WebAssembly (abbreviated Wasm) is a binary instruction format for a stack-based virtual machine. Wasm is designed as a portable compilation target for programming languages, enabling deployment on the web for client and server applications.”

Yeah that’s great but what does it help you do? The tl;dr is that Wasm is a sandbox that can (but doesn’t always have to) run in a browser. It is packaged as a binary and is written in low-level assembly language. In the simplest sense, it functions as a translation layer and it can compile and subsequently run different programming languages including C, C++, Python, Go, Rust, Java, and PHP.

While the client-side browser was the first use case for Wasm, people quickly found that this technology could be useful server-side too. You could think of Wasm as a small, secure VM that is agnostic to the CPU or OS it runs on. It can run the same code across all machines in a scalable way. What the initial incarnation of Wasm was missing though, was a system interface, or a way for code running outside the browser to talk to the system. Thus came WASI—a system interface for the WebAssembly platform.

The combination of Wasm and WASI allows for another way of doing containerized apps. Wasm can also be used to sandbox entire third-party libraries or to construct layers of security for first-party code. This makes it a great runtime for hosting untrusted code within a secure environment. Additionally, since Wasm is essentially just a binary, you don’t have to bring the rest of an operating system and this precludes a lot of the security concerns/CVEs you might otherwise have with Docker. 

Here’s a tweet from the founder of Docker that illustrates the implications of this technology.

According to the state of Wasm survey conducted in 2022 (~300 respondents), there is a growing percentage of Wasm users who are using Wasm for serverless and containerization (web development and IoT are the more obvious/proven use cases imo). There are public posts from companies like Disney+, Prime Video, Shopify, and CDNs like Fastly, CloudFlare, etc. that confirm this. 

Image credit: The State of WebAssembly 2022, Scott Logic

Wasm can also enable really fast cold-start times, about 10-100x faster than Docker. Fermyon, a startup in this space raised $20M in 2022 to help deploy Wasm apps. Per their website, their key value proposition is “Go from blinking cursor to deployed serverless app in 66 seconds.” There’s a budding ecosystem being built around using Wasm and serverless, and as always, I’m excited to see where this goes!

I see parallels between what companies like Vercel are doing with Next.js for browser/edge compute and what Fermyon is doing now with Wasm and WASI. It isn’t clear to me yet whether they compete (or will compete soon), but it’s clear that there’s a lot of money and talent going into rediscovering how apps can be deployed and run.

Move over containers. Hello sandboxes?!

Leave a Comment

Your email address will not be published. Required fields are marked *