Yesterday, Fastly, a US-based cloud computing service provider, open-sourced its native WebAssembly compiler and runtime, Lucet.
Lucet is built on top of Cranelift, Mozilla’s low-level retargetable code generator. It already powers Fastly’s Terrarium project, their experimental platform for edge computation using WebAssembly, and now it is coming to their edge cloud platform as well.
Lucet delegates the responsibility of executing WebAssembly programs into two components: compiler and runtime. The compiler compiles WebAssembly modules to native code and the runtime manages resources and traps runtime faults. As it uses ahead-of-time compilation strategy, it simplifies the design and overhead of the runtime compared to just-in-time (JIT) compilation that browser engines use.
WebAssembly allows web browsers to safely execute programs with near-native performance. It is supported by some of the most commonly used browsers including Google, Mozilla, and Safari. With Lucet, Fastly aims to take WebAssembly “beyond the browser” by providing users a platform for faster and safer execution of programs on Fastly’s edge cloud.
Since WebAssembly is supported by an impressive list of programming languages including Rust, TypeScript, C, and C++, Lucet users will be able to work with the language they prefer. They do not have to be restricted to Fastly’s Varnish Configuration Language (VCL).
The Lucet compiler and runtime ensure that each WebAssembly program is allocated its own resources. This enables Fastly’s edge cloud to simultaneously execute a large number of WebAssembly programs without compromising on security.
Lucet supports WASI, an API that provides access to various operating-system-like features. These include files and filesystems, Berkeley sockets, clocks, and random numbers.
At the moment, Lucet supports running WebAssembly programs written in C, Rust, and AssemblyScript and its runtime only support x86-64 based Linux systems.
To read the official announcement, visit Fastly’s official website.
Introducing CT-Wasm, a type-driven extension to WebAssembly for secure, in-browser cryptography
Creating and loading a WebAssembly module with Emscripten’s glue code [Tutorial]
The elements of WebAssembly – Wat and Wasm, explained [Tutorial]