Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Fastly Open-Sources Lucet, Its WebAssembly Compiler and Runtime

Fastly Open-Sources Lucet, Its WebAssembly Compiler and Runtime

The Fastly edge cloud platform recently open-sourced Lucet, its native WebAssembly compiler and runtime. Lucet may enable edge developers to build custom solutions for the edge at scale without limitations imposed by vendors, languages, or application programming interfaces (API).

Lucet is designed around WebAssembly (Wasm) and the WebAssembly System Interface (WASI). Developers may write programs using any language which compiles to WebAssembly, such as Rust, TypeScript, C, or C++. WASI allows to run Wasm code beyond the browser, on any platform which implements the predefined WASI interfaces. Lucet may leverage the security, near-native speed, multi-language characteristics of WebAssembly on any WASI-supporting platform.

Pat Hickey, Fastly Sr. software engineer, details the performance requirements for Lucet:

A major design requirement for Lucet was to be able to execute on every single request that Fastly handles. That means creating a WebAssembly instance for each of the tens of thousands of requests per second in a single process, which requires a dramatically lower runtime footprint than possible with a browser JavaScript engine. Lucet can instantiate WebAssembly modules in under 50 microseconds, with just a few kilobytes of memory overhead. By comparison, Chromium’s V8 engine takes about 5 milliseconds, and tens of megabytes of memory overhead, to instantiate JavaScript or WebAssembly programs.

and its security characteristics:

With Lucet, Fastly’s edge cloud can execute tens of thousands of WebAssembly programs simultaneously, in the same process, without compromising security. The Lucet compiler and runtime work together to ensure each WebAssembly program is allowed access to only its own resources. This means that Fastly’s customers will be able to write and run programs in more common, general-purpose languages, without compromising the security and safety

Developers may thus write for the edge in the programming language of their choice and may lift potential vendors and API limitations and implement custom solutions to technical and business problems such as A/B testing or authentication.

While Fastly only recently open-sourced Lucet, Lucet has been used in production for several months as the engine powering Fastly's Terrarium project. Documentation and examples are available in the Lucet repository.

WebAssembly describes itself as "a binary instruction format for a stack-based virtual machine (...) designed as a portable target for compilation of high-level languages like C/C++/Rust, enabling deployment on the web for client and server applications". It is now implemented by the four major browser engines. WASI is a system interface for the WebAssembly platform aiming at running WebAssembly programs on any devices, computers, or operating systems.

Rate this Article