Play-Doh may be a favorite toy from your past, but its creators never set out with the goal of making a toy. It was originally marketed as a tool for cleaning your wallpaper before it found its way into the toy aisle.
Many other inventions started off aiming to solve one problem only to find themselves becoming known for an entirely different use case. And WebAssembly, or wasm, may be on a similar path.
WebAssembly is a bytecode format that code can compile to and it enables different programming languages to run in the browser, explained Liam Randall, CEO of Cosmonic, which is a WebAssembly PaaS.
“WebAssembly has huge implications for the web platform — it provides a way to run code written in multiple languages on the web at near native speed, with client apps running on the web that previously couldn’t have done so,” the Mozilla WebAssembly documentation states.
Beyond the browser, people have been using it with great success in the cloud, containers, and the edge.
WebAssembly is polyglot, portable, and interoperable. Because of these capabilities, developers can pick and choose from applications written in a variety of languages.
“Just like an electrical outlet, which enables you to turn on a light without knowing where the power comes from, contracts will deliver what they say they’ll deliver. Look for GitHub to be used to distribute libraries as WebAssembly LEGO, where developers select contracts to pull and maintain large pieces of code that can run in any cloud, and any edge environment,” said Randall.
This LEGO concept works also to enable contributions from users. For example, there are many places where someone might want to add something to an existing application as a plugin. A company like Shopify or a game like Microsoft Flight Simulator might want to allow users to submit code to customize their experience. According to Randall, this is exactly what people are doing with WebAssembly.
WebAssembly also offers a new strategy for protecting against supply chain attacks. Since it virtualizes binary formats and libraries, there isn’t a need to be constantly updating vulnerable components, Randall explained.
Randall believes that in cloud environments WebAssembly can be really powerful because most of today’s business logic is on the server side, running in public clouds and in data centers.
“The ability for us to put applications that run or to create applications that can seamlessly run anywhere across that spectrum, is really powerful,” Randall explained.
Adobe’s WebAssembly success story
For example, Adobe Photoshop’s codebase was started in the ’80s, but it was able to be recompiled to run right in the web browser using WebAssembly.
“As Wasm has standardized with features such as threads, and developer tooling for Wasm has improved, we have continued this journey to the web, culminating in our new web-based Photoshop experience. Wasm allows us to keep the same core C++ code base – compiled to the desktop, mobile and browser,” Sean Isom, engineering manager at Adobe, and Colin Murphy, senior engineer at Adobe, wrote in a blog post.
Isom was on a mission to improve the efficiency and performance of the company’s infrastructure, while lowering costs. The company runs 90% of its containers in Kubernetes, and recently he shared details about how they were able to combine Kubernetes with WebAssembly.
Some of the use cases Adobe has achieved includes running existing functions in wasmCloud and running wasmCloud as a service in Kubernetes clusters.
WasmCloud is an open-source project for building distributed applications using WebAssembly that is currently housed under the Cloud Native Computing Foundation as a sandbox project. The project was a big focus at this year’s KubeCon NA, where Cloud Native Wasm Day took place to offer up sessions on using WebAssembly in cloud-native use cases.
“I love WebAssembly,” Isom told SD Times in an interview. “It’s been a large lift and shift initially to get stuff working in this, but I have been working on developer experience tooling for years now. And I’ve seen us come so far in the past year, even just in the last few months, it’s becoming easier and easier. And I’m really excited to get this over the hump where it’s going to be a really repeatable thing that lots and lots and lots of the services that the teams can use in the coming years.”
WebAssembly causing quite the disruption in the ecosystem
Randall said that it is on the app platform side where WebAssembly is “poised to make the biggest disruption” because it is so small and fast. Containers, even highly optimized ones, can take a few seconds to start up, while WebAssembly offers applications a cold start time of less than a millisecond.
According to Randall, 200 milliseconds is the interactivity budget for users, meaning that if something doesn’t happen within that time frame the user will want to leave.
“So WebAssembly lets us scale all the way to zero, saving time, money, as well as allowing us to use our resources more efficiently,” said Randall. “And it can scale immediately to customer’s demands.”
“When we think about how logically containers really powered this great lift and shift into the cloud, but WebAssembly is poised to enable the buildout of complex capabilities across the distributed ecosystem of today,” Randall said.
In fact, in 2019 when the WebAssembly system interface WASI was announced, Docker creator Solomon Hykes tweeted: “If WASM+WASI existed in 2008, we wouldn’t have needed to have created Docker. That’s how important it is. WebAssembly on the server is the future of computing.”