6 Creating production-grade Wasm applications

 

This chapter covers

  • wasmCloud as an off-the-shelf host
  • Integrating persistent storage
  • Scaling Wasm applications
  • Distributing applications using NATS
  • Embedding machine learning capabilities in wasmCloud

We've been steadily expanding our toolbox. We started with Wasm modules where all we had were four basic types, linear memory, and a dream. Then, we introduced WIT and Wasm components, which brought higher-level types and a canonical ABI for lifting and lowering constructs like String values, enabling composability between components across languages. Next, we explored interacting with the underlying system via WASI, applying it to scenarios like executing machine learning workloads with WASI-nn (leveraging WASI 0.2) and running Wasm UDFs in a database (leveraging WASI 0.1).

Yet, in nearly all our examples, we’ve written custom hosts to run our applications. For instance, our smart CMS host is currently bootstrapped to set up WASI and WASI-nn, which diverts us from focusing on business logic and is not ideal for server-side Wasm development. In this chapter, I'll introduce you to wasmCloud, an off-the-shelf host designed to streamline the development of Wasm microservices.

6.1 Creating a wasmCloud "Hello, World" application

6.2 Adding persistent storage to our Wasm app

6.2.1 Modifying our WIT and wadm manifest

6.2.2 Modifying our application and re-deploying it

6.3 Scaling our wasmCloud application

6.4 Distributing our wasmCloud application

6.5 Another off-the-shelf host: Spin

6.5.1 Creating a Spin "Hello, World" application

6.5.2 Comparing wasmCloud and Spin

6.6 Implementing the example project as a wasmCloud app

6.6.1 Adding persistent storage to the smart CMS

6.6.2 Adding machine learning to the smart CMS

6.7 Summary