WebAssembly on the server-side

Michael Yuan
Nov 23, 2019 · 5 min read

WebAssembly (Wasm), originally invented and developed by Mozilla, Google, Microsoft, Apple, and others at W3C; is a high-performance execution engine for in-browser web applications. As it gains popularity on the client-side, Wasm is also becoming a serious contender as a server-side technology.

Value propositions

Wasm’s move from client-side to server-side follows well-traveled paths of previous generations of technologies such as Java and JavaScript. Compared with existing solutions, Wasm offers some compelling value propositions on the server-side.

Compared with the JVM and JavaScript engines, Wasm supports 20+ programming languages via the LLVM toolchain, offering developers freedom and productivity. In particular, it supports new programming languages beloved by influential developers, such as Rust. At the same time, Wasm can easily support hardware features such as CPU, GPU, AI-optimized chips and even field-programmable gate array (FPGA) hardware circuits.

Wasm provides near-native performance without sacrificing safety.

Image Credit: https://steveklabnik.github.io/booster2018/

When compared with containers like Docker, Wasm provides a higher level of abstraction, and hence higher productivity, for developers. Wasm can deploy code and applications directly, instead of launching operating systems. In fact, Wasm applications can run without modification in any host environment. This plays well with today’s cloud-native microservices architecture.

Wasm consumes much less memory and resources than typical containers. In particular, its security model allows modular access to the underlying hardware and Operating System (OS), on a per-function call basis, ensuring safety while retaining native performance.

If WASM+WASI existed in 2008, we wouldn’t have needed to created Docker. That’s how important it is. WebAssembly on the server is the future of computing. — Solomon Hykes, Co-founder of Docker

Furthermore, the server-side Wasm benefits from significant innovations coming from the blockchain community.

Blockchain leads the way

Server-side Wasm is currently in an early stage. A significant amount of work (optimizations, developer tools, and integration libraries) has to be done before Wasm can see meaningful adoption in enterprise settings. However, developers are already using it for microservices in an emerging field of enterprise computing; decentralized blockchain applications.

Blockchain smart contracts are immutable and automatically executed code. Applications, known as decentralized applications (or dapps), can interact with smart contracts via web interfaces i.e. Remote Procedure Call (RPC) service endpoints. That makes smart contracts natural microservices.

Large public blockchain networks, such as Ethereum, EOS, and Polkadot, have all committed to adopting Wasm as their next-generation execution engines. As a result, the public blockchain, with its decentralized and serverless infrastructure is the best platform to write and deploy Wasm services today.

Moreover, the server-side Wasm can directly leverage billions of dollars worth of R&D investments poured into the blockchain space in recent years. Many of those blockchain R&D innovations are highly relevant to enterprise use cases; even those inside centralized data centers. Some of those use cases include:

  • Metered and billable shared resources usage accurate to opcodes
  • Trustless consensus for computing results
  • Digital currency infrastructure support
  • Formal verification of applications
  • Zero-knowledge computing
  • Improving deterministic behavior of applications

Show me the code

Second State’s web-based developer tools, allow you to deploy decentralized microservices on blockchain networks in a matter of minutes. These developer tools also enable you to build web applications around those microservices.

This getting started tutorial shows you how to create and deploy a decentralized web application, using Second State’s web-based IDE, called BUIDL.

http://buidl.secondstate.io/
http://buidl.secondstate.io/
http://buidl.secondstate.io/

Smart contracts, of decentralized web applications, act as microservices on the backend. This architecture is decentralized, serverless, and cloud-native.

Second State already has a version of BUIDL that deploys smart contracts onto Ethereum Foundation’s Ewasm testnet.

The next evolution of server-side Wasm is to power enterprise use cases beyond the blockchain. In a data center environment, Wasm provides services that are language agnostic (i.e., Rust on the server), hardware and OS agnostic, very lightweight, highly performant with native access to hardware features (i.e., GPU and AI chips), and highly secure with a modular security model. You can see a PoC demo of running a Rust service in WASM.

The road ahead

The soon-to-be-released Second State Virtual Machine (SSVM) is a fully compliant Wasm implementation optimized for server-side applications.

On the blockchain, we are at the forefront of providing Ethereum-flavored WebAssembly (Ewasm) for the next-gen Ethereum-compatible blockchain systems. The SSVM, for blockchain, natively supports 256-bit integer operations. It handles non-deterministic opcodes and gas computation inside the VM, resulting in much-improved performance compared with other leading Ewasm implementations.

In the cloud services arena, the SSVM provides optimized support for enterprise features such as persistent application state, high volume IO, multithreading, and low-level access to hardware accelerators. For example, the SSVM provides native access to the Qualcomm AI SDK functions when running on Qualcomm chips.

The road ahead for Wasm on the server-side is very promising. We look forward to sharing more of our cutting-edge developments as we blaze a trail; evolving toward the next-gen cloud architecture!

If you would like to learn more about anything mentioned in this article, please contact us at SecondState.io

https://www.secondstate.io/

Wasm

Dedicated to curating the highest quality WebAssembly (Wasm) information, in an unofficial capacity. Encouraging writers, developers and researchers to share everything from innovative business ideas & Wasm use cases, right through to technical insights, documentation & code.

Michael Yuan

Written by

Scientist & Investor http://michaelyuan.com/

Wasm

Dedicated to curating the highest quality WebAssembly (Wasm) information, in an unofficial capacity. Encouraging writers, developers and researchers to share everything from innovative business ideas & Wasm use cases, right through to technical insights, documentation & code.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade