Oct 04 2022

What Is WebAssembly (Wasm), and What Can It Do for You?

The binary code format started with the web browser, but WebAssembly is quickly working its way into the server room.

Not all emerging technologies take a front-facing role. But with the right momentum and right approach to implementation, a new innovation can encourage broad improvements to the digital landscape.

Such an innovation can help shift the discussion around speed, efficiency and agility, even if the technology itself isn’t front of mind for end users. The latest example is WebAssembly, a programming technology that started in the web browser but just might find a home in your cloud infrastructure.

What Is WebAssembly?

WebAssembly is a binary code format that allows code to be executed in a variety of formats, especially web pages, opening up new types of programming capabilities to web browsers.

Like earlier programming languages, such as JavaScript and Java, WebAssembly is built to work across a variety of platforms without any presumptions about the underlying machinery and operating system. Unlike those languages, WebAssembly also makes no presumptions about the underlying programming language, opening up room for general purpose programming languages like C++ and more modern languages such as Rust.

Click the banner below to receive exclusive cloud content when you register as an Insider.

The technology was introduced in 2015 as an extension of a previous software project called asm.js, according to Luke Wagner, a co-chair of the WebAssembly Working Group at the World Wide Web Consortium and an engineer at the content delivery network platform Fastly. He previously worked at the browser-maker Mozilla, where the technology was born.

“Our goal was to try to specify the smallest minimum viable product,” he explains. He notes that the nature of the concept could have forced a high level of complexity, but keeping the approach minimal enabled the project’s initial release just two years after it was announced. WebAssembly has been natively supported in all major web browsers since late 2017.

How Does WebAssembly Work?

In many ways, WebAssembly is comparable to containerization, in which applications run in an enclosed area, separate from the rest of the infrastructure.

Inside a virtual machine, the code can be executed away from the rest of the machine, offering some security benefits to users because it prevents code from directly touching the system. Unlike container technologies such as Kubernetes and Docker, however, it does not require an additional subsystem and allows the code to be executed across platforms.

“It’s a lot smaller than a container, and it’s a lot more portable than a container,” Wagner says.

He says that the code tries to replicate the fast speeds of running code natively on the CPU while still allowing high levels of security. While this approach bars running CPU-specific code as seen with x86 processors or Apple silicon, it does enable faster execution speeds across platforms.

DISCOVER: What your small business should know about app modernization.

“What we tried to ask is, how can we allow you to achieve the same performance in WebAssembly as you would if you directly generated CPU code?” Wagner says. “Now, in a browser, you’re not allowed to generate CPU code directly because it could break the sandbox and exploit everyone, so we have to stay within the sandbox.”

The WebAssembly community, he adds, is looking to replicate key features of many execution environments, such as garbage collection. There’s also a focus on improving integration with web browsers so that the final result feels native and properly interacts with the page’s document object model.

Another comparison point to WebAssembly might be the web browser plugin such as Adobe Flash or Oracle’s Java, but with more secure mechanisms that prevent the executable from breaking out of its shell. Additionally, since it is based on open standards, many companies can contribute, which will help ensure you can get the benefits of it no matter which browser or application tools you use.

“It was designed from the beginning to be embeddable in a bigger system,” Wagner says. “It’s not assuming a lot about the surrounding environment.”

The environment-neutral approach gives the technology a potential use case as back-end infrastructure in the enterprise, according to Daniel Lopez, who works on WebAssembly solutions for VMware’s Office of the CTO.

“The part that excites me and that really is relevant to VMware is that a lot of the characteristics that make WebAssembly interesting in the browser and successful in the browser translate really well to the back end — in particular, around the edge where you have a lot of constrained pieces that also have really high security requirements,” says Lopez, a founder of the VMware-owned package management platform Bitnami.

WATCH: Learn how to build a dynamic infrastructure that optimizes the user experience.

WebAssembly Use Cases: Increased Ambitions on the Front End

The technology for WebAssembly was originally designed to be used in web browsers, which means that many of the benefits of it have been leveraged through web-based experiences.

This creates opportunities to run high-quality applications akin to desktop experiences through a web browser alone. One famous example is a buzzworthy web-native version of Adobe Photoshop that was announced last year. In a blog post from last fall, Google product manager Thomas Nattestad and Adobe principal scientist Nabeel Al-Shamma suggest that the possibility of running Photoshop in a browser shows how advanced web browsers have really become.

“We’ve seen impressive co-development where web apps push the boundaries of what’s possible, and browser vendors respond by further expanding web capabilities,” they write. “The latest iteration of this virtuous loop is what has enabled Photoshop on the web.”

Adobe is not alone. Firms such as Autodesk have also brought desktop-level apps like AutoCAD to the web browser, making it possible to access the software’s capabilities in even lighter-weight settings, such as on a Chromebook.

And high-flying web apps that previously pushed the edge, like Google Earth, have furthered their capabilities and browser support using WebAssembly.

Daniel Lopez
A lot of the characteristics that make WebAssembly interesting in the browser and successful in the browser translate really well to the back end.”

Daniel Lopez Senior Director, VMware

WebAssembly Use Cases: How WASI Enables the Back End

While the front-end growth of WebAssembly has been impressive, the real excitement might be in the infrastructure department, where the technology is still relatively new.

This use case has been enabled by the WebAssembly system interface, a technology introduced in 2019 that builds a conduit between the executable and the systems it’s running on. Like WebAssembly, the WASI technology is designed to be platform-independent. This means it can help execute code efficiently and limit the risks of untrusted code being used within the ecosystem. While not as fast as running code on bare metal, it gains additional security benefits as a result.

“It turns out a lot of people even outside of browsers have the same kind of sandboxing desires as browsers do,” Wagner says.

Helping forge the path is the Bytecode Alliance, which aims to build stronger standards around WebAssembly’s use in infrastructure in particular. A number of major tech companies, including Amazon, Intel and Microsoft, have already joined. VMware, a new member of alliance, has long been interested in the benefits of WebAssembly and wants to build more of its technology around the format in the coming years, Lopez says.

He argues that WebAssembly has advantages over traditional virtual machines, which can be heavy, and Docker-style containerization, which comes with more security risks. WebAssembly offers the benefits of both approaches and then some, he says.

RELATED: Find out what your organization should know about Infrastructure as Code.

“WebAssembly has the promise — it’s not there yet, but it’s going to get there — to have a strong isolation, a VM-like isolation level, but with the agility of a lighter footprint, even lighter than containers,” Lopez says. 

With inherent compatibility with Infrastructure as Code, the flexibility of WebAssembly and WASI could help ease future cloud deployments by removing unnecessary layers of infrastructure.

What Companies Are Leveraging WebAssembly?

WebAssembly is still relatively new, but it offers a lot of opportunity to optimize code in a medium — the web browser — that often struggles to efficiently use computing resources.

As a result, it is already being used in areas that allow browsers to execute code in a near-native format and has found a few high-profile use cases. Beyond the Photoshop and Google Earth examples, the popular streaming service Disney+ uses WebAssembly on its front end, enabling developers to use the high-performance Rust programming language.

It’s also being supported in popular development tools. Microsoft integrated WebAssembly into Blazor, a web framework supported by Visual Studio that lets developers build web apps using the Microsoft-developed C# language.

READ MORE: Learn how to prepare your network to implement AI apps.

How WebAssembly Improves End-User Experiences

In many ways, WebAssembly will impact organizations from higher up the food chain, being used to build stronger infrastructure pieces on the back end while giving the front end a way to more effectively execute commands on the local machine.

Lopez says that for many organizations that aren’t focused on infrastructure-based businesses, it is definitely early days. “If you’re a developer, it is not there yet,” he says.

Nonetheless, WebAssembly’s impact will be felt by the developers whose applications your company uses, and those benefits will mean faster applications and safer infrastructure in the end. One potential solution that WebAssembly could enable outside of the web browser and server room? Support for embedded systems, such as those in Internet of Things devices, where the additional security could limit headaches later in the device’s life.

“The hope is for using this component model to find this fundamental future of software where you have more small, fine-grained composable units that can be plugged together to build lots of things,” Wagner says.

It’s a future that might run through your infrastructure without you even realizing it.

Getty Images/ gorodenkoff

aaa 1

Register