Where is cloud-native WebAssembly now?

作者:Michael Yuan,WasmEdge Maintainer

In July 2021, the Association for Computing Machinery's Special Interest Group on Programming Languages ​​awarded its prestigious Programming Language Software Award to WebAssembly, highly affirming WebAssembly as "the first widely used web browser since JavaScript" New Language Adopted" achievement. And this year also marked the explosive growth of WebAssembly outside the web browser, especially in server-side and cloud-native environments.

As of 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; and Krustlet , a tool for running WebAssembly programs in Kubernetes pods . At the same time, many existing CNCF projects started adopting WebAssembly.

Due to the growing interest in WebAssembly in the cloud native community, KubeCon + CloudNativeCon hosted a dedicated Cloud Native Wasm Day event in Los Angeles in October . Over 300 developers registered and paid for the one-day event. I (referring to the author) was a member of the planning committee for the event and attended the event myself.

The event kicked off with keynotes by Ralph Squillace of Microsoft Azure and Liam Randall of Cosmonic . Squillace and Randall are both cloud computing veterans. Their keynote discussed the evolution of cloud computing architectures and provided background on the rise of WebAssembly as a cloud-native runtime.

WebAssembly is a lightweight, fast, safe, and polyglot "container" of functions. WebAssembly will bring the cloud-native programming model pioneered by Kubernetes and Docker into edge computing and microservices from large data centers.

From this conference, it is clear that cloud-native WebAssembly applications have been adopted by enterprises of all sizes. With the advent of applications, we have also seen a thriving ecosystem of frameworks, tools and runtimes.

Governors

Since Kubernetes has become the de facto "control plane" for all cloud-native applications, WebAssembly must be supported by Kubernetes for it to be truly adopted. Cloud-native WebAssembly on the server side requires not only WASI access to operating system functions, but also integration with Kubernetes. We need to run WebAssembly workloads side-by-side with other containers such as containerd, Docker, and cri-o in a Kubernetes cluster. At this conference, we saw two leading approaches.

The Krustlet project runs WebAssembly projects from Kubernetes pods. At Wasm day, we saw several demos using krustlet. Meanwhile, Microsoft Azure AKS announced a krustlet-based WebAssembly service during the conference.

WasmEdge 's crunw project is another approach. It is a drop-in replacement for Kubernetes container runtimes such as runc and crun. The crunw runtime can automatically detect whether the container image is for WasmEdge or containerd/Docker, and then start and manage the corresponding runtime/container. It makes WebAssembly programs first-class citizens in a Kubernetes cluster.

WebAssembly programs are not just workloads managed and controlled by Kubernetes. They can also extend Kubernetes itself. Rafael Fernández López of SUSE introduced us to the Kubewarden project, which provides a WebAssembly-based policy engine for Kubernetes.

application framework

The application framework is built on top of Kubernetes and provides common services for applications. A good example is Dapr , created by Microsoft and soon to be a CNCF incubation project (Dapr was already a CNCF incubation project at the time of this 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 more. 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 implemented a large application inside a European bank using a wasmCloud cluster managed by Kubernetes.

A service mesh is built on top of an application framework. They provide additional functionality such as traffic routing and splitting through proxies. Envoy Proxy is an early adopter of WebAssembly-based service mesh extensions . Ant Financial's MOSN is a service mesh that manages large clusters of over 200,000 servers.

Jason Song from the MOSN team gave a lightning talk at the conference on running WebAssembly functions in a service mesh instead of traditional containers. MOSN's proxies support the proxy-wasm specification as an extension mechanism. MOSN's sidecar framework, called Layotto , supports microservices written in WebAssembly. Jason demonstrated how to use Kubernetes to deploy and manage WebAssembly functions in e-commerce applications in MOSN and Layotto.

Embedded functions in SaaS

So far, we have seen the application of WebAssembly in cloud-native infrastructure. What about business logic applications? WebAssembly makes it easy for business applications to support third-party plugins or extensions. Centrally hosted cloud-native applications (such as SaaS) can use the WebAssembly runtime to safely and efficiently execute any user-submitted code function.

Suborbital 's Connor Hicks explains very clearly why reactive embedded functions are better for extending and customizing SaaS than traditional webhooks or "native integrations" (ie 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 related SaaS using embedded WebAssembly functions. Obviously, developers really want to write these functions in JavaScript rather than Rust or C/C++. Shopify's Saúl Cabrera gave a talk on how to run and optimize JavaScript programs on WebAssembly.

In this category, we see WebAssembly runtimes such as WasmEdge, which support advanced JavaScript features such as ES6 modules , async networking , and Rust/JavaScript interactions.

Bailey Hayes and Carl Sverre talk about how SingleStore uses WebAssembly to execute user-defined functions embedded in cloud databases. It allows data storage and computation to stay closely linked and increase efficiency. In their talk, the team showed how to perform real-time sentiment analysis using AI models on large datasets.

As an early adopter, the team also participated in standardization efforts, proposing the WASI-data specification to support a standard bidirectional communication protocol between the database and the WebAssembly runtime.

AI and IoT

As Liam Randall discussed in his keynote, the biggest opportunity for WebAssembly is likely to be at the edge, on edge networks and edge devices.

Dan Mihai Dumitriu describes how Midokura, Sony's IoT applications division, deploys 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 Federal University of Pernambuco present Akri , a WebAssembly application running Krustlet for discovering IoT devices and making them available 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 K8s integration just mentioned, the future of WebAssembly on IoT devices is promising.

An important application on edge networks today is AI inference. Lightweight and fast WebAssembly runtimes bring AI inference computations closer to sensors and data sources at the edge. There were two presentations at the conference that were particularly relevant to AI inference.

Shivay Lamba from Layer5 and Mritunjay Sharma from Hackerrank show how to use WasmEdge's Tensorflow and Tensorflow Lite API extensions for image recognition, which can recognize each image in milliseconds. The API is available to both Rust and JavaScript developers.

Radu Matei from Microsoft discusses the WASI-NN specification, which provides a standard API to incorporate any AI inference library into WebAssembly. The WasmEdge Tensorflow extension is being adapted to work with WASI-NN.

Ecological innovation

As WebAssembly adoption grows, developers are getting involved in improving WebAssembly itself and related tools. There were two notable developments in the WebAssembly ecosystem at the conference: Bindle and Grain .

Bindle provides a package management system for WebAssembly modules and artifacts. As we've seen from 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 gave presentations on how Bindle was designed and how it is used. We expect greater adoption of this important technology.

Grain is a WebAssembly-first programming language. Statically typed and compiled programming languages ​​make the most efficient use of WebAssembly's lightweight runtime. However, statically typed languages ​​like 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 compiles to efficient WebAssembly bytecode. It's still early days for this project, but it has a lot of potential.

Looking to the future

2021 is the first year for cloud-native Wasm applications to take off. With WebAssembly incorporated into nearly all leading cloud-native projects, we could see WebAssembly applications generally deployed on the cloud in the coming year. What are you waiting for?

{{o.name}}
{{m.name}}

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=324031523&siteId=291194637