WebAssembly comes to the Apache web server

VMware Labs has unveiled an extension module for Apache’s popular web server that runs WebAssembly binaries, opening up new possibilities for languages ​​and projects to run securely in Apache.

The mod_wasm extension module allows the Apache HTTP server to respond to HTTP requests with applications compiled in WebAssembly. Internally, mod_wasm uses the secure Wasmtime runtime to configure and run Wasm modules.

When an Apache HTTP server is run with mod_wasm enabled, the Wasm module is preloaded into memory as part of a process to speed up request handling by not loading the Wasm module from scratch each time a request is received.

Unveiled on GitHub earlier this month, mod-wasm is made up of two libraries:

  • mod_wasm.so, which provides an interface between the Apache C API and the Rust library to manage the Wasm runtime. This library is responsible for Apache’s configuration options and bindings to connect the Rust library to Apache.
  • libwasm._runtime.so, which receives HTTP requests from Apache, configures and runs the Wasm module. It also parses the response and returns control to mod_wasm.so.

WebAssembly, or Wasm, is a binary instruction format and stack-based virtual machine that provides high performance for web applications. It was designed as a portable build target for programming languages ​​such as C, C++ and Rust.

Copyright © 2022 IDG Communications, Inc.