DEV Community

Saul Goodman
Saul Goodman

Posted on

NATS with JetStream

Introduction

With the growth of IOT devices, there is also a need to choose an appropriate communication means that serves or covers most of the requirements while still being easy and simple to use. One such TCP/IP protocol is the Neural Autonomic Transfer System (NATS), a lightweight and open-source protocol written in Go.

Core Principles of the NATS protocol
The Nats protocol is mainly focused on the following principles, but not limited to:

  1. Scalability, which makes it easier to work with under increasing load and data-intensive scenarios.
  2. Performance: This is a key functional requirement when it comes to messaging protocols.

So, Why NATS and What makes it So Interesting and an ideal option for most Scenarios?

First things first, let's clear what multi-tenancy means. Imagine we have an Apartment and we have many houses(flats) and we have residents/tenants, now all of these tenants share the same roof and facilities(aka the infrastructure of the protocol).

Now, NATS supports dual functionality like pub-sub(with a twist) and streaming with JetStream.

The twist in NATS JetStream Pub-Sub model is that it can capture and persist messages, enabling replay to consumers as needed, even if they were not subscribed to the topics when the message was published.

The enhanced QOS can persist messages, which makes it fault-tolerant and available.
There are only a limited number of technologies that can scale from edge environments like on-prem set up directly to the cloud while maintaining the security context(policies on auth and permissions), while remaining somewhat multi-tenant and having Deployment observability.
Advanced Features of JetStream in NATS include:

  1. Key-Value Store, which allows subscribing to changes in a particular key and can retrieve the complete history of the value.
  2. Object Stores, which are similar to key-value stores but support larger file sizes

Now, as for what the "Neural" in NATS is:

Conclusion
NATS with JetStream being lightweight, open-source, and highly performant makes it a compelling communication channel for modern distributed applications.

Top comments (1)

Collapse
 
osas_omoregbee profile image
Osas Omoregbee

Nice article Saul, but you did use the wrong diagram for the post 😅.