View on GitHub

adr

Journal of Architectural Decision Records made for the project

Use NATS as the foundation for lattice

Status

Accepted

Context and Problem Statement

Lattice is the self-healing, self-forming network extension to the WebAssembly actor runtime host. Lattice needs to be able to create flattened network topologies regardless of the number of intervening hops, routers, gateways, clouds, and physical infrastructures. As the core of the networking infrastructure, whatever lattice is built with must be boring 1, flexible, self-maintaining, secure, reliable, fast, and easy to use.

Decision Drivers

Considered Options

Decision Outcome

Chosen option: NATS, because it was by far the simplest yet most powerful, flexible, easy-to-run, and easy-to-support distributed messaging system evaluated. The power and flexibility brought to bear by “leaf nodes”2 alone is a compelling enough argument to use NATS.

Positive Consequences

Negative Consequences

It is possible that, by choosing NATS, we might miss out on some powerful persistence technology available in a heavy-duty (possible reading: bloated) broker, but at this point we don’t think our needs warrant the additional baggage.

NATS is also not quite as well-known as Apache Kafka and RabbitMQ, though we think it should be. We might have to defend our decision to use NATS more often than if we had picked a different broker, but it’s worth it.

Pros and Cons of the Options

NATS

NATS is a small, lightweight message broker that has been designed from the very beginning to be low-maintenance, easy to configure, flexible, and fast. It remains one of the most “cloud native” messaging systems we’ve encountered.

RabbitMQ

RabbitMQ is written in Erlang and is used to support all kinds of incredibly large-scale production workloads. “Nobody would get fired” for picking Rabbit.

Apache Kafka

Kafka is the 300 pound elephant of the brokers we evaluated. It has a nearly infinite list of extensions and tie-ins to massive numbers and sizes of ecosystems. It has broad support and is running in production at just about every scale and configuration imaginable.

Redis

In recent years Redis has become a kitchen sink of services, providing far more than just a distributed key-value store with optional persistence.

Write our Own

Included here as an option for the sake of showing all possibilities. This would involve us creating our own networking code, likely starting from TCP/UDP low-level stuff and building up from there.

Cloud-Proprietary

This is only included for the sake of completeness. We only briefly considered this before deciding against it.


  1. From the article, “Technology for its own sake is snake oil” 

  2. https://docs.nats.io/nats-server/configuration/leafnodes