DEV Community

satish
satish

Posted on

NATS for .net developers - Part I

Nats is a high-performance message system developed by Derek Collison. It's built right from the ground up as a cloud-native service. And it's been graduated to a Mature project with the CNCF community, Alongside with kubernetes, Prometheus, Grpc.

https://www.cncf.io/blog/2018/03/15/cncf-to-host-nats/

If you are on the path to move towards microservice and looking for a high reliability and performance messaging System, this should be your choice.

Nats, at its core, is a Publish/Subscribe system. A PubSub-Model essentially means the System can communicate with each other without knowing a great deal about other endpoints. Clients become subscribers by registering their interest in the subject, and whenever the publisher sends the message system will deliver to all the available clients.

Here the transmitting of the message from producer to consumer is done Via Nat's server component.

Delivery Guarantees or QoS

Nats by default provide At-Most once delivery guarantee and with the help Nats streaming At least once

  • At-Most once - Message will be delivered to the client if the client is alive;

  • At-least once - Message will be delivered to the client at least come. In this config, the Nats streaming server maintains a commit log of messages.

Nats don't support exactly-once delivery like Kafka. These are
some of the choices to make NATS a reliable and straightforward
messaging platform.

Performance

Nats designed for ultralight and performance-minded modern messaging middleware. In my laptop with other programs like Visual studio and chrome with 9 tabs(Yikes), I was able to bench 18 million messages per second.

Installation

Installing Nats is a Breeze, and it supports multiple platforms with different variants. In this case, I want to use docker.

docker run -d --name nats-main -p 4222:4222 -p 6222:6222 -p 8222:8222 nats

Will look at the usage from .net library in the next part.

Top comments (1)

Collapse
 
wagimo profile image
Wagimo

Hello, I'm waiting for the second part of this article...