In this article, we touch on technologies that have had a profound impact over the last decade or so and then reveal how SpinKube has cherry-picked the best parts to provide a way of orchestrating light, fast and efficient Wasm workloads in k8s.
Virtual Machines (VMs)
Using VMs solves several problems compared to running servers directly. By running multiple VMs on a single physical server, we can maximize the use of our hardware infrastructure and reduce costs. Aside from the advantage of better utilisation of hardware resources, VMs also provide us with a level of isolation between different applications sharing the host's hardware. VMs allow us to scale up and down. However, scaling is typically done at the VM level, provisioning more or fewer VMs based on demand.
Containers
Unlike VMs, containers can run multiple instances on a single host without requiring a separate Operating System (OS) environment for each instance.
This translates to faster start-up and deployment times compared to VMs. Containers offer horizontal scaling, allowing each application to be distributed across many containers.
K8s
K8s is a powerful container orchestration platform. It facilitates horizontal application scaling by automatically distributing containers across multiple nodes and ensures high availability by restarting failed containers or rescheduling them on healthy nodes.
K8s also offers built-in service discovery and load-balancing mechanisms, allowing applications to discover and communicate with other services within the cluster, making it easier to build complex microservice architectures.
With continuous monitoring of the health of its containers and nodes, k8s' self-healing capability helps ensure application availability and reliability, making it a popular choice for managing containerized applications.
Overprovisioning
Allocating more resources (CPU, memory, and/or storage) than an application requires goes against the idea of using containers in the first place. Yet overprovisioning is still a common challenge in the container ecosystem; leading to unnecessary costs and resource wastage.
Efficient orchestration of containers is crucial for optimizing application performance. In today's fast-paced world, ensuring optimal performance and quick application response times is of the utmost importance.
By minimizing wastage and controlling costs, you can enhance the overall user experience and meet modern users' expectations.
This is a great segue for discussing cold start times, specifically Spin and Wasm's lightweight and efficient execution model.
Spin and Wasm
The Spin framework leverages the latest developments in the Wasm component model and Wasmtime runtime; designed for fast startup times. Spin is an open-source framework for building and running fast, secure, composable cloud microservices with Wasm. Importantly, in the context of performance, Spin offers several advantages regarding startup times for cloud microservices.
Wasm's Lightweight Execution
Wasm is a binary instruction format designed to be compact and efficient. Its lightweight nature allows efficient resource utilization during startup. Spin and Wasm's fast startup times make them well-suited for scalable cloud microservices architectures. Applications can be quickly spun up or down based on demand, allowing for efficient resource allocation and improved scalability. Spin and Wasm perfectly match a container orchestration platform like k8s.
SpinKube
SpinKube is a new open-source project that streamlines the experience of developing, deploying, and operating Wasm workloads on K8s. It provides hyper-efficient serverless on K8s powered by Wasm. With SpinKube, you can leverage the advantages of using Wasm for your workloads. For example:
- Artifacts are significantly smaller in size compared to container images.
- Artifacts can be quickly fetched over the network and started much faster.
- Substantially fewer resources are required during idle times.
Thanks to Spin Operator, we can integrate with k8s primitives (DNS, probes, autoscaling, metrics, and many more cloud native and CNCF projects).
K8s has a large and vibrant ecosystem with many extensions and plugins. It can be easily extended to integrate with other tools and services. Let's look at the open-source projects that comprise the overarching SpinKube GitHub organization.
The SpinKube GitHub organisation consists of the following individual open-source project repositories:
- Spin Operator - facilitating the orchestration of Wasm workloads in k8s
- Containerd Shim Spin - the containerd shim implementation for Spin
- Spin Kube Plugin - a Spin plugin for interacting with k8s
- Runtime Class Manager - the spiritual successor to the kwasm-operator.
The Spin operator uses the Kubebuilder framework and contains a Spin App Custom Resource Definition (CRD) and controller. It watches Spin App Custom Resources and realizes the desired state in the K8s cluster. Aside from the immediate benefits gained by running Wasm workloads in k8s, additional optimizations such as Horizontal Pod Scaling (HPA) and k8s Event-driven Autoscaling (KEDA) can be achieved in a pinch.
SpinKube throws a host of useful functionality into the mix, allowing you to install Spin Operator on an Azure k8s Service (AKS) cluster to deploy your Spin application and much more. You can build and push Spin Operator images. Whether running locally or on a cluster, you can be assured that your orchestration of light, fast and efficient Wasm workloads in k8s is optimal.
The Spin plugin for k8s is crafted to augment Spin's capabilities, facilitating the direct execution of Wasm modules within a k8s cluster. It is a specialized tool for integrating k8s with the Spin command-line interface. By collaborating with containerd shims, this plugin enables k8s to oversee and execute Wasm workloads in a manner akin to conventional container tasks.
The diagram below illustrates application development (using the spin
CLI), workload lifecycle, and runtime management.
For more information and documentation, please visit the SpinKube website.
Top comments (0)