Michael Yuan, WasmEdge Maintainer

In July 2021, the Association for Computing Machinery Programming Languages Special Interest Group awarded WebAssembly its prestigious Programming Language Software Award, Highly commended WebAssembly as “the first new language to be widely adopted in Web browsers since JavaScript.” This year also marks the explosive growth of WebAssembly beyond Web browsers, especially on the server side and in cloud native environments.

By 2021, the Cloud Native Computing Foundation has officially accepted at least three WebAssembly projects, including WasmEdge Runtime, a cloud-native WebAssembly Runtime; WasmCloud, a WebAssembly application framework; Krustlet, a tool for running WebAssembly programs in Kubernetes Pods. At the same time, many existing CNCF projects are starting to adopt WebAssembly.

Due to the growing interest in WebAssembly in the CloudNative community, KubeCon+CloudNative Vecon hosted a dedicated CloudNative Wasm Day in Los Angeles in October. More than 300 developers signed up and paid to attend the one-day event. I was a member of the planning committee and personally attended the event.

The event began with keynote speeches by Ralph Squillace of Microsoft Azure and Liam Randall of Cosmonic. Squillace and Randall are both cloud veterans. Their keynote discussed the evolution of cloud computing architectures and provided background to the rise of WebAssembly as a cloud native Runtime.

WebAssembly is a lightweight, fast, secure and multilingual “container” of functions. WebAssembly brings the cloud-native programming model pioneered by Kubernetes and Docker to the realm of edge computing and microservices from large data centers.

It was clear from the conference that cloud-native WebAssembly applications have been adopted by enterprises of all sizes. With the advent of applications, we also see a thriving ecosystem of frameworks, tools, and runtime.

Kubernetes

Since Kubernetes has become the de facto “control panel” for all cloud native applications, WebAssembly must be supported by Kubernetes to be truly adopted. Server-side cloud-native WebAssembly not only needs WASI to access operating system functions, but also needs to integrate with Kubernetes. We need to run the WebAssembly workload side by side with other containers (such as Containerd, Docker, and Cri-O) in a Kubernetes cluster. At this conference, we see two leading approaches.

The Krustlet project runs the WebAssembly project from Kubernetes Pod. At Wasm Day, we saw several demos using Krustlet. Meanwhile, Microsoft Azure AKS announced a WebAssembly service based on Krustlet during the conference.

WasmEdge’s Crunw project is another approach. It is a direct substitute for Kubernetes container Runtime such as Runc and Crun. Crunw Runtime can automatically detect whether container images are used for WasmEdge or Containerd /Docker, and then start and manage the corresponding Runtime/container. It makes WebAssembly programs first-class citizens in the Kubernetes cluster.

WebAssembly programs are not just workloads managed and controlled by Kubernetes. They can also extend Kubernetes itself. Rafael Fernandez Lopez of SUSE told us about the Kubewarden project, which provides Kubernetes with a WebAssembly-based policy engine.

Application framework

The application framework is built on top of Kubernetes to provide common services for applications. A good example is Dapr, created by Microsoft and soon to be a CNCF incubator program (Dapr was already a CNCF incubator program at the time of translation). Dapr leverages the SidecAR pattern to provide common services for microservice applications attached to these SidecArs, such as service discovery and invocation, elastic retry, logging and tracing, monitoring, secret storage, connection security, and so on. These Sidecar applications (microservices) can be managed by Kubernetes. Dapr now supports WebAssembly-based Sidecar applications.

The wasmCloud project is an Actor-based application framework designed specifically for WebAssembly. Stuart Harris and Aayush Attri from Red Badger explain how they implement large applications within European banks using the wasmCloud cluster managed by Kubernetes.

The service grid is built on top of the application framework. They provide additional capabilities, such as traffic routing and splitting through proxies. Envoy Proxy is an early adopter of WebAssembly-based service grid extensions. Ant Financial’s MOSN is a service grid that can manage large clusters of more than 200,000 servers.

Jason Song from the MOSN team gave a lightning talk on running WebAssembly functions in a service grid instead of a traditional container. MOSN proxies support the proxy-WASM specification as an extension mechanism. MOSN’s Sidecar framework, called Layotto, supports microservices written in WebAssembly. Jason demonstrated live how to use Kubernetes to deploy and manage WebAssembly functions in MOSN and Layotto in e-commerce applications.

Embedded functions in SaaS

So far, we’ve looked at WebAssembly in a cloud native infrastructure. What about business logic applications? WebAssembly makes it easy for business applications to support third-party plug-ins or extensions. Centrally hosted cloud-native applications, such as SaaS, can use WebAssembly Runtime to safely and efficiently perform any user-submitted code functionality.

Connor Hicks of Suborbital explains very clearly why responsive embedded functions are better suited for extending and customizing SaaS than traditional Webhooks or “native integration” (i.e., custom templates). Suborbital is an application framework that makes it easy to embed WebAssembly functions into SaaS.

Shopify is a pioneer in extending and customizing relevant SaaS using embedded WebAssembly functions. It’s clear that developers really want to write these functions in JavaScript rather than Rust or C/C++. Saul Cabrera of Shopify spoke on how to run and optimize JavaScript programs on WebAssembly.

In this category, we see WebAssembly RunTimes such as WasmEdge, which supports advanced JavaScript features such as ES6 modules, Async networking, and Rust/JavaScript interactions.

Bailey Hayes and Carl Sverre talked about how SingleStore uses WebAssembly to perform user-defined functions embedded into a cloud database. It allows data storage and computing to remain tightly linked and improve efficiency. In their presentation, the team demonstrated how to perform real-time sentiment analysis using AI models on large data sets.

As an early adopter, the team also participated in the standardization effort, coming up with the WASI-Data specification to support a standard two-way communication protocol between databases and WebAssembly Runtime.

AI and Internet of Things

As Liam Randall discussed in his keynote, the greatest adoption opportunities for WebAssembly are likely to be on the edge, on edge networks and edge devices.

Dan Mihai Dumitriu describes how Midokura, SONY’s Iot applications division, is deploying WebAssembly applications on sensor devices. WebAssembly’s small footprint and high performance enable it to run as a secure sandbox for user applications on small devices. Kate Goldenring from Microsoft and Rodrigo Farias Rodrigues Lemos from the Federal University of Pernambuco demonstrated Akri, a WebAssembly application running Krustlet, Used to discover iot devices and provide them as resources to a Kubernetes cluster.

In fact, CNCF now has at least 3 “K8s on the edge” projects KubeEdge, SuperEdge and OpenYurt. Together with the aforementioned K8s, the future of WebAssembly on iot devices looks promising.

An important application on edge networks today is AI reasoning. WebAssembly RunTimes, which is light and fast, allows AI to reason closer to sensors and data sources on the edge. Two presentations at the conference were particularly relevant to AI reasoning.

Shivay Lamba from Layer5 and Mritunjay Sharma from Hackerrank talked about how to use WasmEdge’s Tensorflow and Tensorflow Lite API extensions for image recognition. Each image can be identified in milliseconds. The API is available to both Rust and JavaScript developers.

Radu Matei from Microsoft discussed the WASI-NN specification, which provides a standard API for incorporating any AI reasoning library into WebAssembly. The WasmEdge Tensorflow extension is being adapted for WASI-NN.

Ecological innovation

As WebAssembly applications grow, developers are stepping in to improve WebAssembly itself and related tools. There were two notable developments in WebAssembly ecology at the conference: Bindle and Grain.

Bindle provides a package management system for WebAssembly modules and artifacts. As we’ve seen with the success of NPM, Docker Hub, Go, and Rust Crate, package management fosters collaboration and enables developers to build on each other’s work. Matt Butcher from Microsoft Azure and Taylor Thomas from Cosmonic spoke on how Bindle was designed and how to use it. We look forward to more adoption of this important technology.

Grain is a WebAssembly first programming language. Statically typed and compiled programming languages make the most use of WebAssembly’s lightweight Runtime. However, statically typed languages such as Rust and C/C++ are not easy for beginners. Oscar Spencer from the Grain Project discusses how Grain is designed as an easy-to-use programming language that can be compiled into efficient WebAssembly bytecode. The project is still in its early days, but has great potential.

Looking to the future

2021 is the first year that cloud native Wasm applications take off. With WebAssembly being included in almost all of the leading cloud native projects, we can expect widespread deployment of WebAssembly applications to the cloud in the coming year. What are you waiting for?