patterns for asynchronous microservices with nats
TRANSCRIPT
![Page 1: Patterns for Asynchronous Microservices with NATS](https://reader035.vdocuments.us/reader035/viewer/2022081605/588403b41a28ab884b8b604b/html5/thumbnails/1.jpg)
Patterns for Asynchronous Microservices
Raül Pérez - @repejota NATS London - 10/05/2016
![Page 2: Patterns for Asynchronous Microservices with NATS](https://reader035.vdocuments.us/reader035/viewer/2022081605/588403b41a28ab884b8b604b/html5/thumbnails/2.jpg)
Who am I?Raül PérezLead Software Engineer at R3 Labs Ltd.
Twitter: @repejotaGithub: https://github.com/repejotaEmail: [email protected]
2Raül Pérez - @repejota NATS London - 10/05/2016
![Page 3: Patterns for Asynchronous Microservices with NATS](https://reader035.vdocuments.us/reader035/viewer/2022081605/588403b41a28ab884b8b604b/html5/thumbnails/3.jpg)
Who am I?Raül PérezLead Software Engineer at R3 Labs Ltd.
Twitter: @repejotaGithub: https://github.com/repejotaEmail: [email protected]
3
● Almost 4 years working on devops & distributed projects.
Raül Pérez - @repejota NATS London - 10/05/2016
![Page 4: Patterns for Asynchronous Microservices with NATS](https://reader035.vdocuments.us/reader035/viewer/2022081605/588403b41a28ab884b8b604b/html5/thumbnails/4.jpg)
Who am I?Raül PérezLead Software Engineer at R3 Labs Ltd.
Twitter: @repejotaGithub: https://github.com/repejotaEmail: [email protected]
4
● Almost 4 years working on devops & distributed projects.
● Still more a dev than op dude.
Raül Pérez - @repejota NATS London - 10/05/2016
![Page 5: Patterns for Asynchronous Microservices with NATS](https://reader035.vdocuments.us/reader035/viewer/2022081605/588403b41a28ab884b8b604b/html5/thumbnails/5.jpg)
Who am I?Raül PérezLead Software Engineer at R3 Labs Ltd.
Twitter: @repejotaGithub: https://github.com/repejotaEmail: [email protected]
5
● Almost 4 years working on devops & distributed projects.
● Still more a dev than op dude.
● Proud to be a Gopher after a looong PHP/Ruby/Python/Node.js past experience. :P
Raül Pérez - @repejota NATS London - 10/05/2016
![Page 6: Patterns for Asynchronous Microservices with NATS](https://reader035.vdocuments.us/reader035/viewer/2022081605/588403b41a28ab884b8b604b/html5/thumbnails/6.jpg)
Who am I?Raül PérezLead Software Engineer at R3 Labs Ltd.
Twitter: @repejotaGithub: https://github.com/repejotaEmail: [email protected]
6
● Almost 4 years working on devops & distributed projects.
● Still more a dev than op dude.
● Proud to be a Gopher after a looong PHP/Ruby/Python/Node.js past experience. :P
● Based in Barcelona.Raül Pérez - @repejota NATS London - 10/05/2016
![Page 7: Patterns for Asynchronous Microservices with NATS](https://reader035.vdocuments.us/reader035/viewer/2022081605/588403b41a28ab884b8b604b/html5/thumbnails/7.jpg)
Who am I?Raül PérezLead Software Engineer at R3 Labs Ltd.
Twitter: @repejotaGithub: https://github.com/repejotaEmail: [email protected]
7
● Almost 4 years working on devops & distributed projects.
● Still more a dev than op dude.
● Proud to be a Gopher after a looong PHP/Ruby/Python/Node.js past experience. :P
● Based in Barcelona.
● Love startups & love remote work!
Raül Pérez - @repejota NATS London - 10/05/2016
![Page 8: Patterns for Asynchronous Microservices with NATS](https://reader035.vdocuments.us/reader035/viewer/2022081605/588403b41a28ab884b8b604b/html5/thumbnails/8.jpg)
Summary
8Raül Pérez - @repejota NATS London - 10/05/2016
● Why microservices?
● Synchronous vs. Asynchronous communication.● Pattern: Broker approach & NATS● Pattern: Autonomy of services vs. Coordination between services.
![Page 9: Patterns for Asynchronous Microservices with NATS](https://reader035.vdocuments.us/reader035/viewer/2022081605/588403b41a28ab884b8b604b/html5/thumbnails/9.jpg)
Why microservices?
9Raül Pérez - @repejota NATS London - 10/05/2016
● Loosely coupled components.● Specific responsibility, each one delivers a capability.● Designed to be defensive against failures.
![Page 10: Patterns for Asynchronous Microservices with NATS](https://reader035.vdocuments.us/reader035/viewer/2022081605/588403b41a28ab884b8b604b/html5/thumbnails/10.jpg)
Why microservices?
10Raül Pérez - @repejota NATS London - 10/05/2016
● Loosely coupled components.● Specific responsibility, each one delivers a capability.● Designed to be defensive against failures.
● Designed around business needs.● Decentralised governance.● Decentralised data management.● Connected through a common interface.
![Page 11: Patterns for Asynchronous Microservices with NATS](https://reader035.vdocuments.us/reader035/viewer/2022081605/588403b41a28ab884b8b604b/html5/thumbnails/11.jpg)
Pattern: Sync vs. Async communication.
11Raül Pérez - @repejota NATS London - 10/05/2016
● The most common interface to communicate is HTTP.● But HTTP is “mostly” synchronous.● Once the number of services grow, HTTP is sometimes not enough.
![Page 12: Patterns for Asynchronous Microservices with NATS](https://reader035.vdocuments.us/reader035/viewer/2022081605/588403b41a28ab884b8b604b/html5/thumbnails/12.jpg)
Pattern: Sync vs. Async communication.
12Raül Pérez - @repejota NATS London - 10/05/2016
● The most common interface to communicate is HTTP.
● But HTTP is “mostly” synchronous.● Once the number of services grow, HTTP is
not enough.
● It also has a complex error management.
![Page 13: Patterns for Asynchronous Microservices with NATS](https://reader035.vdocuments.us/reader035/viewer/2022081605/588403b41a28ab884b8b604b/html5/thumbnails/13.jpg)
Pattern: Sync vs. Async communication.
13Raül Pérez - @repejota NATS London - 10/05/2016
● Synchronous communication is simple but….○ Drawback: Suffers from latency on each connection.
● Asynchronous communication is faster but…○ Drawback: Increases the complexity.○ Drawback: Snowball effect, difficult to manage and orchestrate.
So, Is there a better communication interface?
![Page 14: Patterns for Asynchronous Microservices with NATS](https://reader035.vdocuments.us/reader035/viewer/2022081605/588403b41a28ab884b8b604b/html5/thumbnails/14.jpg)
Pattern: Sync vs. Async communication.
14Raül Pérez - @repejota NATS London - 10/05/2016
● Pattern: Use a broker to orchestrate your communication needs.○ AMPQ, RabbitMQ, NSQ, etc ….○ NATS :)
● A broker is flexible, allows you to use:○ Work queues.○ Publish/Subscribe.○ Request/Response.○ Message routing.○ etc...
![Page 15: Patterns for Asynchronous Microservices with NATS](https://reader035.vdocuments.us/reader035/viewer/2022081605/588403b41a28ab884b8b604b/html5/thumbnails/15.jpg)
Pattern: Broker approach & NATS
15Raül Pérez - @repejota NATS London - 10/05/2016
● Loosely coupled clients and servers.● Multiple patterns: Publish/Subscribe,
Request/Response.● Easy to scale.
![Page 16: Patterns for Asynchronous Microservices with NATS](https://reader035.vdocuments.us/reader035/viewer/2022081605/588403b41a28ab884b8b604b/html5/thumbnails/16.jpg)
Pattern: Broker approach & NATS
16Raül Pérez - @repejota NATS London - 10/05/2016
● Loosely coupled clients and servers.● Multiple patterns: Publish/Subscribe,
Request/Response.● Easy to scale.
● NATS is fast!
![Page 17: Patterns for Asynchronous Microservices with NATS](https://reader035.vdocuments.us/reader035/viewer/2022081605/588403b41a28ab884b8b604b/html5/thumbnails/17.jpg)
Pattern: Broker approach & NATS
17Raül Pérez - @repejota NATS London - 10/05/2016
● Loosely coupled clients and servers.● Multiple patterns: Publish/Subscribe,
Request/Response.● Easy to scale.
● NATS is fast!● Just a message system, no
assumptions, no extra features. Easy to deploy, easy to use.
![Page 18: Patterns for Asynchronous Microservices with NATS](https://reader035.vdocuments.us/reader035/viewer/2022081605/588403b41a28ab884b8b604b/html5/thumbnails/18.jpg)
Pattern: Broker approach & NATS
18Raül Pérez - @repejota NATS London - 10/05/2016
● Loosely coupled clients and servers.● Multiple patterns: Publish/Subscribe,
Request/Response.● Easy to scale.
● NATS is fast!● Just a message system, no
assumptions, no extra features. Easy to deploy, easy to use.
● It is also secure: SSL, password ...
![Page 19: Patterns for Asynchronous Microservices with NATS](https://reader035.vdocuments.us/reader035/viewer/2022081605/588403b41a28ab884b8b604b/html5/thumbnails/19.jpg)
Pattern: Broker approach & NATS
19Raül Pérez - @repejota NATS London - 10/05/2016
● Loosely coupled clients and servers.● Multiple patterns: Publish/Subscribe,
Request/Response.● Easy to scale.
● NATS is fast!● Just a message system, no
assumptions, no extra features. Easy to deploy, easy to use.
● It is also secure: SSL, password ...● Simple protocol, it is just text.
![Page 20: Patterns for Asynchronous Microservices with NATS](https://reader035.vdocuments.us/reader035/viewer/2022081605/588403b41a28ab884b8b604b/html5/thumbnails/20.jpg)
Pattern: Autonomy vs. Coordination.
20Raül Pérez - @repejota NATS London - 10/05/2016
● Make your services autonomous.● Avoid coordination between different services.● The minimal coordination the more optimal autonomy.● Increased autonomy gives it freedom to evolve.
![Page 21: Patterns for Asynchronous Microservices with NATS](https://reader035.vdocuments.us/reader035/viewer/2022081605/588403b41a28ab884b8b604b/html5/thumbnails/21.jpg)
Pattern: Autonomy vs. Coordination.
21Raül Pérez - @repejota NATS London - 10/05/2016
● Make your services autonomous.● Avoid coordination between different services.● The minimal coordination the more optimal autonomy.● Increased autonomy gives it freedom to evolve.
● Your services delivers “capabilities”
![Page 22: Patterns for Asynchronous Microservices with NATS](https://reader035.vdocuments.us/reader035/viewer/2022081605/588403b41a28ab884b8b604b/html5/thumbnails/22.jpg)
Pattern: Autonomy vs. Coordination.
22Raül Pérez - @repejota NATS London - 10/05/2016
● Make your services autonomous.● Avoid coordination between different services.● The minimal coordination the more optimal autonomy.● Increased autonomy gives it freedom to evolve.
● Your services delivers “capabilities”
● What is a capability?A complete business capability is a process that can be finished consecutively without interruptions or excursions to other services.
![Page 23: Patterns for Asynchronous Microservices with NATS](https://reader035.vdocuments.us/reader035/viewer/2022081605/588403b41a28ab884b8b604b/html5/thumbnails/23.jpg)
Resources● http://microservices.io
● https://en.wikipedia.org/wiki/Cloud_computing
● http://nats.io
23
● http://repejota.com
● http://r3labs.io
● http://ernest.io
● http://apcera.com Raül Pérez - @repejota NATS London - 10/05/2016
![Page 24: Patterns for Asynchronous Microservices with NATS](https://reader035.vdocuments.us/reader035/viewer/2022081605/588403b41a28ab884b8b604b/html5/thumbnails/24.jpg)
Questions?
Raül Pérez - @repejota NATS London - 10/05/2016
![Page 25: Patterns for Asynchronous Microservices with NATS](https://reader035.vdocuments.us/reader035/viewer/2022081605/588403b41a28ab884b8b604b/html5/thumbnails/25.jpg)
Thank you!
25Raül Pérez - @repejota NATS London - 10/05/2016