Lattice
Overview
The lattice is a self-forming, self-healing mesh network that provides a unified, flat topology across any number of environments, clouds, browsers, or even hardware. A lattice allows components, providers, and hosts to communicate with each other across any number of infrastructure barriers. A network in wasmCloud should "just work," which enables short developer feedback loops as well as production performance and resilience.
Self-forming
With a lattice, there is no need to deploy complex service discovery products or servers, no need to fuss with complicated and potentially error-prone and brittle dynamic DNS systems. wasmCloud hosts are automatically aware of each other and lattice metadata merely by connecting to an appropriate NATS server.
Self-healing
The lattice is designed to operate in the presence of network partition events, partially connected endpoints, and hosts that have slow or high-latency connections. Lattices also operate optimally within cloud back-ends or even in small, constrained environments. Endpoints within a lattice can come and go without ever taking the entire system down, and the network graph can change and re-form itself based on real-time conditions, without requiring applications to be rebuilt or redeployed.
Flattened topology
When deploying mesh networks into a "cluster" in most cloud environments, those networks are isolated within their cluster. Explicit configuration changes are necessary to span multiple clusters, and, more importantly, the application code and operations teams may have to be aware of the boundaries between networks, clouds, and other infrastructure zones.
With a lattice, as long as two endpoints can reach each other — over any number of intervening hops, across any kind of disparate infrastructure — those endpoints can be part of the same lattice. The power of NATS (especially leaf nodes) and pub/sub messaging (as opposed to strict point-to-point calls) allows for extremely flexible deployments. Communication within a lattice is fast, secure, and easily maintained, and application code can be written without regard to the underlying infrastructure.
Runtime composition
wasmCloud's wRPC protocol is (just as it sounds) an RPC protocol for dynamically composing distributed WebAssembly components at runtime over the lattice.
Components include imports and exports. When these match one of the host's list of known interfaces, another component is required to satisfy the import or export. That component can be combined (or "composed") with the first at build-time or dynamically composed at runtime via wRPC.
Failover and load-balancing
The NATS-powered lattice enables resilient distributed messaging with location-independent addressing. When a component exports a function, it creates a queue subscription on a NATS subject that other components can call. Across a lattice, different instances of the same component are equally eligible to receive a given invocation, regardless of the host on which they are running. This enables immediate failover—if a host is lost, alternative compute is immediately available.