October 5, 2022

WebAssembly outside of the browser, but is it really production-ready? • DEVCLASS

The Bytecode Alliance, sponsor of the Wasmtime project, declared it fit for production with the release of version 1.0.

WebAssembly was invented to run code in the browser both securely and with near-native performance. Wasmtime uses the same concept outside of the browser, for example for server-side use in microservices or web applications. Other use cases include application plugins, user-defined functions for database managers, or client applications where portability and a sandboxed environment are desirable – reminiscent of old runtimes such as those for Java and .NET.

The Bytecode Alliance has around 30 member companies, including Amazon, Arm, Google, Intel, Microsoft, Mozilla, and VMWare.

Wasmtime language support is currently limited. Rust is the most supported language because it compiles to WebAssembly. Developers can also target WebAssembly with C/C++, with some limitations such as no C++ exception support and AssemblyScript, a language similar to TypeScript. Developers can also use the WebAssembly text (.wat) format. Various languages ​​support wasmtime integration, including Rust, C, Python, C#, Go, and Bash.

According to a Publish by Lin Clark, Senior Principal Engineer of Fastly, who works on Wasmtime, “we could have said Wasmtime was ready for production over a year ago.” Clark said the goal was to have Wasmtime running in production for an extended period, before declaring it finished.

Existing users include Shopify (as of July 2021) and Fastly, which uses Wasmtime to host Edge functions, custom services that run close to the user for low latency, and Embark, which uses Wasmtime in a game engine Microsoft uses Wasmtime in preview for WASI node pools in Azure Kubernetes Service. WAS I (WebAssembly System Interface) is a system interface for Wasmtime, allowing secure access to operating system features like the file system – although WASI is opposed by the AssemblyScript project which considers it harmful to the web platform.

The idea of ​​a secure, high-performance, cross-platform runtime is compelling, but is Wasmtime really production-ready? There are some quirks, such as JavaScript being missing from the list of supported languages, and limitations like the lack of multi-threading, although there is a Son proposal for WebAssembly. There are also ways to run JavaScript.

“Spidermonkey.wasm is the basis for Fastly’s JavaScript support on [email protected] We found it to be faster than QuickJS,” said a Wasmtime contributor on Hacker News.

Dig into Wasmtime though, and despite version 1.0, many sub-projects (like the .NET support) are still in preview. Windows support is also limited, thanks to the fact that WASI has only been partially implemented on Windows so far. The lack of integration with Java is another surprising omission.