Notes on NATS Keynote
My notes from the NATS KubeCon + CloudNativeCon NA 2019 Keynote.
Overview
I recently heard about NATS, a “message oriented middleware”. It is a software infrastructure that provides the exchange of data that is segmented into messages among computer applications and services. I was curious about it’s potential in applications that involve streaming real-world sensor data, so I decided to check out there 2019 keynote. Below are some notes I took while watching.
What is NATS
NATS is a simple, reliable, cloud-native messaging system
Goal of Project: Be the enabling technology to securely connect all the world’s digital systems, services and devices.
Connect Everything:
- Shared utility of any size
- Decentralized and Federated
- Mix a shared utility with your own servers and security
- Secure by default, no passwords or keys, powerful authorization
- On-Premise, Multi-Cloud, Multi-Deployment, the Edge, and IoT
- Communicate, Publish, Consume, and Save and Restore, State
-
Healthy and thriving Ecosystem, of Services and Streams
- Scalable services and streams
Quality of service
-
Over 30 different client programming language implementations (Nov. 2019)
-
Highly resilient and self healing
Example Use Cases:
- cloud messaging
- services (micro-services)
- Event/Data streaming (observability/analytics)
- Command and control
- IoT and Edge
- Telemetry/Sensor Data/Command and Control
- Augmenting or Replacing Legacy Messaging
Can support hundreds of thousands of nodes with really fast response times (700ms)
Some Companies Using NATS
- CHORIA
- Netlify
- Mastercard
- StorageOS (Now ondat)
- Tinder
- Platform 9
- Qlik
NATS Ecosystem
Integrations
- curl command to install and deploy to Kubernetes
- Prometheus Exporters, Fluentd Plugin and OpenTracing/Jaeger support
- Dapr.io Component Integration
- Spring Boot Starter
- NATS Cloud Stream Binder for Spring
- NATS/Kafka Bridge
- NATS / MQSeries Bridge
- Go-Cloud and Go-Micro pub/sub integration
Basic Messaging Patterns
- Services - Request/Reply
- Scale up and down
- location transparency
- observability
- Streams - Events and Data
- Scalable N:M communications
- Realtime and persistent
- playback by time, sequence, all or only last received
Accessing a NATS System
- Free Community Servers
- demo.nats.io (both open and secure versions)
- Kubernetes
curl [https://nats-io.github.io/k8s/setup.s](https://nats-io.github.io/k8s/setup.sh)| sh
- Docker
docker run -p 4222:4222 -ti nats:latest
- Additional Information
Usage Examples
HTTP vs NATS (requestor)
HTTP
resp, err := http.Get("http://example.com/")
if err != nil {
// handl error
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
// decode body
NATS
nc, err := nats.Connect("demo.nats.io")
if err != nil {
// handle err
}
resp, err := nc.Request("example.com", nil, 2*time.Second)
// decode resp.Data
HTTP vs NATS (service)
HTTP
http.HandlFunc("/bar", func(w http.ResponseWriter, r*http.Request){
fmt.Fprintf.(w, "Hello World")
})
log.Fatal(http.ListenAndServe(":8080", nil)
NATS
nc, err := nats.Connect("demo.nats.io")
if err != nil {
// handle err
}
sub, err := nc.QueueSubscribe("bar", "v0.1", func(m * nats.Msg) {
m.Respond([]byte("Hello World"))
})
NATS Community
- Over 1,000 contributors
- 33 Client languages (Nov. 2019)
- 75 Public Repos
- 100M NATS Server and Streaming Server Docker Downloads
- ~1,600 Slack Members
- 20+ releases since June 2014
- https://nats.devstats.cncf.io/d/9/developers-summary
- Grafana
References: