WebAssembly Today #9
Updates & commentaries on WebAssembly related technologies, including Rust, serverless, cloud, blockchain, and AI. Focus on the server-side.
This week, we continue to see examples of WebAssembly’s rise on the server-side, and its role in the serverless infrastructure. In parallel, Rust sees more mainstream adoption from big companies and famous projects, such as Microsoft, Facebook, and perhaps even the Linux Kernel!
Learn Rust and get a Raspberry Pi for free. Check out this article for more information!
The SSVM 0.6.0 version supports WASI to access operating system resources in a controlled manner (ie “capability-based security”). In addition to WASI, the SSVM supports additional, albeit non-standard, WebAssembly extensions to safely access the host system — such as a storage interface for attached key/value storage, an AI inference interface for specialized hardware, and the Ethereum interface for a host blockchain.
In our previous newsletter, we discuss the idea of “portable C” as the safe universal binary, and the wasm2c toolkit that enables it. This week, we see an example of this in the real world!
Peter Salomonsen wrote an article to demonstrate how to compile WebAssembly modules into C, and then use it. His article comes with an example from the WebAssembly Music Project. It is very interesting.
This article elaborates there are three major approaches to the serverless FaaS infrastructure, of which is to use application-specific VMs, such as WebAssembly. This approach is emerging and provides a high level of abstraction. The WebAssembly VM can provide a high level "capability-based" security model for accessing system resources (e.g., through the WASI specification) instead of coarsely-grained operating-system-level isolations. WebAssembly on the server-side looks promising.
Moral of the story? It is hard to discuss performance in abstract settings. We must judge performance in actual application scenarios.
This article shows how to use Rust crates and server-side WebAssembly to do K-means clustering and visualization. Rust could allow developers to write high-performance machine learning functions, and WebAssembly/SSVM provides runtime safety, code portability, and manageability.
WebAssembly is a high-performance runtime for ML/AI applications (in the browser and on the server). In this article, the author describes how they build a WebAssembly runtime for a FaaS service specializing in ML models. The advantages of WebAssembly in ML FaaS include the following.
Ease of use
The WebAssembly model deployments are fast, compared with Docker Container
WebAssembly model deployment has a small memory footprint. WebAssembly model is much smaller than AVM.
The portability of WebAssembly models allows running them on servers, in browsers, or on the edge.
Safe and verifiable
WebAssembly binaries make A/B Test simple
FreeCodeCamp published an article on how to build a rich client application in browsers using WebAssembly, and then build a backend for the app using Azure serverless functions.
Firefox 78 includes a new RegExp evaluator, to meet ECMAScript 2018. It also brings enhanced support for WebAssembly.
In our previous newsletter, we covered the possibility for the Linux Kernel to adopt and support Rust. Since then, an email thread among the Linux core developers shed lights on how Rust could be supported. According to the summary from crabbytag on Reddit:
Nick Desaulniers asks "should we do this?" or "how might we place limits on where this can be used?"
Most people including Greg Koah-Hartmann are interested in attending the discussion
Josh Triplett, rustc developer - I'd be happy to have the Linux kernel feeding into Rust language development priorities. If building Rustic interfaces within the kernel requires some additional language features, we should see what enhancements to the language would best serve those requirements.
Linus Torvalds - I don't want us to be in the situation where any new rust support isn't even build-tested by default.
A 4k intro is to write an entire scene of a video simulation (including data) in 4096 bytes or less. The intro is written in a combination of Rust and glsl. Glsl is used for rendering a UI on-screen, while Rust does everything else, including world creation, camera and object control, creating instruments and playing music, etc. Check out the demo video!
Microsoft and Facebook released projects written in Rust 🚀
The Boardgame Lab team decided to switch the engine of Boardgame Lab from TypeScript to Rust. Their rationales are:
The Rust server is leaner. Rust uses less memory than Node.js under the same load.
Flake Growth, written in Rust, is a tool for simulating the growth of single-crystalline gold flakes from an initial single atom up to the micrometer scale (i.e. billions of atoms).
It also has a WebAssembly version compiled from Rust, which runs in the browser.
This InfoQ article covers a recent Serverless Day event. Serverless computing is growing from a “glue” for other cloud services into a full-stack application service in its own right, hence, the rise of the serverless architect.
Enjoyed reading this newsletter? Please subscribe to make sure that you do not miss a future issue. ❤️
This newsletter is a collaborative effort. Don’t forget to leave comments! Suggest topics or projects you would like to see we cover next week. Thanks!
Until then, stay safe, stay healthy! 😷