WebAssembly — The future of backend development

Duy NG
ekino-france
Published in
6 min readAug 9, 2024

The 2023 WebAssembly Status Report: WebAssembly is a hot topic!

If you’re not familiar, WebAssembly (Wasm) is a binary instruction format for a stack-based virtual machine. Wasm is designed as a portable compilation target for different programming languages, enabling deployment on the web for client and server applications.

According to the 2023 WebAssembly survey from blog.scottlogic.com , more people are expressing interest in using WebAssembly for backend development. It’s the third most popular use for WebAssembly, following web and plugin development.

The trend of Wasm (source: blog.scottlogic.com)
The trend of Wasm (source: blog.scottlogic.com)

We are noticing that more and more areas are adopting WebAssembly, including those working on backend systems.

Benefits of WebAssembly

What makes WebAssembly a good choice for backend development?

  • It works everywhere, all the time: WebAssembly code can run on various systems without needing modification. This means you don’t have to write different code for different platforms. This makes development and deployment easier, saving you time and resources.
  • Quick and safe performance: WebAssembly runs code at near-native speed, almost as fast as the computer’s own processing. It’s also It’s also designed to be very secure, protecting important data and preventing issues.
  • Choose your favorite programming language: With WebAssembly, you can use the programming language that best suits you and your team best. Whether you prefer Rust, Go, Python, or JavaScript, WebAssembly supports a wide range of languages. This flexibility allows you what you’re most comfortable to work with and helps developers with different skills work together.
  • Reuse existing code: WebAssembly doesn’t mind if your code was made in another language before. You can still use it in your new projects, which saves you time and effort.
  • Choose the best tool for each task: WebAssembly allows you to select the most suitable tools that are best for each part of your project. Whether you need Rust libraries or Python’s tools for AI and data analysis, you can use what you need without worrying about compatibility issues.

These advantages are made possible to the proposed “Component Model”. The WebAssembly Component Model outlines how various WebAssembly modules, or components, can communicate with each other and the host system they are running on. It establishes specific rules to ensure that code compiled into a WebAssembly component can operate on any compatible computer and share data with other WebAssembly components smoothly.

Industry success stories

Let’s look at how a few companies are already using Wasm and benefiting its advantages:

The BBC’s R&D team utilized WebAssembly to deliver personalized content through Object-Based Media (OBM). They developed a WebAssembly-based system that enabled them to run a secure and advanced media application written in C++, enhancing the way users interact with the content.

Process Single Service Player at BBC (source: medium.com)

Disney+ need to make their streaming service compatible with a wide range of devices requiring highly flexible software. They found a solution in WebAssembly, utilizing the Rust programming language. This approach enabled Disney+ to function on older devices with MIPS technology, as well as newer ones with x64 processors and graphics processing units (GPUs).

The Disney+ Application Development Kit components (source: medium.com)

Amazon Prime Video utilized WebAssembly to ensure their service runs smoothly and efficiently on over 8,000 different devices. By leveraging WebAssembly, they can easily combine C++, Rust, and JavaScript on these devices. This enhacement made the service faster and easier to update, providing millions of users a smooth streaming experience.

The architecture of Prime video app with WebAssembly (source: amazon.science)

NGINX Unit, a universal web app server,, has added support for WebAssembly, enhancing its capabilities. WebAssembly’s quick start-up, efficient use of programming languages, and isolated environments for each application make it an ideal choice for building complex applications and functions. Nginx now offers a software development kit (SDK) for Rust and C++. The Unit-Wasm SDK simplifies the process of creating web applications and APIs that can be compiled into WebAssembly and run on NGINX Unit.

The flow of Http request (source nginx.com)

In the above section, I highlighted examples of well-known companies that have done very well using WebAssembly. But there are many other ways it can be used. We would love to hear any more thoughts or ideas you have about this subject.

Now, let’s talk about what’s coming next for WebAssembly.

What’s coming next for WebAssembly

The WebAssembly revolution is just beginning, and there are lots of cool improvements planned. Both WebAssembly and the WebAssembly System Interface (WASI) are always changing, with new features being added through a standard phase 5 of proposal process. WASI is a sets of APIs being developed on for eventual standardization by the WASI Subgroup, which is part of the WebAssembly Community Group.

As for what people want most from WebAssembly, here’s a look at the most popular requests:

Most desired WebAssembly features (source: blog.scottlogic.com)
  • Threads, garbage collection and exception handling are at implementation (phase 3) or standardisation (phase 4) in the proposal lifecycle. This means they are available for use and are nearly complete.
  • The component model is a newer proposal (phase 1) that aims to simplify the combination of WebAssembly modules, written in any language, during runtime. If you want to learn more, I suggest watching a video by Luke Wagner, who is in charge of this proposal.
  • WASI preview 2 has already been released. This major update opens up new possibilities for server-side Wasm, including IO, networking support…etc.
Most anticipated WASI features (source: cncf.io)
  • Debugging, profiling, and build tools specifically designed for Wasm backend development are constantly evolving. We can look forward to a more seamless and effective development experience in the future.

Debugging, profiling:

  • Integrated IDE suppor: Leading IDEs like Visual Studio Code and IntelliJ IDEA are adding features for debugging and profiling Wasm. This means you can expect better breakpoints, source maps, performance analysis directly in your favorite coding environment.
  • Web based debuggers: Tools like Chrome, FireFox, Safari, Edge DevTools are becoming more powerful and user friendly, offering remote debugging capabilities for both browser and server side Wasm environments.

Building tools:

  • Wasm-pack: Rust-based toolchain for building, testing, and publishing wasm modules, providing a user-friendly interface and integration with Rust’s development ecosystem.
  • Jco: Native Javascript WebAssembly tool chain and runtime: Jco 1.0 has been released
  • Emscripten: Compiler from Emscripten that can convert C/C++ code to wasm.
  • AssemblyScript: TypeScript-like language that compiles to efficient wasm.

Summary

WebAssembly is a revolutionary tool for developers, offering the potential to improve application development through better speed, safety, and adaptability. Although this article concentrates on server-side development, WebAssembly has already made a big impact in web browsers, where it’s now officially recognized as the fourth language for the web. Additionally, its benefits go beyond the web and can be applied to many areas like plugins, IoT, AI, gaming, audio/video processing, encryption, and blockchain. I believe WebAssembly will grow in popularity and usage soon, as it provides advantages that work well with various technologies.

Thank you for reading up to this point. If you’re interested in learning more about WebAssembly, there are several other informative articles on this topic:

--

--