• What is WebAssembly and why is it important for Cloud native
• Wasm architecture and how we realize virtualization via Wasm
• Kind of workloads supported by Wasm (Cloud, Browser, and Edge)
Chapter 2: WebAssembly Memory Model and Runtimes
Chapter Goal: Memory model internals and layout of Wasm modules in memory
• Introduction to Wasm file format
• Deep dive into the sections of the Wasm file (function table, types, etc.) and their relevance
• Memory layout for tenant isolation within a linux process using Wasm
Chapter 3: WebAssembly Text Toolkit
Chapter Goal: Covers the WebAssembly text format by showing examples of how to write Wasm. Usage of tools like wasm2wat will also be covered with examples
• Introduction to WebAssembly text format (wat)
• Creating simple wat programs and compiling to Wasm using wat2wasm tool
Chapter 4: Rust and WebAssembly
Chapter Goal: Covers examples of how to create a Wasm module in Rust and invoke it via JS and other runtimes
• Creating a Rust program and compiling it as a Wasm module
• Explain wasm-bindgen tool for compiling Rust to Wasm
• Consuming the Rust program from a JavaScript-based runtime like Node.js
Chapter 5: Golang and WebAssembly
Chapter Goal: Covers examples of how to create a Wasm module in Golang and invoke it via JS and other runtimes
• Create a Golang program and expose it as a Wasm module
• Use WaPC (web assembly procedure call) to consume this program from
o Rust
o Node.js
• Show how complex types can be created in Wasm using WaPC and how these types can be passed between guest and host boundaries
Chapter 6: Writing a Simple Web Application in WebAssembly
Chapter Goal: How to create a simple web app in WebAssembly
• Expose the Wasm module using a web application
• Web application will be written in
o Rust
o Node.js
o Golang
• All three runtimes will embed a Wasm engine and load a Wasm module on an http request. Invoke the exposed function within Wasm module and return back the http response
Chapter 7: Deploying Wasm Workloads to Kubernetes and Service Mesh
Chapter Goal: Showcase how Wasm modules can be deployed using the kubernetes control plane and can be represented as pods instead of Docker containers. Also covers some of the serverless aspects around and detail out a service mesh scenario where we can use Wasm-based filters for massaging the data on the Istio data plane
• Intro to Kubernetes
• Dockerize the embedded Wasm engine in the runtimes created in Chapter 6
• Host these docker images into dockerhub
• Create a Kubernetes pod using these docker images
• Deploy the pod into kubernetes
• Expose the web servers (hosting the Wasm runtime) as a service in k8s
• Show invocation of the Wasm modules via the service
• Intro to Istio and Service Mesh in context of API gateways
• Create a simple Wasm filter for Istio/Envoy
• Show invocation of the Wasm filter as part of the data path
Chapter 8: Summary
Chapter Goal : Summary of the topics around Wasm and its usage
• Summary of Wasm and various runtimes for Wasm
• Summarize enablement of Wasm-based workloads on k8s
Shashank Mohan Jain has been working in the IT industry for around 20 years mainly in the areas of cloud computing and distributed systems. He has keen interests in virtualization techniques, security, and complex systems. Shashank has 32 software patents (many yet to be published) to his name in the area of cloud computing, IoT, and machine learning. He is a speaker at multiple reputed cloud conferences. Shashank holds Sun, Microsoft, and Linux kernel certifications.
Journey into the amazing world of WebAssembly (Wasm) and learn about how it can be applied on the cloud. This book is an introduction to Wasm aimed at professionals accustomed to working with cloud-related technologies such as Kubernetes and Istio service mesh.
Author Shashank Jain begins with an introduction to Wasm and its related tooling such as wasm-bindgen and wapc. He then walks you through code examples using Rust, Golang, and JavaScript to demonstrate how they can be compiled to Wasm and consumed from Wasm runtimes deployed standalone, as well as on the cloud. You will see how a wasm module can be run through an http interface, and how Wasm fits into CNCF projects such as Kubernetes and Istio service mesh. After that, you’ll learn how the polyglot nature of WebAssembly can be leveraged through examples written in languages like Rust and consumed via Golang and JavaScript, with a focus on how WebAssembly allows interoperability between them. You’ll gain an understanding of how Wasm-based modules can be deployed inside Linux containers and orchestrated via Kubernetes, and how Wasm can be used within the Istio proxy to apply rules and filters.
After reading this book, you’ll have the knowledge necessary to apply WebAssembly to create multi tenanted workloads which can be polyglot in nature and can be deployed on cloud environments like Kubernetes.
You will:
Understand how Wasm can be used for server-side applications
Learn about Wasm memory model and Wasm module layout
Learn how communication between host and Wasm module is facilitated
Understand the basics of Wasm sandboxing and security
Learn the fundamentals of tooling around Wasm, such as WAT and Wasm-pack
Create a Wasm module in Rust and consume it from JavaScript, Rust and Golang.
Grasp how Kubernetes can be used to orchestrate Wasm-based workloads