Microsoft has recently unveiled a significant development in the world of cloud-native computing with the open-source release of Hyperlight Wasm, an advanced solution designed to execute WebAssembly (Wasm) workloads inside lightweight virtual machines (VMs). This release marks a crucial step in bringing together high-performance computing and security while simplifying the management of WebAssembly components across different platforms.

What is Hyperlight Wasm?

Hyperlight Wasm is a part of the broader Hyperlight project, an open-source Rust-based library originally designed to execute small, embedded functions using hypervisor-based protection. Unlike traditional virtual machines that require extensive resources such as an operating system and virtual devices, Hyperlight Wasm only needs a minimal slice of memory and a CPU to operate, making it exceptionally fast and lightweight.

This new addition provides a micro-guest virtual machine environment that can execute WebAssembly workloads across multiple programming languages, providing a uniform, hardware-protected environment. Hyperlight Wasm is designed to be versatile, enabling WebAssembly modules to run efficiently on platforms like Windows, Linux, and macOS.

Performance Benefits and Compatibility Trade-offs

One of the key advantages of Hyperlight Wasm is its speed. Traditional virtual machines must load an entire operating system and virtual devices before they can start executing workloads. This process can take a significant amount of time—often up to 125 milliseconds or more. In contrast, Hyperlight Wasm cuts down this time to just 1-2 milliseconds, with plans to reduce it to under one millisecond in the future.

However, this incredible speed comes at the cost of compatibility. Traditional virtual machines provide portability by abstracting hardware-specific details, supporting systems like Linux, macOS, and Windows. Hyperlight takes a different approach: it removes unnecessary layers by exposing only the necessary resources— a slice of memory and a CPU. This makes it lightweight but also less compatible with operating systems and more complex workloads that rely on typical system abstractions.

WebAssembly and the Component Model: A Middle Ground

To address compatibility challenges, Hyperlight Wasm leverages WASI (WebAssembly System Interface) and the WebAssembly Component Model. WASI allows WebAssembly applications to run consistently across different environments without being tied to a specific OS. By implementing these standards, Hyperlight Wasm can execute any application written in (almost) any language, without sacrificing performance or security.

Microsoft Announces Hyperlight Wasm: A Fast, Secure, and OS-Free Solution for WebAssembly Workloads | microsoft hyperlight
Microsoft Announces Hyperlight Wasm: A Fast, Secure, and OS-Free Solution for WebAssembly Workloads

Hyperlight Wasm supports interpreted languages like Python, JavaScript, and C#, alongside compiled languages such as C, Go, and Rust. This flexibility is achieved by embedding language runtimes (such as StarlingMonkey JS for JavaScript) directly into the execution environment, similar to how containers package software with its dependencies.

Hyperlight Wasm in Action: A Simple UDP Echo Server

To showcase the power of Hyperlight Wasm, let’s look at a practical example: running a User Datagram Protocol (UDP) echo server. This server, which leverages the wasi:sockets interface, can be run using Hyperlight Wasm without the need for complex setups.

Steps to Execute a UDP Echo Server:

  1. Install Dependencies: First, install the necessary Rust tools:
    cargo install wkg
  2. Download the Pre-Compiled Wasm Binary: Use wkg to pull the pre-compiled wasm binary:
    wkg oci pull ghcr.io/hyperlight-dev/wasm-udp-echo-sample/udp-echo-server:latest -o echo.wasm
  3. Set Up Hyperlight Host: Clone the repository and prepare the runtime environment by setting up Hyperlight to run the Wasm component.
  4. Run the Application: Once the environment is set up, run the server:
    cargo run
  5. Test the Server: In a separate terminal, send UDP packets to the server using netcat:
    nc -u 127.0.0.1 8080
    The server will echo back any data you send to it, demonstrating how Hyperlight Wasm executes workloads efficiently.

Security: More Layers with Less Work

Another major advantage of Hyperlight Wasm is the increased security it provides by using two layers of protection. Traditional virtual machines rely on a hypervisor to create a guest VM, load a kernel, and run the operating system before executing any application. In contrast, Hyperlight Wasm uses a much simpler approach by just creating a slice of memory and loading the WebAssembly workload. Even if attackers were able to break out of the WebAssembly sandbox, they would still need to overcome the VM boundaries, providing an additional layer of security.

What’s Next for Hyperlight Wasm?

Hyperlight Wasm is poised to become a key player in the cloud-native ecosystem by providing a highly efficient and secure platform for running WebAssembly workloads. The integration of WASI standards ensures that WebAssembly applications can run on different architectures without the need for recompilation, making it highly portable. Microsoft is planning to expand Hyperlight’s capabilities, including default bindings for more WASI interfaces, making it even easier to use.

Moreover, as the platform evolves, we can expect Hyperlight Wasm to support additional architectures, such as Arm64 processors, broadening its reach and further enhancing its portability and compatibility across diverse environments.

Get Involved: Open-Source Collaboration

As an open-source project licensed under the Apache 2.0 license, Hyperlight is a collaborative effort, and Microsoft invites developers, IT professionals, and solution architects to contribute. If you’re interested in exploring Hyperlight Wasm or want to get involved, you can visit the Hyperlight GitHub repository and start experimenting with this cutting-edge technology.

Hyperlight Wasm is just one example of how Microsoft is contributing to the innovation of cloud-native computing by focusing on performance, security, and simplicity in execution environments. The promise of this technology lies in its ability to create fast, secure, and portable WebAssembly workloads that run effortlessly on a wide range of platforms—ultimately helping developers build and deploy applications faster and more efficiently.

Source: Microsoft Blog

Scroll to Top