Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Micro on NATS
Microservices with messaging
Who am I?
Asim Aslam
Working on Micro
Previously at Hailo
Before then Google
@chuhnk
asimaslam.com
What is Micro?
A microservice ecosystem
Simplifying building and managing distributed systems
What does that even mean?
Bu...
Micro A Microservice Toolkit
Go Micro - Pluggable RPC framework for writing microservices
API - API gateway. Translates HT...
Go Micro RPC Framework
Registry - Service Discovery
Selector - Client side load balancer
Transport - Synchronous Communica...
Why NATS?
Built for high performance and scale
Highly available - client and server side clustering
Extremely lightweight ...
Micro on NATS NATS Plugins
Go-Micro has a pluggable architecture
Each feature written as a Go interface. Just implement th...
Transport Synchronous Communication
Handles request-response
Supports bidirectional streaming
Socket style semantics; Send...
Transport
1. Server Listen - Subscribes to unique topic, wait for pseudo connections
2. Client Dial - Subscribes to unique...
Broker Asynchronous Communication
Publish and Subscribe mechanism
Includes notion of Topics and Channels (Queues)
Distribu...
Broker
1. Subscribe - Register interest to Topic. Specify Queue to distribute messages
2. Publish - Asynchronously publish...
Registry Service Discovery
Service discovery using a message bus? What magic is this?
type Registry interface {
Register(*...
Broadcast Queries!
1. All services subscribe for queries on a broadcast topic
2. Publish query on broadcast topic with rep...
Scaling Like A Boss
Cluster per AZ or Region
Multi-AZ deployment
Fault tolerant of AZ failure
Pattern for high availabilit...
Thanks for listening!
Micro on NATS blog post
blog.micro.mu/2016/04/11/micro-on-nats.html
Micro on GitHub Follow on Twitte...
Upcoming SlideShare
Loading in …5
×

Micro on NATS - Microservices with Messaging

2,243 views

Published on

This is a talk given by Asim Aslam at the NATS London Meetup on May 10th, 2016. It explains what Micro is (Microservices toolkit), and how it uses NATS - a lightweight high performance open source messaging system for microservices, cloud native, and IoT networks written in Golang.

You can learn more about NATS at http://www.nats.io
You can learn more about Micro at https://micro.mu/

Published in: Technology
  • Be the first to comment

Micro on NATS - Microservices with Messaging

  1. 1. Micro on NATS Microservices with messaging
  2. 2. Who am I? Asim Aslam Working on Micro Previously at Hailo Before then Google @chuhnk asimaslam.com
  3. 3. What is Micro? A microservice ecosystem Simplifying building and managing distributed systems What does that even mean? Building OSS tools that make it easier to write and run micro service applications Written in Go 100% Open Source
  4. 4. Micro A Microservice Toolkit Go Micro - Pluggable RPC framework for writing microservices API - API gateway. Translates HTTP to RPC. Path-to-Service resolution Web - Dashboard and reverse proxy. Web apps as first class citizens CLI - Command line interface. Straight forward. No frills. Sidecar - HTTP interface with all the features of Go Micro Bot - Hubot style bot for ChatOps. CLI Features. A bot? Really? Yea dude!
  5. 5. Go Micro RPC Framework Registry - Service Discovery Selector - Client side load balancer Transport - Synchronous Communication Broker - Asynchronous Communication Codec - Message encoding Client - RPC Client Server - RPC Server
  6. 6. Why NATS? Built for high performance and scale Highly available - client and server side clustering Extremely lightweight - written in Go, no persistence features At most once delivery - fire and forget Simple, focused and made for microservices Written by Derek Collison, with two decades of experience building messaging systems
  7. 7. Micro on NATS NATS Plugins Go-Micro has a pluggable architecture Each feature written as a Go interface. Just implement the interface. Integrate NATS using plugins for: Registry - Service Discovery Transport - Synchronous Communication Broker - Asynchronous Communication
  8. 8. Transport Synchronous Communication Handles request-response Supports bidirectional streaming Socket style semantics; Send(), Recv(), Close() type Transport interface { Dial(addr string, opts ...DialOption) (Client, error) Listen(addr string, opts ...ListenOption) (Listener, error) String() string }
  9. 9. Transport 1. Server Listen - Subscribes to unique topic, wait for pseudo connections 2. Client Dial - Subscribes to unique topic, publishes to Server with reply topic set 3. Server Socket - Pseudo Socket created for every new “connection” 4. Client Socket - Same as server. Send() - Publish, Recv() - Subscribed messages
  10. 10. Broker Asynchronous Communication Publish and Subscribe mechanism Includes notion of Topics and Channels (Queues) Distribute messages between subscribers type Broker interface { …. Connect() error Disconnect() error Publish(string, *Message, ...PublishOption) error Subscribe(string, Handler, ...SubscribeOption) (Subscriber, error) String() string }
  11. 11. Broker 1. Subscribe - Register interest to Topic. Specify Queue to distribute messages 2. Publish - Asynchronously publish to Topic 3. Encoding - Broker encodes Message to JSON
  12. 12. Registry Service Discovery Service discovery using a message bus? What magic is this? type Registry interface { Register(*Service, ...RegisterOption) error Deregister(*Service) error GetService(string) ([]*Service, error) ListServices() ([]*Service, error) Watch() (Watcher, error) String() string }
  13. 13. Broadcast Queries! 1. All services subscribe for queries on a broadcast topic 2. Publish query on broadcast topic with reply address 3. Instances of queried service respond 4. Wait for responses until upper time limit 5. Aggregate and return results
  14. 14. Scaling Like A Boss Cluster per AZ or Region Multi-AZ deployment Fault tolerant of AZ failure Pattern for high availability Multi-region deployment Use DNS latency based routing
  15. 15. Thanks for listening! Micro on NATS blog post blog.micro.mu/2016/04/11/micro-on-nats.html Micro on GitHub Follow on Twitter! github.com/micro @MicroHQ Micro on Web Join the Slack community! micro.mu slack.micro.mu

×