SlideShare a Scribd company logo
Integration Patterns for
Microservices Architectures
David Williams
Co-Founder & Partner
@DavWilliams
… in the Multi-Cloud Enterprise
Integration Patterns for Microservices Architectures
…in the Multi-Cloud Enterprise
… in the Multi-Cloud Enterprise
Integration Patterns for Microservices Architectures
“New-stack” consultants based in Atlanta, GA.
Leveraging the ecosystem of modern application
technologies to accelerate and improve the development,
deployment, and operability of enterprise applications.
… in the Multi-Cloud Enterprise
Integration Patterns for Microservices Architectures
My background:
sysadmin, architect, devops, product dev
My 20+ years in the industry:
application infrastructure aka middleware aka platforms
My passion:
traditional enterprise it -> disruptive technologies
… in the Multi-Cloud Enterprise
Integration Patterns for Microservices Architectures
what’s this NATS thing?
Introduced to NATS through…
Reintroduced to NATS through…
… in the Multi-Cloud Enterprise
Integration Patterns for Microservices Architectures
a common use-case
Backbone of interservice/intercomponent comms
• All communication between components is via NATS
• Announcement and notifications handled via NATS
• Interaction with controller (“brain”) is via NATS
… in the Multi-Cloud Enterprise
Integration Patterns for Microservices Architectures
…NATS literally is
their nervous system!
… in the Multi-Cloud Enterprise
Integration Patterns for Microservices Architectures
NATS == lightweight
Current Docker footprint
Even smaller when compressed…~2MB
… in the Multi-Cloud Enterprise
Integration Patterns for Microservices Architectures
NATS != slow
Source: http://bravenewgeek.com/dissecting-message-queues/
… in the Multi-Cloud Enterprise
Integration Patterns for Microservices Architectures
what’s a “microservice”
• A unit of execution containing everything from the OS,
framework, runtime and dependencies
• Independent, autonomous process with no
dependency on other microservices
• Communicate with each other through language and
platform-agnostic APIs, each having a exactly one well-
known entry point
… in the Multi-Cloud Enterprise
Integration Patterns for Microservices Architectures
microservice entry points
The microservice community favors two protocols that are
most commonly used:
1. HTTP request-response with resource APIs
2. Lightweight messaging
What’s the difference? Speed and scale?
… in the Multi-Cloud Enterprise
Integration Patterns for Microservices Architectures
A pattern catalog describing 65 integration patterns
Source: http://www.enterpriseintegrationpatterns.com/patterns/messaging/
… in the Multi-Cloud Enterprise
Integration Patterns for Microservices Architectures
• Applications were tightly-coupled
• Applications were large monoliths
• Enterprise applications were written in a single language,
the majority in Java
• Messaging systems were big and complex (and expensive!)
These patterns were “harvested” and documented in a time when …
… in the Multi-Cloud Enterprise
Integration Patterns for Microservices Architectures
anti-patterns
problem -> bad solution
… in the Multi-Cloud Enterprise
Integration Patterns for Microservices Architectures
the most common anti-pattern
in microservices architectures
Stovepipe
When existing software systems are migrated to a distributed
infrastructure. Arises when converting the existing software
interfaces to distributed interfaces.
… in the Multi-Cloud Enterprise
Integration Patterns for Microservices Architectures
Example of likely anti-patterns for microservices architectures
Any patterns that is transactional in nature:
Transactional Client, Competing Consumers, Message Expiration
Any pattern that requires the messaging system to persist messages:
Durable Subscriber, *Guaranteed Delivery, Claim Check
Any pattern where the messaging system inspects or modifies messages,
selectively routes message, or transforms message content:
Message Filter, Content Enricher, Content-Based Routing, Recipient List,
Routing Slip and Process Manager
* http://bravenewgeek.com/you-cannot-have-exactly-once-delivery/
… in the Multi-Cloud Enterprise
Integration Patterns for Microservices Architectures
* For a opinion of the fallacy of “Guaranteed Delivery”, visit:
http://bravenewgeek.com/what-you-want-is-what-you-dont-understanding-trade-offs-in-distributed-messaging/
“On systems that do claim some form of
guarantee, it’s best to look at what level that
guarantee really runs out. Especially around
persistence, exactly once delivery semantics,
etc. I spent much of my career designing and
building messaging systems that have those
guarantees, and in turn developed many
systems utilizing some of those features. For
me, I found that depending on these
guarantees was a bad pattern in distributed
system design…”
Derek Collison
… in the Multi-Cloud Enterprise
Integration Patterns for Microservices Architectures
so what are
“good patterns”
for micromessaging
(messaging with microservices)?
… in the Multi-Cloud Enterprise
Integration Patterns for Microservices Architectures
Basic design patterns you’re already familiar with…
Publish / Subscribe
Queueing
Request / Reply
Source:
http://www.slideshare.net/derekcollison/nats-a-new-nervous-system-for-distributed-cloud-platforms
… in the Multi-Cloud Enterprise
Integration Patterns for Microservices Architectures
putting those patterns
to use
with NATS
… in the Multi-Cloud Enterprise
Integration Patterns for Microservices Architectures
Design Pattern: Interservice Communication
Microservices communicate with each other via NATS messages.
All business and routing logic in the service, not the messaging system.
… in the Multi-Cloud Enterprise
Integration Patterns for Microservices Architectures
Design Pattern: Control Plane
Service state changes triggered by receipt of messages from “controller” service.
… in the Multi-Cloud Enterprise
Integration Patterns for Microservices Architectures
Design Pattern: Heartbeat
Each microservice publishes heartbeat (health) information via NATS.
… in the Multi-Cloud Enterprise
Integration Patterns for Microservices Architectures
Design Pattern: Real-Time Stream Processing
Ingest through NATS into stream processor.
Output processed stream via NATS to a SSE microservice.
… in the Multi-Cloud Enterprise
Integration Patterns for Microservices Architectures
Design Pattern: Event Store
Data written to, updated, or deleted from data store.
Notification message of event change sent via NATS.
… in the Multi-Cloud Enterprise
Integration Patterns for Microservices Architectures
Design Pattern: Data Pump
Universal “database driver” using microservices as data writers/readers
… in the Multi-Cloud Enterprise
Integration Patterns for Microservices Architectures
let’s go global
… in the Multi-Cloud Enterprise
Integration Patterns for Microservices Architectures
Design Pattern: Bridgehead
Information exchange between different sites/regions via NATS
… in the Multi-Cloud Enterprise
Integration Patterns for Microservices Architectures
why should developers
have all the fun?
… in the Multi-Cloud Enterprise
Integration Patterns for Microservices Architectures
Design Pattern: DevOps Gone Wild
Messaging as part of the infrastructure engineering & the DevOps toolchain
… in the Multi-Cloud Enterprise
Integration Patterns for Microservices Architectures
Design Pattern: Global Domination
All services, everywhere, communicating via NATS
… in the Multi-Cloud Enterprise
Integration Patterns for Microservices Architectures
don’t be like this guy
… in the Multi-Cloud Enterprise
Integration Patterns for Microservices Architectures
in summary
Microservices architectures provide an
opportunity to re-evaluate the way we think about
communication in the composable enterprise.
… in the Multi-Cloud Enterprise
Integration Patterns for Microservices Architectures
resources
Project site:
http://nats.io/
Referenced in deck:
http://bravenewgeek.com/what-you-want-is-what-you-dont-understanding-trade-offs-in-distributed-messaging/
http://slideshare.net/derekcollison/nats-a-new-nervous-system-for-distributed-cloud-platforms
http://bravenewgeek.com/dissecting-message-queues/
Get it here:
http://nats.io/download/
https://hub.docker.com/_/nats/
https://github.com/nats-io/gnatsd
… in the Multi-Cloud Enterprise
Integration Patterns for Microservices Architectures
questions?

More Related Content

Integration Patterns and Anti-Patterns for Microservices Architectures

  • 1. Integration Patterns for Microservices Architectures David Williams Co-Founder & Partner @DavWilliams
  • 2. … in the Multi-Cloud Enterprise Integration Patterns for Microservices Architectures …in the Multi-Cloud Enterprise
  • 3. … in the Multi-Cloud Enterprise Integration Patterns for Microservices Architectures “New-stack” consultants based in Atlanta, GA. Leveraging the ecosystem of modern application technologies to accelerate and improve the development, deployment, and operability of enterprise applications.
  • 4. … in the Multi-Cloud Enterprise Integration Patterns for Microservices Architectures My background: sysadmin, architect, devops, product dev My 20+ years in the industry: application infrastructure aka middleware aka platforms My passion: traditional enterprise it -> disruptive technologies
  • 5. … in the Multi-Cloud Enterprise Integration Patterns for Microservices Architectures what’s this NATS thing? Introduced to NATS through… Reintroduced to NATS through…
  • 6. … in the Multi-Cloud Enterprise Integration Patterns for Microservices Architectures a common use-case Backbone of interservice/intercomponent comms • All communication between components is via NATS • Announcement and notifications handled via NATS • Interaction with controller (“brain”) is via NATS
  • 7. … in the Multi-Cloud Enterprise Integration Patterns for Microservices Architectures …NATS literally is their nervous system!
  • 8. … in the Multi-Cloud Enterprise Integration Patterns for Microservices Architectures NATS == lightweight Current Docker footprint Even smaller when compressed…~2MB
  • 9. … in the Multi-Cloud Enterprise Integration Patterns for Microservices Architectures NATS != slow Source: http://bravenewgeek.com/dissecting-message-queues/
  • 10. … in the Multi-Cloud Enterprise Integration Patterns for Microservices Architectures what’s a “microservice” • A unit of execution containing everything from the OS, framework, runtime and dependencies • Independent, autonomous process with no dependency on other microservices • Communicate with each other through language and platform-agnostic APIs, each having a exactly one well- known entry point
  • 11. … in the Multi-Cloud Enterprise Integration Patterns for Microservices Architectures microservice entry points The microservice community favors two protocols that are most commonly used: 1. HTTP request-response with resource APIs 2. Lightweight messaging What’s the difference? Speed and scale?
  • 12. … in the Multi-Cloud Enterprise Integration Patterns for Microservices Architectures A pattern catalog describing 65 integration patterns Source: http://www.enterpriseintegrationpatterns.com/patterns/messaging/
  • 13. … in the Multi-Cloud Enterprise Integration Patterns for Microservices Architectures • Applications were tightly-coupled • Applications were large monoliths • Enterprise applications were written in a single language, the majority in Java • Messaging systems were big and complex (and expensive!) These patterns were “harvested” and documented in a time when …
  • 14. … in the Multi-Cloud Enterprise Integration Patterns for Microservices Architectures anti-patterns problem -> bad solution
  • 15. … in the Multi-Cloud Enterprise Integration Patterns for Microservices Architectures the most common anti-pattern in microservices architectures Stovepipe When existing software systems are migrated to a distributed infrastructure. Arises when converting the existing software interfaces to distributed interfaces.
  • 16. … in the Multi-Cloud Enterprise Integration Patterns for Microservices Architectures Example of likely anti-patterns for microservices architectures Any patterns that is transactional in nature: Transactional Client, Competing Consumers, Message Expiration Any pattern that requires the messaging system to persist messages: Durable Subscriber, *Guaranteed Delivery, Claim Check Any pattern where the messaging system inspects or modifies messages, selectively routes message, or transforms message content: Message Filter, Content Enricher, Content-Based Routing, Recipient List, Routing Slip and Process Manager * http://bravenewgeek.com/you-cannot-have-exactly-once-delivery/
  • 17. … in the Multi-Cloud Enterprise Integration Patterns for Microservices Architectures * For a opinion of the fallacy of “Guaranteed Delivery”, visit: http://bravenewgeek.com/what-you-want-is-what-you-dont-understanding-trade-offs-in-distributed-messaging/ “On systems that do claim some form of guarantee, it’s best to look at what level that guarantee really runs out. Especially around persistence, exactly once delivery semantics, etc. I spent much of my career designing and building messaging systems that have those guarantees, and in turn developed many systems utilizing some of those features. For me, I found that depending on these guarantees was a bad pattern in distributed system design…” Derek Collison
  • 18. … in the Multi-Cloud Enterprise Integration Patterns for Microservices Architectures so what are “good patterns” for micromessaging (messaging with microservices)?
  • 19. … in the Multi-Cloud Enterprise Integration Patterns for Microservices Architectures Basic design patterns you’re already familiar with… Publish / Subscribe Queueing Request / Reply Source: http://www.slideshare.net/derekcollison/nats-a-new-nervous-system-for-distributed-cloud-platforms
  • 20. … in the Multi-Cloud Enterprise Integration Patterns for Microservices Architectures putting those patterns to use with NATS
  • 21. … in the Multi-Cloud Enterprise Integration Patterns for Microservices Architectures Design Pattern: Interservice Communication Microservices communicate with each other via NATS messages. All business and routing logic in the service, not the messaging system.
  • 22. … in the Multi-Cloud Enterprise Integration Patterns for Microservices Architectures Design Pattern: Control Plane Service state changes triggered by receipt of messages from “controller” service.
  • 23. … in the Multi-Cloud Enterprise Integration Patterns for Microservices Architectures Design Pattern: Heartbeat Each microservice publishes heartbeat (health) information via NATS.
  • 24. … in the Multi-Cloud Enterprise Integration Patterns for Microservices Architectures Design Pattern: Real-Time Stream Processing Ingest through NATS into stream processor. Output processed stream via NATS to a SSE microservice.
  • 25. … in the Multi-Cloud Enterprise Integration Patterns for Microservices Architectures Design Pattern: Event Store Data written to, updated, or deleted from data store. Notification message of event change sent via NATS.
  • 26. … in the Multi-Cloud Enterprise Integration Patterns for Microservices Architectures Design Pattern: Data Pump Universal “database driver” using microservices as data writers/readers
  • 27. … in the Multi-Cloud Enterprise Integration Patterns for Microservices Architectures let’s go global
  • 28. … in the Multi-Cloud Enterprise Integration Patterns for Microservices Architectures Design Pattern: Bridgehead Information exchange between different sites/regions via NATS
  • 29. … in the Multi-Cloud Enterprise Integration Patterns for Microservices Architectures why should developers have all the fun?
  • 30. … in the Multi-Cloud Enterprise Integration Patterns for Microservices Architectures Design Pattern: DevOps Gone Wild Messaging as part of the infrastructure engineering & the DevOps toolchain
  • 31. … in the Multi-Cloud Enterprise Integration Patterns for Microservices Architectures Design Pattern: Global Domination All services, everywhere, communicating via NATS
  • 32. … in the Multi-Cloud Enterprise Integration Patterns for Microservices Architectures don’t be like this guy
  • 33. … in the Multi-Cloud Enterprise Integration Patterns for Microservices Architectures in summary Microservices architectures provide an opportunity to re-evaluate the way we think about communication in the composable enterprise.
  • 34. … in the Multi-Cloud Enterprise Integration Patterns for Microservices Architectures resources Project site: http://nats.io/ Referenced in deck: http://bravenewgeek.com/what-you-want-is-what-you-dont-understanding-trade-offs-in-distributed-messaging/ http://slideshare.net/derekcollison/nats-a-new-nervous-system-for-distributed-cloud-platforms http://bravenewgeek.com/dissecting-message-queues/ Get it here: http://nats.io/download/ https://hub.docker.com/_/nats/ https://github.com/nats-io/gnatsd
  • 35. … in the Multi-Cloud Enterprise Integration Patterns for Microservices Architectures questions?