Run WebAssembly everywhere

David Calavera
2 min readApr 25, 2019

--

In the past year, I’ve grown more and more interested in WebAssembly. There are many reasons to be excited about the possibilities that WebAssembly brings to modern computing. Milos Gajdos published an article today that outlines some of those reasons. I very much agree with what he writes there:

Most of the current conversations around WebAssembly as a universal runtime focus on IoT and Edge computing. It makes sense because some of the companies spearheading the early research in WebAssembly are very focused on those fields. But, there are many other opportunities for WebAssembly, and we’re not talking about them that much. So this quick post is a follow up to Milos’ with some ideas bouncing on my head.

Tyler McMullen, Fastly’s CTO, talks about their work on bringing WebAssembly to their edge network in the video below. Their challenges with VCL(Varnish Configuration Language) made them look into WebAssembly to extend how their customers interact with Varnish Cache, the cache server that powers their CDN network:

We take Varnish as a very specific use case for WebAssembly. When we try to generalize this use case, things start to look much more interesting. A cache server is a type of data storage, so, if we can run WebAssembly in this type of data storage, why can’t we run it on other general data storage software? can we find real use cases for doing that?

Let’s think about traditional database software for a moment, like MySQL and Postgres. They are already designed as event machines, you can write SQL statements that will be executed when events happen with the data stored in them. If those products embedded a WebAssembly runtime, we could execute safe and isolated programs to react to those events. Making those triggers much more powerful for the end user.

If we extrapolate the database example to something even bigger, like a Cloud provider, things become even more interesting. AWS popularized the Serverless model a few year ago, and other clouds have rapidly adopted very similar capabilities. One of the fun parts of Serverless is its evented nature. You can trigger actions when files are uploaded to S3, or when CloudWatch observes a specific behavior. Currently, you can attach Lambda functions to those occurrences, but you’re also loosing data locality. After all, AWS still needs to send those files from the S3 servers to the Lambda servers, no matter how fast the network is. With WebAssembly, you could run safe code directly on S3, without having to move files around, and use tools like ImageMagick compiled to WebAssembly. And we can expand that model into every single product that every Cloud provider offers.

All in all, WebAssembly is a very interesting project, and its future looks very bright. I’m looking forward to see how it develops during this year and the years to come.

--

--