SlideShare a Scribd company logo
1 of 33
Download to read offline
Designing Microservices with
NATS
October 8, 2021
Microservices
The term microservices architecture refers
to a distributed computing architecture that is
built using a set of small, autonomous
services that act as a cohesive unit to solve a
business problem or problems
Advantages of Microservices
● Build highly scalable applications
● Build robust applications that withstand failures
● Better utilization of computing infrastructure
● Helps innovation with reduced time to market
● Build modular systems that are easy to manage and maintain
Characteristics of Microservices
● Independently deployable
● Design for failure
● Decentralized data management
● Domain driven design (finite scope per service)
● Agile development
● Container based deployments
Challenges of Microservices
● Inter-service communication
● Observability
● Error handling and troubleshooting
● Security
Inter-service communication for microservices
● Service Mesh based approach
○ Point to point communication
○ Become complex with the increase of microservices
○ Separate data plane and control plane
● Message Broker based approach
○ Fully decoupled communication
○ Complexity does not increase with the number of microservices
○ Subject based messaging
NATS
NATS:
Modern messaging framework that
allows developers and operators to
build distributed systems
Why NATS?
● High performance:
○ NATS performs better than most of the existing message broker products, including
Kafka and RabbitMQ.
● Lightweight:
○ It does not need sophisticated hardware and complex deployment models to support
large message volumes.
● Simple to use:
○ It supplies a simple API to use the system. NATS has clients for over 30 programming
languages.
● At most once and at least once delivery:
○ Supports message guarantees required by applications.
● Support for event handling:
○ It can handle event streams with better performance.
NATS use cases
● Microservice-based applications:
○ Service mesh and inter-service messaging
● Event streaming applications:
○ Observability/analytics
○ Machine learning
○ Artificial intelligence
● Command and control-based systems:
○ Internet of Things (IoT) and edge computing
○ Telemetry/sensor data/command and control
● Augmenting or replacing legacy messaging systems
How NATS work?
● NATS uses a subject based messaging model with a fully decoupled publisher and a
subscriber
● Supports following message distribution mechanisms
○ Publish-Subscribe (topic based)
○ Request-Reply
○ Queue groups (load balancing)
● Messages are published on a subject and the consumers subscribe to the subject
● Wildcard subscriptions are allowed so that consumers can listen to messages from different
subjects and different publishers
NATS subject based messaging
● Supports wiretap messaging with
wildcard “>”
● Multi character wildcard can be
used to listen on a certain pattern of
subjects
● Specific subject name is used to
receive messages from specific
publishers
NATS request-reply messaging
● Publisher specifies a reply subject
(inbox)
● Subscriber respond through the
reply subject
● NATS can filter multiple responses
and send the first (fastest) response
NATS queue-groups messaging
● Publisher publishes on a subject. It
is not aware of the queue group
● Subscribers form a queue group by
specifying a common name for the
queue parameter
● Messages are delivered to the
subscribers in a load balanced
manner
NATS Clustering
● Helps scaling the NATS infrastructure according to the requirements of the application
● Clustering forms a fully connected server mesh. All nodes are aware of all the other nodes.
● Nodes are connected via sending simple messages (gossip) and does not require
pre-configuration of all the nodes
● Messages are replicated to one of the adjacent node so that node failure does not cause a
message loss
● Publisher and Subscriber can connect to different nodes (location transparency) to share
messages
● Most applications can be supported with a 3-node cluster
Microservices with NATS
Microservices Inner-Outer Architecture
● Microservices does not exist in isolation.
● Inner Architecture deals with
○ Individual microservices
○ Inter-Service Communication
● Outer Architecture deals with
○ Integration with other parts of the enterprise platform
○ Governance of the microservices teams and processes
○ Shared services such as automation, infrastructure, observability
Microservices Inner-Outer Architecture
Building an Outpatient Department (OPD) Application
● A hospital OPD unit performs various tasks related to patient care
● Patient Registration
○ Admit new patients to the unit and register them on the system
● Patient Inspection
○ A physician inspect the patient and decide on the next steps
● Patient Treatment
○ Based on the inspection, nurses take care of the temporary treatments including
medication and doing various tests
● Patient Release
○ Once the temporary treatment is done, patient is discharged from the unit and send
back home or admit to a long term ward for further treatments
OPD Application Design with NATS
OPD Application Implementation
● Each microservice has its own database to store data related to that microservice
● Messages are used to share data between services
● Registration Service stores the patient details in the database and publish an event to the
inspection service with the patient ID and token number
● Inspection Service listens to the event and do the inspection and update its database with
inspection details. The required information is passed to the treatment service via an event.
● Treatment service receives the event and take actions accordingly and store the medication
schedules and test results in its database. Once the patient is ready to be released, it sends a
message via an event to the release service.
● Release service receives the event and discharge the patient and update its database.
Securing Microservices
● Security for external communications
○ Client applications consuming the services
○ Different types of clients including mobile, web and
standalone
○ Require advanced, standard security
○ OAuth 2.0 is becoming the de facto
○ API Gateways provides a standard mechanism to
implement security
● Security for internal communications
○ Services communicate with the NATS server
○ NATS support basic authentication, key based
authentication, JWT based authentication
○ Security can be implemented with TLS only since
consumers are internal (trusted subsystem)
Observability for Microservices with NATS
● Observability is a characteristic of the platform which defines how well the internal states of
a platform can be inferred from the knowledge of its external output
● It is a responsibility of each component in the platform to implement enough observability
through the external output such as
○ Log entries
○ Health check endpoints
○ Metrics endpoints
○ Application dashboards
● NATS supports observability through
○ Logging
○ Monitoring endpoints
Implementing Observability for Microservices with NATS
Implementing Observability for Microservices with NATS
● Microservices implements /healthz and /metrics endpoints to provide application statistics
and status.
● Microservices publish logs to application specific log files
● NATS server has a separate log file and a set of endpoints to collect application statistics
● Prometheus collects application statistics from the endpoints of microservices and the NATS
server and publishes to Grafana
● Promtail and Loki collects log entries and publishes to Grafana for visualization
● Grafana is used to create dashboards for microservices and NATS server monitoring and
alert generation
Microservices and Integration Platforms
● Enterprise platforms consists of heterogeneous systems that needs to be integrated.
● Microservices based applications are one such component in the overall architecture.
● Integration Platforms plays a pivotal role in enterprise by doing
○ Application Integration
○ Data Integration
○ B2B Integration
○ API Management
● Microservices needs to co-exist with Integration Platforms
Microservices and Integration Platforms
Microservices and Integration Platforms
● API-driven architecture is common within enterprise software platforms
● Services implemented at different layers based on their functionality and exposes APIs so
that subsequent layers can consume
● Microservices can implement services at one of these layers or at core business functionality
layer
● Microservices can integrate with other parts of the enterprise platform through the
integration platform since it supports the interoperability and acts as the anti-corruption
layer
Future of Microservices and NATS
● Trends/Developments in Microservices domain
○ Service Mesh is becoming popular though most people still failing to use it
○ Usage of Saga pattern to implement transactional microservices
○ Serverless platforms provides easier approach to build microservices based applications
● What’s new in NATS?
○ JetStream is becoming popular for streaming use cases of NATS which requires
advanced message delivery guarantees and persistence
○ NATS is used to build asynchronous logging frameworks and Service Mesh
Future of Microservices and NATS
● Trends/Developments in Microservices domain
○ Service Mesh is becoming popular though most people still failing to use it
○ Usage of Saga pattern to implement transactional microservices
○ Serverless platforms provides easier approach to build microservices based applications
● What’s new in NATS?
○ JetStream is becoming popular for streaming use cases of NATS which requires
advanced message delivery guarantees and persistence
○ NATS is used to build asynchronous logging frameworks and Service Mesh
Learn More
● The book that contains more
details can be found here
https://www.packtpub.com/product/d
esigning-microservices-platforms-wit
h-nats/9781801072212
Follow me
Chanaka Fernando, Associate
Director @ WSO2
Medium - https://medium.com/@chanakaudaya
Twitter - https://twitter.com/chanakaudaya
LinkedIn - https://www.linkedin.com/in/chanakaudaya
Github - https://github.com/chanakaudaya

More Related Content

What's hot

Istio : Service Mesh
Istio : Service MeshIstio : Service Mesh
Istio : Service MeshKnoldus Inc.
 
NATS for Modern Messaging and Microservices
NATS for Modern Messaging and Microservices NATS for Modern Messaging and Microservices
NATS for Modern Messaging and Microservices NATS
 
OpenShift Virtualization- Technical Overview.pdf
OpenShift Virtualization- Technical Overview.pdfOpenShift Virtualization- Technical Overview.pdf
OpenShift Virtualization- Technical Overview.pdfssuser1490e8
 
OpenTelemetry For Architects
OpenTelemetry For ArchitectsOpenTelemetry For Architects
OpenTelemetry For ArchitectsKevin Brockhoff
 
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...Edureka!
 
Integration Patterns and Anti-Patterns for Microservices Architectures
Integration Patterns and Anti-Patterns for Microservices ArchitecturesIntegration Patterns and Anti-Patterns for Microservices Architectures
Integration Patterns and Anti-Patterns for Microservices ArchitecturesApcera
 
Traffic Control with Envoy Proxy
Traffic Control with Envoy ProxyTraffic Control with Envoy Proxy
Traffic Control with Envoy ProxyMark McBride
 
Cluster management with Kubernetes
Cluster management with KubernetesCluster management with Kubernetes
Cluster management with KubernetesSatnam Singh
 
A New Way of Thinking | NATS 2.0 & Connectivity
A New Way of Thinking | NATS 2.0 & ConnectivityA New Way of Thinking | NATS 2.0 & Connectivity
A New Way of Thinking | NATS 2.0 & ConnectivityNATS
 
NATS vs HTTP for Interservice Communication
NATS vs HTTP for Interservice CommunicationNATS vs HTTP for Interservice Communication
NATS vs HTTP for Interservice CommunicationNATS
 
Kubernetes - A Comprehensive Overview
Kubernetes - A Comprehensive OverviewKubernetes - A Comprehensive Overview
Kubernetes - A Comprehensive OverviewBob Killen
 
Kubernetes - introduction
Kubernetes - introductionKubernetes - introduction
Kubernetes - introductionSparkbit
 
Kubernetes and service mesh application
Kubernetes  and service mesh applicationKubernetes  and service mesh application
Kubernetes and service mesh applicationThao Huynh Quang
 
GitOps and ArgoCD
GitOps and ArgoCDGitOps and ArgoCD
GitOps and ArgoCDOmar Fathy
 
NATS for Modern Messaging and Microservices
NATS for Modern Messaging and MicroservicesNATS for Modern Messaging and Microservices
NATS for Modern Messaging and MicroservicesApcera
 
Kubernetes
KubernetesKubernetes
Kuberneteserialc_w
 
NATS vs HTTP
NATS vs HTTPNATS vs HTTP
NATS vs HTTPApcera
 
Gitlab ci, cncf.sk
Gitlab ci, cncf.skGitlab ci, cncf.sk
Gitlab ci, cncf.skJuraj Hantak
 

What's hot (20)

Istio : Service Mesh
Istio : Service MeshIstio : Service Mesh
Istio : Service Mesh
 
NATS for Modern Messaging and Microservices
NATS for Modern Messaging and Microservices NATS for Modern Messaging and Microservices
NATS for Modern Messaging and Microservices
 
OpenShift Virtualization- Technical Overview.pdf
OpenShift Virtualization- Technical Overview.pdfOpenShift Virtualization- Technical Overview.pdf
OpenShift Virtualization- Technical Overview.pdf
 
OpenTelemetry For Architects
OpenTelemetry For ArchitectsOpenTelemetry For Architects
OpenTelemetry For Architects
 
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...
 
Integration Patterns and Anti-Patterns for Microservices Architectures
Integration Patterns and Anti-Patterns for Microservices ArchitecturesIntegration Patterns and Anti-Patterns for Microservices Architectures
Integration Patterns and Anti-Patterns for Microservices Architectures
 
Traffic Control with Envoy Proxy
Traffic Control with Envoy ProxyTraffic Control with Envoy Proxy
Traffic Control with Envoy Proxy
 
Cluster management with Kubernetes
Cluster management with KubernetesCluster management with Kubernetes
Cluster management with Kubernetes
 
A New Way of Thinking | NATS 2.0 & Connectivity
A New Way of Thinking | NATS 2.0 & ConnectivityA New Way of Thinking | NATS 2.0 & Connectivity
A New Way of Thinking | NATS 2.0 & Connectivity
 
NATS vs HTTP for Interservice Communication
NATS vs HTTP for Interservice CommunicationNATS vs HTTP for Interservice Communication
NATS vs HTTP for Interservice Communication
 
Kubernetes - A Comprehensive Overview
Kubernetes - A Comprehensive OverviewKubernetes - A Comprehensive Overview
Kubernetes - A Comprehensive Overview
 
Kubernetes - introduction
Kubernetes - introductionKubernetes - introduction
Kubernetes - introduction
 
Kubernetes and service mesh application
Kubernetes  and service mesh applicationKubernetes  and service mesh application
Kubernetes and service mesh application
 
Service mesh
Service meshService mesh
Service mesh
 
GitOps and ArgoCD
GitOps and ArgoCDGitOps and ArgoCD
GitOps and ArgoCD
 
NATS for Modern Messaging and Microservices
NATS for Modern Messaging and MicroservicesNATS for Modern Messaging and Microservices
NATS for Modern Messaging and Microservices
 
Kubernetes
KubernetesKubernetes
Kubernetes
 
Argocd up and running
Argocd up and runningArgocd up and running
Argocd up and running
 
NATS vs HTTP
NATS vs HTTPNATS vs HTTP
NATS vs HTTP
 
Gitlab ci, cncf.sk
Gitlab ci, cncf.skGitlab ci, cncf.sk
Gitlab ci, cncf.sk
 

Similar to Designing microservices platforms with nats

Ato Z of Microservices Architecture by Systango
Ato Z of Microservices Architecture by SystangoAto Z of Microservices Architecture by Systango
Ato Z of Microservices Architecture by SystangoSystango
 
NGINX Microservices Reference Architecture: What’s in Store for 2019 – EMEA
NGINX Microservices Reference Architecture: What’s in Store for 2019 – EMEANGINX Microservices Reference Architecture: What’s in Store for 2019 – EMEA
NGINX Microservices Reference Architecture: What’s in Store for 2019 – EMEANGINX, Inc.
 
Kenzan: Architecting for Microservices
Kenzan: Architecting for MicroservicesKenzan: Architecting for Microservices
Kenzan: Architecting for MicroservicesDarren Bathgate
 
Introduction to Microservices Architecture - SECCOMP 2020
Introduction to Microservices Architecture - SECCOMP 2020Introduction to Microservices Architecture - SECCOMP 2020
Introduction to Microservices Architecture - SECCOMP 2020Rodrigo Antonialli
 
Introduction to Microservices.pdf
Introduction to Microservices.pdfIntroduction to Microservices.pdf
Introduction to Microservices.pdfShehanNIlanka
 
Istio and Kubernetes Relationship
Istio and Kubernetes RelationshipIstio and Kubernetes Relationship
Istio and Kubernetes RelationshipKnoldus Inc.
 
APIdays Paris 2019 - Cloud native API Management for Microservices on a Servi...
APIdays Paris 2019 - Cloud native API Management for Microservices on a Servi...APIdays Paris 2019 - Cloud native API Management for Microservices on a Servi...
APIdays Paris 2019 - Cloud native API Management for Microservices on a Servi...apidays
 
Building microservices on azure
Building microservices on azureBuilding microservices on azure
Building microservices on azureVaibhav Gujral
 
Docker microservices and the service mesh
Docker microservices and the service meshDocker microservices and the service mesh
Docker microservices and the service meshDocker, Inc.
 
[APIdays Paris 2019] API Management in Service Mesh Using Istio and WSO2 API ...
[APIdays Paris 2019] API Management in Service Mesh Using Istio and WSO2 API ...[APIdays Paris 2019] API Management in Service Mesh Using Istio and WSO2 API ...
[APIdays Paris 2019] API Management in Service Mesh Using Istio and WSO2 API ...WSO2
 
MRA AMA: Ingenious: The Journey to Service Mesh using a Microservices Demo App
MRA AMA: Ingenious: The Journey to Service Mesh using a Microservices Demo AppMRA AMA: Ingenious: The Journey to Service Mesh using a Microservices Demo App
MRA AMA: Ingenious: The Journey to Service Mesh using a Microservices Demo AppNGINX, Inc.
 
Ledingkart Meetup #1: Monolithic to microservices in action
Ledingkart Meetup #1: Monolithic to microservices in actionLedingkart Meetup #1: Monolithic to microservices in action
Ledingkart Meetup #1: Monolithic to microservices in actionMukesh Singh
 
DevOps-training-in-chandigarh-Join-now--
DevOps-training-in-chandigarh-Join-now--DevOps-training-in-chandigarh-Join-now--
DevOps-training-in-chandigarh-Join-now--asmeerana605
 
Service Mesh Talk for CTO Forum
Service Mesh Talk for CTO ForumService Mesh Talk for CTO Forum
Service Mesh Talk for CTO ForumRick Hightower
 
Cloud Computing and Data Centers
Cloud Computing and Data CentersCloud Computing and Data Centers
Cloud Computing and Data Centersbega karadza
 
[WSO2Con Asia 2018] Talk Microservices to Me: The Role of IAM in Microservice...
[WSO2Con Asia 2018] Talk Microservices to Me: The Role of IAM in Microservice...[WSO2Con Asia 2018] Talk Microservices to Me: The Role of IAM in Microservice...
[WSO2Con Asia 2018] Talk Microservices to Me: The Role of IAM in Microservice...WSO2
 
The Role of IAM in Microservices
The Role of IAM in MicroservicesThe Role of IAM in Microservices
The Role of IAM in MicroservicesWSO2
 

Similar to Designing microservices platforms with nats (20)

Ato Z of Microservices Architecture by Systango
Ato Z of Microservices Architecture by SystangoAto Z of Microservices Architecture by Systango
Ato Z of Microservices Architecture by Systango
 
NGINX Microservices Reference Architecture: What’s in Store for 2019 – EMEA
NGINX Microservices Reference Architecture: What’s in Store for 2019 – EMEANGINX Microservices Reference Architecture: What’s in Store for 2019 – EMEA
NGINX Microservices Reference Architecture: What’s in Store for 2019 – EMEA
 
Kenzan: Architecting for Microservices
Kenzan: Architecting for MicroservicesKenzan: Architecting for Microservices
Kenzan: Architecting for Microservices
 
1 (1).pptx
1 (1).pptx1 (1).pptx
1 (1).pptx
 
Introduction to Microservices Architecture - SECCOMP 2020
Introduction to Microservices Architecture - SECCOMP 2020Introduction to Microservices Architecture - SECCOMP 2020
Introduction to Microservices Architecture - SECCOMP 2020
 
Introduction to Microservices.pdf
Introduction to Microservices.pdfIntroduction to Microservices.pdf
Introduction to Microservices.pdf
 
Istio and Kubernetes Relationship
Istio and Kubernetes RelationshipIstio and Kubernetes Relationship
Istio and Kubernetes Relationship
 
Microservices-101
Microservices-101Microservices-101
Microservices-101
 
APIdays Paris 2019 - Cloud native API Management for Microservices on a Servi...
APIdays Paris 2019 - Cloud native API Management for Microservices on a Servi...APIdays Paris 2019 - Cloud native API Management for Microservices on a Servi...
APIdays Paris 2019 - Cloud native API Management for Microservices on a Servi...
 
Building microservices on azure
Building microservices on azureBuilding microservices on azure
Building microservices on azure
 
Docker microservices and the service mesh
Docker microservices and the service meshDocker microservices and the service mesh
Docker microservices and the service mesh
 
[APIdays Paris 2019] API Management in Service Mesh Using Istio and WSO2 API ...
[APIdays Paris 2019] API Management in Service Mesh Using Istio and WSO2 API ...[APIdays Paris 2019] API Management in Service Mesh Using Istio and WSO2 API ...
[APIdays Paris 2019] API Management in Service Mesh Using Istio and WSO2 API ...
 
MRA AMA: Ingenious: The Journey to Service Mesh using a Microservices Demo App
MRA AMA: Ingenious: The Journey to Service Mesh using a Microservices Demo AppMRA AMA: Ingenious: The Journey to Service Mesh using a Microservices Demo App
MRA AMA: Ingenious: The Journey to Service Mesh using a Microservices Demo App
 
Ledingkart Meetup #1: Monolithic to microservices in action
Ledingkart Meetup #1: Monolithic to microservices in actionLedingkart Meetup #1: Monolithic to microservices in action
Ledingkart Meetup #1: Monolithic to microservices in action
 
DevOps-training-in-chandigarh-Join-now--
DevOps-training-in-chandigarh-Join-now--DevOps-training-in-chandigarh-Join-now--
DevOps-training-in-chandigarh-Join-now--
 
Micro Services Intro
Micro Services IntroMicro Services Intro
Micro Services Intro
 
Service Mesh Talk for CTO Forum
Service Mesh Talk for CTO ForumService Mesh Talk for CTO Forum
Service Mesh Talk for CTO Forum
 
Cloud Computing and Data Centers
Cloud Computing and Data CentersCloud Computing and Data Centers
Cloud Computing and Data Centers
 
[WSO2Con Asia 2018] Talk Microservices to Me: The Role of IAM in Microservice...
[WSO2Con Asia 2018] Talk Microservices to Me: The Role of IAM in Microservice...[WSO2Con Asia 2018] Talk Microservices to Me: The Role of IAM in Microservice...
[WSO2Con Asia 2018] Talk Microservices to Me: The Role of IAM in Microservice...
 
The Role of IAM in Microservices
The Role of IAM in MicroservicesThe Role of IAM in Microservices
The Role of IAM in Microservices
 

More from Chanaka Fernando

WSO2 API microgateway introduction
WSO2 API microgateway introductionWSO2 API microgateway introduction
WSO2 API microgateway introductionChanaka Fernando
 
Wso2 api microgateway deployment patterns
Wso2 api microgateway deployment patternsWso2 api microgateway deployment patterns
Wso2 api microgateway deployment patternsChanaka Fernando
 
Federated api management with wso2 api manager
Federated api management with wso2 api managerFederated api management with wso2 api manager
Federated api management with wso2 api managerChanaka Fernando
 
Wso2 enterprise integrator deployment patterns
Wso2 enterprise integrator deployment patternsWso2 enterprise integrator deployment patterns
Wso2 enterprise integrator deployment patternsChanaka Fernando
 
Api management best practices with wso2 api manager
Api management best practices with wso2 api managerApi management best practices with wso2 api manager
Api management best practices with wso2 api managerChanaka Fernando
 
Wso2 api manager analytics and reporting
Wso2 api manager analytics and reportingWso2 api manager analytics and reporting
Wso2 api manager analytics and reportingChanaka Fernando
 
Exploring ballerina toolset (docker, testing, tracing, analytics, and more) ...
Exploring ballerina toolset (docker, testing, tracing, analytics, and more)  ...Exploring ballerina toolset (docker, testing, tracing, analytics, and more)  ...
Exploring ballerina toolset (docker, testing, tracing, analytics, and more) ...Chanaka Fernando
 
File processing and websockets with ballerina chanaka edited
File processing and websockets with ballerina chanaka editedFile processing and websockets with ballerina chanaka edited
File processing and websockets with ballerina chanaka editedChanaka Fernando
 
Hybrid integration platform reference architecture
Hybrid integration platform reference architectureHybrid integration platform reference architecture
Hybrid integration platform reference architectureChanaka Fernando
 
Wso2 integration platform deep dive eu con 2016
Wso2 integration platform deep dive   eu con 2016Wso2 integration platform deep dive   eu con 2016
Wso2 integration platform deep dive eu con 2016Chanaka Fernando
 
Wso2 esb-maintenance-guide
Wso2 esb-maintenance-guideWso2 esb-maintenance-guide
Wso2 esb-maintenance-guideChanaka Fernando
 
Wso2 con eu 2016 an introduction to the wso2 integration platform by chanak...
Wso2 con eu 2016   an introduction to the wso2 integration platform by chanak...Wso2 con eu 2016   an introduction to the wso2 integration platform by chanak...
Wso2 con eu 2016 an introduction to the wso2 integration platform by chanak...Chanaka Fernando
 
Wso2 esb 5.0.0 product release webinar
Wso2 esb 5.0.0   product release webinarWso2 esb 5.0.0   product release webinar
Wso2 esb 5.0.0 product release webinarChanaka Fernando
 
Introduction to WSO2 ESB Pass-Through Transport
Introduction to WSO2 ESB Pass-Through TransportIntroduction to WSO2 ESB Pass-Through Transport
Introduction to WSO2 ESB Pass-Through TransportChanaka Fernando
 

More from Chanaka Fernando (17)

WSO2 API microgateway introduction
WSO2 API microgateway introductionWSO2 API microgateway introduction
WSO2 API microgateway introduction
 
Wso2 api microgateway deployment patterns
Wso2 api microgateway deployment patternsWso2 api microgateway deployment patterns
Wso2 api microgateway deployment patterns
 
Federated api management with wso2 api manager
Federated api management with wso2 api managerFederated api management with wso2 api manager
Federated api management with wso2 api manager
 
Wso2 enterprise integrator deployment patterns
Wso2 enterprise integrator deployment patternsWso2 enterprise integrator deployment patterns
Wso2 enterprise integrator deployment patterns
 
Api management best practices with wso2 api manager
Api management best practices with wso2 api managerApi management best practices with wso2 api manager
Api management best practices with wso2 api manager
 
Wso2 api manager analytics and reporting
Wso2 api manager analytics and reportingWso2 api manager analytics and reporting
Wso2 api manager analytics and reporting
 
Exploring ballerina toolset (docker, testing, tracing, analytics, and more) ...
Exploring ballerina toolset (docker, testing, tracing, analytics, and more)  ...Exploring ballerina toolset (docker, testing, tracing, analytics, and more)  ...
Exploring ballerina toolset (docker, testing, tracing, analytics, and more) ...
 
File processing and websockets with ballerina chanaka edited
File processing and websockets with ballerina chanaka editedFile processing and websockets with ballerina chanaka edited
File processing and websockets with ballerina chanaka edited
 
Hybrid integration platform reference architecture
Hybrid integration platform reference architectureHybrid integration platform reference architecture
Hybrid integration platform reference architecture
 
Wso2 esb-rest-integration
Wso2 esb-rest-integrationWso2 esb-rest-integration
Wso2 esb-rest-integration
 
Wso2 integration platform deep dive eu con 2016
Wso2 integration platform deep dive   eu con 2016Wso2 integration platform deep dive   eu con 2016
Wso2 integration platform deep dive eu con 2016
 
Wso2 esb-maintenance-guide
Wso2 esb-maintenance-guideWso2 esb-maintenance-guide
Wso2 esb-maintenance-guide
 
Advaced training-wso2-esb
Advaced training-wso2-esbAdvaced training-wso2-esb
Advaced training-wso2-esb
 
Wso2 con eu 2016 an introduction to the wso2 integration platform by chanak...
Wso2 con eu 2016   an introduction to the wso2 integration platform by chanak...Wso2 con eu 2016   an introduction to the wso2 integration platform by chanak...
Wso2 con eu 2016 an introduction to the wso2 integration platform by chanak...
 
Esb 4.9.0 release webinar
Esb 4.9.0 release webinarEsb 4.9.0 release webinar
Esb 4.9.0 release webinar
 
Wso2 esb 5.0.0 product release webinar
Wso2 esb 5.0.0   product release webinarWso2 esb 5.0.0   product release webinar
Wso2 esb 5.0.0 product release webinar
 
Introduction to WSO2 ESB Pass-Through Transport
Introduction to WSO2 ESB Pass-Through TransportIntroduction to WSO2 ESB Pass-Through Transport
Introduction to WSO2 ESB Pass-Through Transport
 

Recently uploaded

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 

Recently uploaded (20)

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 

Designing microservices platforms with nats

  • 3. The term microservices architecture refers to a distributed computing architecture that is built using a set of small, autonomous services that act as a cohesive unit to solve a business problem or problems
  • 4. Advantages of Microservices ● Build highly scalable applications ● Build robust applications that withstand failures ● Better utilization of computing infrastructure ● Helps innovation with reduced time to market ● Build modular systems that are easy to manage and maintain
  • 5. Characteristics of Microservices ● Independently deployable ● Design for failure ● Decentralized data management ● Domain driven design (finite scope per service) ● Agile development ● Container based deployments
  • 6. Challenges of Microservices ● Inter-service communication ● Observability ● Error handling and troubleshooting ● Security
  • 7. Inter-service communication for microservices ● Service Mesh based approach ○ Point to point communication ○ Become complex with the increase of microservices ○ Separate data plane and control plane ● Message Broker based approach ○ Fully decoupled communication ○ Complexity does not increase with the number of microservices ○ Subject based messaging
  • 9. NATS: Modern messaging framework that allows developers and operators to build distributed systems
  • 10. Why NATS? ● High performance: ○ NATS performs better than most of the existing message broker products, including Kafka and RabbitMQ. ● Lightweight: ○ It does not need sophisticated hardware and complex deployment models to support large message volumes. ● Simple to use: ○ It supplies a simple API to use the system. NATS has clients for over 30 programming languages. ● At most once and at least once delivery: ○ Supports message guarantees required by applications. ● Support for event handling: ○ It can handle event streams with better performance.
  • 11. NATS use cases ● Microservice-based applications: ○ Service mesh and inter-service messaging ● Event streaming applications: ○ Observability/analytics ○ Machine learning ○ Artificial intelligence ● Command and control-based systems: ○ Internet of Things (IoT) and edge computing ○ Telemetry/sensor data/command and control ● Augmenting or replacing legacy messaging systems
  • 12. How NATS work? ● NATS uses a subject based messaging model with a fully decoupled publisher and a subscriber ● Supports following message distribution mechanisms ○ Publish-Subscribe (topic based) ○ Request-Reply ○ Queue groups (load balancing) ● Messages are published on a subject and the consumers subscribe to the subject ● Wildcard subscriptions are allowed so that consumers can listen to messages from different subjects and different publishers
  • 13. NATS subject based messaging ● Supports wiretap messaging with wildcard “>” ● Multi character wildcard can be used to listen on a certain pattern of subjects ● Specific subject name is used to receive messages from specific publishers
  • 14. NATS request-reply messaging ● Publisher specifies a reply subject (inbox) ● Subscriber respond through the reply subject ● NATS can filter multiple responses and send the first (fastest) response
  • 15. NATS queue-groups messaging ● Publisher publishes on a subject. It is not aware of the queue group ● Subscribers form a queue group by specifying a common name for the queue parameter ● Messages are delivered to the subscribers in a load balanced manner
  • 16. NATS Clustering ● Helps scaling the NATS infrastructure according to the requirements of the application ● Clustering forms a fully connected server mesh. All nodes are aware of all the other nodes. ● Nodes are connected via sending simple messages (gossip) and does not require pre-configuration of all the nodes ● Messages are replicated to one of the adjacent node so that node failure does not cause a message loss ● Publisher and Subscriber can connect to different nodes (location transparency) to share messages ● Most applications can be supported with a 3-node cluster
  • 18. Microservices Inner-Outer Architecture ● Microservices does not exist in isolation. ● Inner Architecture deals with ○ Individual microservices ○ Inter-Service Communication ● Outer Architecture deals with ○ Integration with other parts of the enterprise platform ○ Governance of the microservices teams and processes ○ Shared services such as automation, infrastructure, observability
  • 20. Building an Outpatient Department (OPD) Application ● A hospital OPD unit performs various tasks related to patient care ● Patient Registration ○ Admit new patients to the unit and register them on the system ● Patient Inspection ○ A physician inspect the patient and decide on the next steps ● Patient Treatment ○ Based on the inspection, nurses take care of the temporary treatments including medication and doing various tests ● Patient Release ○ Once the temporary treatment is done, patient is discharged from the unit and send back home or admit to a long term ward for further treatments
  • 22. OPD Application Implementation ● Each microservice has its own database to store data related to that microservice ● Messages are used to share data between services ● Registration Service stores the patient details in the database and publish an event to the inspection service with the patient ID and token number ● Inspection Service listens to the event and do the inspection and update its database with inspection details. The required information is passed to the treatment service via an event. ● Treatment service receives the event and take actions accordingly and store the medication schedules and test results in its database. Once the patient is ready to be released, it sends a message via an event to the release service. ● Release service receives the event and discharge the patient and update its database.
  • 23. Securing Microservices ● Security for external communications ○ Client applications consuming the services ○ Different types of clients including mobile, web and standalone ○ Require advanced, standard security ○ OAuth 2.0 is becoming the de facto ○ API Gateways provides a standard mechanism to implement security ● Security for internal communications ○ Services communicate with the NATS server ○ NATS support basic authentication, key based authentication, JWT based authentication ○ Security can be implemented with TLS only since consumers are internal (trusted subsystem)
  • 24. Observability for Microservices with NATS ● Observability is a characteristic of the platform which defines how well the internal states of a platform can be inferred from the knowledge of its external output ● It is a responsibility of each component in the platform to implement enough observability through the external output such as ○ Log entries ○ Health check endpoints ○ Metrics endpoints ○ Application dashboards ● NATS supports observability through ○ Logging ○ Monitoring endpoints
  • 25. Implementing Observability for Microservices with NATS
  • 26. Implementing Observability for Microservices with NATS ● Microservices implements /healthz and /metrics endpoints to provide application statistics and status. ● Microservices publish logs to application specific log files ● NATS server has a separate log file and a set of endpoints to collect application statistics ● Prometheus collects application statistics from the endpoints of microservices and the NATS server and publishes to Grafana ● Promtail and Loki collects log entries and publishes to Grafana for visualization ● Grafana is used to create dashboards for microservices and NATS server monitoring and alert generation
  • 27. Microservices and Integration Platforms ● Enterprise platforms consists of heterogeneous systems that needs to be integrated. ● Microservices based applications are one such component in the overall architecture. ● Integration Platforms plays a pivotal role in enterprise by doing ○ Application Integration ○ Data Integration ○ B2B Integration ○ API Management ● Microservices needs to co-exist with Integration Platforms
  • 29. Microservices and Integration Platforms ● API-driven architecture is common within enterprise software platforms ● Services implemented at different layers based on their functionality and exposes APIs so that subsequent layers can consume ● Microservices can implement services at one of these layers or at core business functionality layer ● Microservices can integrate with other parts of the enterprise platform through the integration platform since it supports the interoperability and acts as the anti-corruption layer
  • 30. Future of Microservices and NATS ● Trends/Developments in Microservices domain ○ Service Mesh is becoming popular though most people still failing to use it ○ Usage of Saga pattern to implement transactional microservices ○ Serverless platforms provides easier approach to build microservices based applications ● What’s new in NATS? ○ JetStream is becoming popular for streaming use cases of NATS which requires advanced message delivery guarantees and persistence ○ NATS is used to build asynchronous logging frameworks and Service Mesh
  • 31. Future of Microservices and NATS ● Trends/Developments in Microservices domain ○ Service Mesh is becoming popular though most people still failing to use it ○ Usage of Saga pattern to implement transactional microservices ○ Serverless platforms provides easier approach to build microservices based applications ● What’s new in NATS? ○ JetStream is becoming popular for streaming use cases of NATS which requires advanced message delivery guarantees and persistence ○ NATS is used to build asynchronous logging frameworks and Service Mesh
  • 32. Learn More ● The book that contains more details can be found here https://www.packtpub.com/product/d esigning-microservices-platforms-wit h-nats/9781801072212
  • 33. Follow me Chanaka Fernando, Associate Director @ WSO2 Medium - https://medium.com/@chanakaudaya Twitter - https://twitter.com/chanakaudaya LinkedIn - https://www.linkedin.com/in/chanakaudaya Github - https://github.com/chanakaudaya