NATS vs HTTP
Inter service communication
Agenda
● Traditional HTTP Architecture
● NATS Microservice Architecture
● Benchmark setup
● Benchmark results
● Migration Considerations
Traditional HTTP Architecture
● Drawbacks:
○ Load Balancing
○ Service Discovery
○ Each service must have a
dedicated WebServer
● Doesn't fit the
microservice model
NATS Microservice Architecture
● Fits the new
Microservice
patterns
● NATS is
○ Lightweight
○ Flexible
○ Highly Performant
● It becomes easier to
create microservices
○ Load Balancing
○ Service Discovery
Benchmark setup
● Running with Docker
● One Client
● One Proxy
● One Service
● Source code
○ https://github.com/diogogmt/nats-rest-benchmark
Benchmark Results
● Each request is
executed serially
● Client times how long
it takes to execute
all requests
Benchmark Results
● Client executes
requests concurrently
with a factor of 20%
Considerations
● Different NATS strategies
○ Pub/Sub
○ Request/Reply
○ Queuing
● Keep in mind
○ Concurrency
○ Session Management
○ Metadata
○ Message status
○ NATS-Proxy framework
■ Author: Radomír Sohlich
■ https://github.com/sohlich/nats-proxy
Questions?
diogogmt.com
@diogogmt

NATS vs HTTP for Interservice Communication