Paul Krill
Editor at Large

Spin 2.0 shines on Wasm component composition, portability

news
Nov 09, 20232 mins
Development Libraries and FrameworksSoftware DevelopmentWeb Development

Framework for building and running server-side WebAssembly applications allows you to compose apps from Wasm components written in different programming languages.

shutterstock 288379226 time-lapsed photo of spinning carousel at night
Credit: Michal Moravec / Shutterstock

Spin 2.0, an upgrade to Fermyon’s framework for building WebAssembly (Wasm) applications for the cloud, has arrived, enabling Wasm component composition and laying a foundation for portability across runtimes and implementations.

Introduced November 2 and accessible from GitHub, Spin 2.0 is intended to improve both the developer experience and runtime performance. Featured is an updated spin.toml manifest that focuses on simplicity and on resources a component is allowed to access, such as a Redis database. When writing applications, developers can interact with built-in persistence, configuration, or data services from within Wasm components or communicate with external systems.

Spin 2.0 leverages the WebAssembly Component Model and the upcoming WASI Preview 2 (WebAssembly System Interface) in production environments. The component model introduces a way to bring efficient high-level interfaces to content running in Wasm, regardless of the programming language used to create the content, and the ability to compose new components that use these interfaces. Rust, JavaScript, TypeScript, and Python can be used to build components that run inside Spin applications, and these components can interact with each other.

Spin 2.0 also offers significantly improved performance compared to Spin 1.0, which was introduced in March 2022, due in large part to the Wasmtime pooling memory allocator. Spin enables the development of event-driven microservices, serverless-style APIs, websites, full-stack, and AI-capable applications as Wasm components.

These applications are orders of magnitude smaller than container images, portable across OSes and CPU architectures, offer incredibly low startup latency, and can run tens of thousands of requests per second, Fermyon said. And they can run anywhere, the company added, ranging from tiny devices to Docker Desktop, Kubernetes, Nomad, and Fermyon Cloud.

Wasm is a binary instruction format and virtual machine that serves as a compilation target for C/C++, C#, Rust, and other programming languages, offering both choice of languages for building web apps and near-native application performance. Fermyon said Wasm is making its way into more parts of modern computing, from browser applications to server-based apps, plugin systems, IoT scenarios, and more.