Upgrade to Pro — share decks privately, control downloads, hide ads and more …

SPIN IT! JUMPSTART YOUR WASM JOURNEY WITH FERMY...

SPIN IT! JUMPSTART YOUR WASM JOURNEY WITH FERMYON SPIN

Knowing about the potential and the impact of WebAssembly (Wasm) for serverless computing, we will dive deeper and see serverless Wasm in action. This talk guides you through patterns and practices for building serverless workloads with Fermyon Spin. Thorsten Hans addresses everyday developer tasks like routing, configuration management, and persistence. You’ll understand how to integrate Wasm into your distributed application architecture and interact with existing components. It’s time to jumpstart your WebAssembly journey and design distributed architectures for the next wave of cloud computing!

Thorsten Hans

March 23, 2023
Tweet

More Decks by Thorsten Hans

Other Decks in Technology

Transcript

  1. Fermyon Spin is: • A serverless runtime build using Wasm,

    WASI, and the WebAssembly Component Model (leveraging wasmtime internally) • A collection of SDKs for many popular languages • A super focussed developer tooling Intro Let’s get everybody on track! 🦀
  2. With Spin we can build • Reactive applications that respect

    to the key pillars of Wasm • Fast: Near-native speed • Lightweight: Super small distributable units (Wasm Modules) • Secure: Sandboxed execution environment Intro Let’s get everybody on track!
  3. • Spin provides triggers that the runtime uses to invoke

    our code • The runtime instantiates our Wasm Module and invokes our code • Currently, Spin provides the following triggers • HTTP • Publish / Subscribe Triggers & Outputs
  4. Outputs allow our code to interact with the surrounding world

    • Databases (SQLite, MySQL & PostgreSQL) • Key-Value Storage (SQLite, Redis) • Publish / Subscribe (Redis Channels) • Outbound HTTP Triggers & Outputs
  5. When building HTTP-based applications with Spin we must • specify

    a route on which Spin should invoke our code • Implement code for handling different HTTP request types Although Spin SDK is tiny, it simplifies building full-fledged HTTP APIs Patterns & Practices
  6. Regardless of whether we must invoke backend APIs or 3rd

    party endpoints, Outbound HTTP is an easy to grasp, yet important capability provided by the Spin SDK. Patterns & Practices Outbound HTTP
  7. Configurability is mission-critical when building software that is executed in

    different environments. Spin apps are no exception here. We must use proper mechanisms to deal with sensitive and non-sensitive configuration data. Patterns & Practices Configuration Management
  8. • The Spin Manifest spin.toml is the center of gravity.

    All configuration aspects are defined here. • We use variables to specify non-sensitive configuration data • For sensitive configuration data, we can use HashiCorp Vault • We link HashiCorp Vault to our app using a runtime-config file Patterns & Practices Configuration Management
  9. • Publish is achieved using the Spin SDK • Constructing

    messages is up to us, which means we can modernize (read: replace containers) with ease, using cloudevents or by mimicking existing messages • When subscribing to messages, we must implement filters on our own Patterns & Practices Publish / Subscribe
  10. • With Spin, Fermyon demonstrates how WebAssembly will change the

    way we build software for the next wave of cloud-computing • We’re able to combine best from both worlds, Containers and WebAssembly to build distributed architectures for the upcoming years • Available Spin SDKs and plain WAGI support makes it super easy to get started (using any language that compiles to Wasm) Conclusion
  11. • Hyperscalers want Wasm to drive hardware utilization, lift smaller

    application packages, get proper isolation and security in place and scale horizontally to and from 0 without facing the dilemma of cold-start times (Looking at you, Azure Functions *scnr*). • Application developers on the otherside had to tacklequite some pitfalls to adopt Wasm (SDKs., dev tooling, etc) • From my point of view, Fermyon is able to close the gap and drive Wasm adoption on the server and in the cloud to whole new level Conclusion