Fermyon’s new Spin and how ‘WebAssembly has miniscule compute requirements compared to more costly containers’

Fermyon’s new Spin and how ‘WebAssembly has miniscule compute requirements compared to more costly containers’

Fermyon’s Spin project has reached version 0.7.0 – now updated with a bug-fix release 0.7.1 – adding important features including Linux Arm64 support and the beginnings of MySQL database connections. There is also integration with HashiCorp Vault for managing runtime secrets.

Founder and CTO of Fermyon, Radu Matei, adds that “we have also published a new JavaScript and TypeScript SDK and made further improvements around deploying Spin applications on Fermyon Cloud.”

What is Spin? This is an open-source framework for building web applications in WebAssembly (Wasm). This means that the programming language can in principle be anything that can compile to Wasm, though Spin has a particular focus on Rust, followed by Go. There are also templates though for Zig, PHP (using a VMware WebAssembly runtime for PHP), Swift, and more. In September Fermyon released a Spin .NET SDK though this is currently an “experimental library.”

Spin running in Windows Subsystem for Linux

Spin is some distance from being production-ready for most purposes; though Fermyon runs its own website on WebAssembly modules using a custom CMS (Content Management System) called Bartholomew that can run in any Spin-capable system.

The post introducing the project says a lot about why Wasm is attracting a high level of interest. “WebAssembly has miniscule compute requirements compared to more costly containers,” the post explains. “We are running our infrastructure on inexpensive ARM small VMs. And right now, we can run our entire website infrastructure, including the Nomad cluster, for a fraction of the cost of running a basic three-node Kubernetes cluster … Wasm modules are a fraction of a size of container images. They start and execute within milliseconds. In our own testing, we saw response times at 30-45ms.” HashiCorp’s Nomad is a scheduler that Fermyon uses to schedule Spin applications across a cluster.

Despite the energy being put into server-side Wasm, there are plenty of gaps today, not least in things like mature MySQL drivers. Another important piece yet to arrive is the WebAssembly Component Model which will improve communication between Wasm modules, even when compiled using different languages, so they can be composed together.

JetBrains developer advocate Khalid Abuhakmeh, writing earlier this month about the future of .NET and Wasm, said that “we could see Wasm replace most instances of containerization, especially when Wasm can package both runtimes and the applications that depend on them in one portable package. Advantages you could hope to see: Reduced CPU and memory usage, decreased cold-boot times, reduced hosting bills, and more significant economies of scale.”

The Wasm technology has also been taken up with enthusiasm by companies hosting web applications, such as Cloudflare and Vercel, since lightweight Wasm functions are ideal for running at edge locations in order to reduce latency for users.

A snag with Wasm is that the security boundaries are by default weaker than with containers or virtual machines. At its re:Invent conference, AWS told us that “all customer multi-tenancy isolation is done through virtual machines” and that it therefore has limited interest in lightweight runtimes.

Nevertheless, the progress of WebAssembly as a lightweight multi-language runtime will be a technology to watch in 2023.