Fermyon's Spin WebAssembly Version 3.0 Released
Written by Nikos Vaggalis   
Tuesday, 26 November 2024

The open source developer tool for building, distributing, and running serverless WebAssembly applications reaches version 3.0. What's new?

fermyon

We looked into Spin last year in Spin Brings WebAssembly To The Cloud, where we describe what it actually is about:

Spin provides the interfaces for writing WebAssembly modules that can do things like answer HTTP requests. With Spin you reduce the overhead of microservices by factoring out the web server (replaced by a WAGI server) and writing out HTTP handlers in whatever language we want (Rust, C, JavaScript, Python, etc), which are then compiled to WebAssembly.

The host runtime will provide the features necessary, such as a filesystem (a highly sandboxed one), outbound HTTP, key/value storage, etc. Therefore we can focus our microservices on handling the business logic, leaving the underlying platform to manage all of the HTTP, SSL Certificates, and so on.

With that in place, what does version 3. 0 bring to the table?
One unique thing about Spin is that it is a multi-language framework. The new version brings first class support for writing components in any of the supported languages which can be invoked from any of the supported languages. For instance:

you've authored an AWS S3 client in Rust and would like to use it in your Javascript-based Spin app -
you can now express the S3 component as a dependency and harness its functionality in your application code.

With that property you can mix and match components very easily into your workflow. Furthermore with the new "Selective Deployments" you can split an application across environments while still distributing it as a single unit. For example, you ship the same binary which is comprised of a front end, a database backend and an AI service to different locations but you invoke only the designated part in the appropriate location:

  • The front end which handles browser and API requests must run in edge data centers close to users
  • The database backend must be run in a single central location
  • And the AI service which requires an LLM model to be loaded onto the hardware

While Spin was already modularized with modules called "host components" in order to facilitate low coupling, in practice
the attempt was not that successful because the implementation detaisl were leaking all over the codebase. "Spin Factors" then, is a better attempt where independent feature sets are organized into individual "factors" allowing for runtime implementations to select the capabilities they wish to provide.

The new version also comes with deeper integration with the WASI Standards. As a refresher WASI (WebAssembly System Interface) is a modular system interface for WebAssembly (Wasm) that enables developers to run Wasm programs on any platform, including the browser, the cloud, and the edge.
WASI is designed to be secure, fast, and portable, and is the component that allows the developers to write their programs once and run them anywhere.

As such, Spin now officially supports the WASI Key-Value and WASI Config APIs. WASI key/value defines a collection of interfaces for interacting with key-value stores while Config aims to provide a set of generic interfaces for providing configuration to a component.

To put Spin into practice, here is the code of a simple LLM powered application written in Rust and powered by the Spin sdk:

spinai

 

Take note that you can do the same in other languages like Python or Typescript, and/or connect other components together written in any other supported languages. Multi-language programming in practice!

If you find the proposition interesting the download the SDK and check the many examples found on its Github repo in a multitude of languages.

 

More Information

Spin Github

Spin documentation

 

Related Articles

Spin Brings WebAssembly To The Cloud

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


Uno Announces Platform Studio
19/11/2024

Uno has announced Uno Platform Studio, a suite of productivity tools featuring Hot Design, which they describe as a next-generation Visual Designer for .NET cross-platform apps.



Azure Container Apps Dynamic Sessions Generally Available
02/12/2024

Dynamic Session support has been added to Azure Container Apps. Azure Container Apps is a serverless platform for running containerized applications, and dynamic sessions is designed to provide fast a [ ... ]


More News

espbook

 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Tuesday, 26 November 2024 )