Beyond the Browser - WebAssemly 2020 Review

WebAssembly (WASM), initiated by W3C's Mozilla, Google, Microsoft, Apple etc., is a high-performance execution engine for applications in the browser. It has been widely supported in mainstream browsers such as Chrome, Firefox, Edge, and Safari.

But as WASM gains more popularity in the developer community, WASM is also becoming a cutting-edge on the server and cloud computing platforms.

In December 2019, the Bytecode Alliance was officially established. The main goal of the establishment of this alliance is to improve the ecology of WebAssembly outside of the browser through the collaborative implementation of standards and the proposal of new standards. WebAssembly on the server-side was recognized and placed with great importance.

WebAssembly's 2020 started with the WebAssembly Summit held at Google's headquarters at the beginning of the year. WebAssembly Summit was the first large-scale offline meeting of the WASM community. Developers interested in WebAssembly flew from all over the world to gather in Mountain View. Although this conference was only one day, it covered many topics, including the development of Wasm in the browser and server. This is also one of the last international technical conferences before the epidemic.

To use WebAssembly on the server-side, we must adapt it to the computing environment outside the browser. Languages, libraries, and toolchains are the key to success.

Language, library, and toolchain

Compared with 2019, WebAssembly supported these new languages in 2020! The following languages can all be compiled into WASM bytecode and run on a browser or WebAssembly virtual machine.

With the help of the LLVM toolchain, we can compile libraries written in multiple languages into WebAssembly, and then run them in the browser:

  • TensorFlow.js. The official TensorFlow team has implemented the use of SIMD and multithreading in WebAssembly to enhance TensorFlow.js.

  • FFMPEG. This is a well-known library for processing audio and video. With the efforts of the developer Jerome Wu, FFMPEG written in C was exported to the WebAssembly format so that FFMPEG can run in the browser.

The above are two well-known libraries. In 2020, we saw some classic games that can be run directly in the browser with WebAssembly.

Thanks to these high-performance C language libraries, we have seen some prominent companies' web applications adopting WASM in the browser, mainly in the audio and video fields

Mozilla's change

Fast forward to August, Mozilla announced 250 layoffs of staff. One of the more affected teams was the WebAssembly team, including the developers for Cranelift and WASI. And WASI is the most important specification for server-side WebAssembly. For a time, the future of WebAssembly is faced with uncertainties.

Bytecode Alliance's work

After a year of development, with Bytecode Alliance, there is no change in the members: no additions and no deletions. But there has been significant progress on the WebAssembly specification. Its member company Fastly hired the WebAssembly team laid off by Mozilla and has made contributions to the stabilizing and development of the ecosystem.

The Bytecode Alliance is mainly innovating around nanoprocess: WebAssembly has evolved from a "compilation target" for applications to a "modular ecosystem" that can be used to organize applications.

The first one is WASI, which is a system interface for the WebAssembly platform. In 2020, we saw more WASM implementations supporting WASI, and supporting WASI seems to have become a must.

The second is Module Linking, a way for two Wasm modules to communicate directly with each other.

Then there is Interface Types, which enables Wasm to "communicate with a various set of value types."

To achieve this series of goals, the Bytecode Alliance will also develop a series of Wasm-tools.

  • wasmparser. This is a Wasm file parser. It saves memory resources efficiently, because it doesn't perform any additional resource allocation and can be parsed by "stream loading";

  • wasmprinter. This tool can convert a Wasm binary format file ending in .wasm to the corresponding .wat text format, which will be very helpful for debugging and testing;

  • Wat & wast, these two tools can convert Wasm text format codes ending in .wat and .wast into corresponding binary format bytecodes, which is useful for running test cases (because in text format, test cases maintainence will be more convenient);

  • wasm-smith. This is a test case generator. It can generate "pseudo-random" Wasm modules, and ensure that these Wasm modules are legal and valid, and can be used for fuzz testing.

E-commerce platform Shopify has built a function service based on WebAssembly, allowing the seller users with Shopify to build an e-commerce website to upload their own function code on the Shopify platform based on their business needs. The Shopify team chose WebAssembly because WebAssembly is safe and will not write external malicious code; it is also high-performance and can meet e-commerce requirements for operating speed.

The same model has been tried on other SaaS platforms, such as image processing service provider Cloudinary and streaming data processing provider YoMo.

Beyond Bytecode Alliance

Simultaneously, the WASM virtual machine teams outside of the Bytecode Alliance are also contributing to the community in their own way.

Wamser released version 1.0.0 at the end of 2020. It is the first WASM virtual machine that released its 1.0.0 version. Wasmer supports compiling multiple languages into wasm bytecode, and it can run on Mac, Linux, and Windows. Wasmer also supports multiple compilers, Cranelift, LLVM, and Singlepass compiled into smart contracts.

SSVM's contribution to WebAssembly lies in the wasi-like extension. The WASI specification provides a mechanism for developers to effectively and safely extend the WebAssembly virtual machine. Towards different use cases, SSVM has made extensions such as TensorflowStorageCommand InterfaceEthereumSubstrate Tensorflow, storage, command interface, Ethereum, and Substrate.

In addition to general cloud computing and edge computing, WebAssembly virtual machines have been extensively adopted in the blockchain. At present, the leading public blockchain projects on the market all use the WebAssembly virtual machine as the execution engine of smart contracts, such as Polkadot's wasmi virtual machine, Cosmos' cosmos-wasm, EOS, Ethereum, Oasis Labs, Solana, Near, ParaState, and other public blockchains.

Community Activities

In 2020, in addition to the first Wasm Summit, we also saw many other WebAssembly meetups, such as WebAssembly Live.

In early 2021, the Linux Foundation will hold Cloud-Native Wasm Day, which may be seen as a signal that server-side WebAssembly is to be recognized by the broader developer community. Meanwhile, WebAssembly Summit 2021 has also set a date. 

Although WebAssembly's 2020 is full of twists and turns, WebAssembly's 2021 is full of hope.

References:


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 via contact at webassembly dot today. Thanks!

Until then, stay safe, stay healthy! 😷