SlideShare a Scribd company logo
1 of 32
Download to read offline
A Primer On Cloud-Native
Distributed Systems Architectures
Shiju Varghese
https://medium.com/@shijuvar
CodeUp Kochi- Cloud Native Application Architecture
21st April, 2018
About Me
• Consulting Solutions Architect: Go and Distributed Systems
• Early adopter of Go
• Speaker at GopherCon India, Great Indian Developer Summit
• Published Author
• Honoured with Microsoft MVP Award Seven Times
Blog: https://medium.com/@shijuvar | Github: https://github.com/shijuvar | LinkedIn: https://in.linkedin.com/in/shijuv
Author
Agenda
• Introduction to Cloud-Native
• Overview on Cloud-Native Distributed Systems Architectures
• Overview on Microservices based Distributed Systems
What is Cloud-Native?
• Containerized. Each part (applications, processes, etc) is packaged in
its own container. This facilitates reproducibility, transparency, and
resource isolation.
• Dynamically orchestrated. Containers are actively scheduled and
managed to optimize resource utilization.
• Microservices oriented. Applications are segmented into
microservices. This significantly increases the overall agility and
maintainability of applications.
Attributes of Cloud Native Applications
• Packages as light weight containers
• Isolated from hardware and operating system dependencies
• Leverage best of the breed languages and frameworks
• Designed as loosely coupled services
• Deployed on self-service, elastic and cloud infrastructure
• APIs are backbone for interaction and collaboration
• Clean separation of stateless and stateful services
• Managed through agile DevOps processes
• Take advantage of automation capabilities
• NATS for Messaging
• containerd for Container Runtime
• rkt for Container Runtime
• Kubernetes for Container Orchestration
• Linkerd for Service Mesh
• gRPC for Remote Procedure Call
• Container Network Interface (CNI) for Container Networking
• CoreDNS for Service Discovery
• Prometheus for Monitoring
• OpenTracing for Tracing
• Fluentd for Logging
Eric Brewer’s CAP Theorem
• Consistency: Every read receives the most recent write or an error
• Availability: Every request receives a (non-error) response – without
guarantee that it contains the most recent write
• Partition tolerance: The system continues to operate despite an
arbitrary number of messages being dropped (or delayed) by the
network between nodes
A system can only have two of the following three properties:
Microservices Architecture
• Composed	of	a	suite	of	small	services	
• Each	service	runs	in	its	own	process	
• Greater	flexibility	for	scalability
Monolithic Architecture
f
eCom Store
Catalog Management
Customer Accounts
Orders Management
Payment
SQL Server
(Monolithic
Database)
Mobile
Client
Browser
Client
Monolithic Commerce App
Microservices Architecture
Product
Catalog
Service
Customer
Service
Order
Service
Payment
Service
Product
Catalog
Database
Customer
Database
Order
Database
Payment
Database
API
Gateway
Browser
Client
Mobile
Client
REST
REST
Microservices is an architectural style for building highly
scalable applications, in which an application
decomposes into a set of services as functional
components.
Microservices Architecture is all about functional
decomposition.
Autonomous Services around Bounded Context
• Software broken up into functional components.
• Componentization via Services in which each service is packaged as one
unit of execution.
• Independent, autonomous process with no dependency on other
Microservices.
• Services are organized around business capability.
• Decentralization of Data Management.
• Independently replaceable and upgradeable.
Product
Catalog
Service
Customer
Service
Order
Service
Payment
Service
Product
Catalog
Database
Customer
Database
Order
Database
Payment
Database
• Single-purpose, domain model
based bounded context
• Database per service
• Isolated persistence
Challenges
• Decentralised data that is scattered amongst many databases
• How do you make inter-process communication?
• Can we use RESTful APIs
• What are the alternatives if RESTful APIs are not scalable
• How do you manage data persistence that spans in multiple multiples databases?
• How do you query data that spans in multiple multiples databases?
• How do you manage data consistency?
gRPC for inter-process communication in Cloud-
Native architectures
gRPC
• High performance, open-source RPC framework
• Open source version of Google’s internal framework Stubby
• Uses Protocol Buffers as the IDL
• HTTP/2 for transport
• Bi-Directional streaming
• RPC is Efficient, Domain-Specific and Strongly-Typed
• Works across languages and platforms
Types of RPC Methods
• Simple RPC
• Server-side streaming RPC
• Client-side streaming RPC
• Bi-directional streaming RPC
gRPC Workflow
ProtoBuf
Definitions
protoc
Compiler
Go
Ruby
Java
gRPC
Server
gRPC Client
Define1 Compile2
Implement3
Generate Code
protoc --go_out=plugins=grpc
Event-Driven Architectures for Cloud-Native
Distributed Systems
Event-Driven Approach
Customer
Service
Order
Service
Order
Database
Publish Events
Message
Broker
Publish Events
Subscribe Events
Subscribe Events
Event: OrderCreated
Events As Facts
• A fact represents something that has happened in the past.
• Facts are immutable - they can’t be changed or be retracted
Event-Driven Architectures
• Application Events
• Transaction log tailing
• Event Sourcing
Event Sourcing
• An event-centric pattern for implementing business logic and
persisting aggregates
• Events represent state changes of aggregates; Publishes domain
events on mutations of aggregates
• Event log for the aggregates
• Preserves the history of aggregates
• Avoids the O/R impedance mismatch problem
Aggregate ID Aggregate Type Event ID Event Type Event Date
301 Order 1001 OrderCreated …
301 Order 1002 OrderApproved …
301 Order 1003 OrderShipped …
301 Order 1004 OrderDelivered …
Event Table of Event-Sourcing
CQRS
Image Courtesy: http://martinfowler.com
Event Sourcing defines Microservices
architecture as a web of event-driven aggregates
Query Model Sync with NATS QueueGroup
Demo
Client App
Order Service
REST API
Event Store
gRPC Server
NATS ProducerProtoBuf
Command -CockroachDB
Cluster
Node 1 Node 2 Node N
Events
NATS Streaming
Server
Event Logs
Restaurant
Service
NATS Consumer
Query Store -1
NATS Consumer
Query Store -2
NATS Consumer
Query -CockroachDB
Cluster
Node 1 Node 2 Node N
Technology:
• Go
• gRPC with ProtoBuf
• NATS Streaming
• CockroachDB
Source:https://github.com/shijuvar/gokit/tree/master/examples/nats-streaming
Example Events:
• OrderCreated
• OrderApproved
• OrderRejected
• OrderShipped
• OrderDelivered
Distributed Saga
Distributed Saga
Local Transaction 1
Aggregate A
Microservice 1
Command
Local Transaction 2
Aggregate B
Microservice 2
Command
Local Transaction 3
Aggregate C
Microservice 3
Command
Saga Orchestrator orchestrates the transactions spans in multiple
services on aggregates that ensures the data consistency
Thanks
Shiju Varghese
gophermonk@gmail.com
https://medium.com/@shijuvar
https://github.com/shijuvar
https://linkedin.com/in/shijuvar
Go Programming Workshops: https://github.com/shijuvar/gokit/tree/master/training

More Related Content

More from Shiju Varghese

A Primer to Containerization & Microservices
A Primer to Containerization & MicroservicesA Primer to Containerization & Microservices
A Primer to Containerization & MicroservicesShiju Varghese
 
Writing HTTP Middleware In Go
Writing HTTP Middleware In GoWriting HTTP Middleware In Go
Writing HTTP Middleware In GoShiju Varghese
 
Building RESTful Services With Go and MongoDB
Building RESTful Services With Go and MongoDBBuilding RESTful Services With Go and MongoDB
Building RESTful Services With Go and MongoDBShiju Varghese
 
Practicing Mindfulness
Practicing MindfulnessPracticing Mindfulness
Practicing MindfulnessShiju Varghese
 
Azure Mobile Services .NET Backend
Azure Mobile Services .NET BackendAzure Mobile Services .NET Backend
Azure Mobile Services .NET BackendShiju Varghese
 
Windows Azure Mobile Services
Windows Azure Mobile ServicesWindows Azure Mobile Services
Windows Azure Mobile ServicesShiju Varghese
 
JavaScript, Meet Cloud : Node.js on Windows Azure
JavaScript, Meet Cloud : Node.js on Windows AzureJavaScript, Meet Cloud : Node.js on Windows Azure
JavaScript, Meet Cloud : Node.js on Windows AzureShiju Varghese
 
Introduction to Node js
Introduction to Node jsIntroduction to Node js
Introduction to Node jsShiju Varghese
 
Windows Azure Cloud Services
Windows Azure Cloud Services Windows Azure Cloud Services
Windows Azure Cloud Services Shiju Varghese
 
Windows Azure Webs Sites
Windows Azure Webs SitesWindows Azure Webs Sites
Windows Azure Webs SitesShiju Varghese
 
Building Apps with Node.js
Building Apps with Node.jsBuilding Apps with Node.js
Building Apps with Node.jsShiju Varghese
 
Introducing Razor - A new view engine for ASP.NET
Introducing Razor - A new view engine for ASP.NET Introducing Razor - A new view engine for ASP.NET
Introducing Razor - A new view engine for ASP.NET Shiju Varghese
 
NoSQL Database in .NET Apps
NoSQL Database in .NET AppsNoSQL Database in .NET Apps
NoSQL Database in .NET AppsShiju Varghese
 
TDD with ASP.NET MVC 1.0
TDD with ASP.NET MVC 1.0TDD with ASP.NET MVC 1.0
TDD with ASP.NET MVC 1.0Shiju Varghese
 
Introduction to ASP.NET MVC 1.0
Introduction to ASP.NET MVC 1.0Introduction to ASP.NET MVC 1.0
Introduction to ASP.NET MVC 1.0Shiju Varghese
 

More from Shiju Varghese (18)

A Primer to Containerization & Microservices
A Primer to Containerization & MicroservicesA Primer to Containerization & Microservices
A Primer to Containerization & Microservices
 
Writing HTTP Middleware In Go
Writing HTTP Middleware In GoWriting HTTP Middleware In Go
Writing HTTP Middleware In Go
 
Building RESTful Services With Go and MongoDB
Building RESTful Services With Go and MongoDBBuilding RESTful Services With Go and MongoDB
Building RESTful Services With Go and MongoDB
 
Docker and Kubernetes
Docker and KubernetesDocker and Kubernetes
Docker and Kubernetes
 
Practicing Mindfulness
Practicing MindfulnessPracticing Mindfulness
Practicing Mindfulness
 
Azure DocumentDB
Azure DocumentDBAzure DocumentDB
Azure DocumentDB
 
Azure Mobile Services .NET Backend
Azure Mobile Services .NET BackendAzure Mobile Services .NET Backend
Azure Mobile Services .NET Backend
 
Windows Azure Mobile Services
Windows Azure Mobile ServicesWindows Azure Mobile Services
Windows Azure Mobile Services
 
JavaScript, Meet Cloud : Node.js on Windows Azure
JavaScript, Meet Cloud : Node.js on Windows AzureJavaScript, Meet Cloud : Node.js on Windows Azure
JavaScript, Meet Cloud : Node.js on Windows Azure
 
Introduction to Node js
Introduction to Node jsIntroduction to Node js
Introduction to Node js
 
Windows Azure Cloud Services
Windows Azure Cloud Services Windows Azure Cloud Services
Windows Azure Cloud Services
 
Windows Azure Webs Sites
Windows Azure Webs SitesWindows Azure Webs Sites
Windows Azure Webs Sites
 
Building Apps with Node.js
Building Apps with Node.jsBuilding Apps with Node.js
Building Apps with Node.js
 
Node on Windows Azure
Node on Windows AzureNode on Windows Azure
Node on Windows Azure
 
Introducing Razor - A new view engine for ASP.NET
Introducing Razor - A new view engine for ASP.NET Introducing Razor - A new view engine for ASP.NET
Introducing Razor - A new view engine for ASP.NET
 
NoSQL Database in .NET Apps
NoSQL Database in .NET AppsNoSQL Database in .NET Apps
NoSQL Database in .NET Apps
 
TDD with ASP.NET MVC 1.0
TDD with ASP.NET MVC 1.0TDD with ASP.NET MVC 1.0
TDD with ASP.NET MVC 1.0
 
Introduction to ASP.NET MVC 1.0
Introduction to ASP.NET MVC 1.0Introduction to ASP.NET MVC 1.0
Introduction to ASP.NET MVC 1.0
 

Recently uploaded

My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 

Recently uploaded (20)

My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 

Cloud Native Distributed Systems Architectures

  • 1. A Primer On Cloud-Native Distributed Systems Architectures Shiju Varghese https://medium.com/@shijuvar CodeUp Kochi- Cloud Native Application Architecture 21st April, 2018
  • 2. About Me • Consulting Solutions Architect: Go and Distributed Systems • Early adopter of Go • Speaker at GopherCon India, Great Indian Developer Summit • Published Author • Honoured with Microsoft MVP Award Seven Times Blog: https://medium.com/@shijuvar | Github: https://github.com/shijuvar | LinkedIn: https://in.linkedin.com/in/shijuv
  • 4. Agenda • Introduction to Cloud-Native • Overview on Cloud-Native Distributed Systems Architectures • Overview on Microservices based Distributed Systems
  • 5. What is Cloud-Native? • Containerized. Each part (applications, processes, etc) is packaged in its own container. This facilitates reproducibility, transparency, and resource isolation. • Dynamically orchestrated. Containers are actively scheduled and managed to optimize resource utilization. • Microservices oriented. Applications are segmented into microservices. This significantly increases the overall agility and maintainability of applications.
  • 6. Attributes of Cloud Native Applications • Packages as light weight containers • Isolated from hardware and operating system dependencies • Leverage best of the breed languages and frameworks • Designed as loosely coupled services • Deployed on self-service, elastic and cloud infrastructure • APIs are backbone for interaction and collaboration • Clean separation of stateless and stateful services • Managed through agile DevOps processes • Take advantage of automation capabilities
  • 7. • NATS for Messaging • containerd for Container Runtime • rkt for Container Runtime • Kubernetes for Container Orchestration • Linkerd for Service Mesh • gRPC for Remote Procedure Call • Container Network Interface (CNI) for Container Networking • CoreDNS for Service Discovery • Prometheus for Monitoring • OpenTracing for Tracing • Fluentd for Logging
  • 8. Eric Brewer’s CAP Theorem • Consistency: Every read receives the most recent write or an error • Availability: Every request receives a (non-error) response – without guarantee that it contains the most recent write • Partition tolerance: The system continues to operate despite an arbitrary number of messages being dropped (or delayed) by the network between nodes A system can only have two of the following three properties:
  • 9. Microservices Architecture • Composed of a suite of small services • Each service runs in its own process • Greater flexibility for scalability
  • 10. Monolithic Architecture f eCom Store Catalog Management Customer Accounts Orders Management Payment SQL Server (Monolithic Database) Mobile Client Browser Client Monolithic Commerce App
  • 12.
  • 13. Microservices is an architectural style for building highly scalable applications, in which an application decomposes into a set of services as functional components. Microservices Architecture is all about functional decomposition.
  • 14. Autonomous Services around Bounded Context • Software broken up into functional components. • Componentization via Services in which each service is packaged as one unit of execution. • Independent, autonomous process with no dependency on other Microservices. • Services are organized around business capability. • Decentralization of Data Management. • Independently replaceable and upgradeable.
  • 16. Challenges • Decentralised data that is scattered amongst many databases • How do you make inter-process communication? • Can we use RESTful APIs • What are the alternatives if RESTful APIs are not scalable • How do you manage data persistence that spans in multiple multiples databases? • How do you query data that spans in multiple multiples databases? • How do you manage data consistency?
  • 17. gRPC for inter-process communication in Cloud- Native architectures
  • 18. gRPC • High performance, open-source RPC framework • Open source version of Google’s internal framework Stubby • Uses Protocol Buffers as the IDL • HTTP/2 for transport • Bi-Directional streaming • RPC is Efficient, Domain-Specific and Strongly-Typed • Works across languages and platforms
  • 19. Types of RPC Methods • Simple RPC • Server-side streaming RPC • Client-side streaming RPC • Bi-directional streaming RPC
  • 20. gRPC Workflow ProtoBuf Definitions protoc Compiler Go Ruby Java gRPC Server gRPC Client Define1 Compile2 Implement3 Generate Code protoc --go_out=plugins=grpc
  • 21. Event-Driven Architectures for Cloud-Native Distributed Systems
  • 23. Events As Facts • A fact represents something that has happened in the past. • Facts are immutable - they can’t be changed or be retracted
  • 24. Event-Driven Architectures • Application Events • Transaction log tailing • Event Sourcing
  • 26. • An event-centric pattern for implementing business logic and persisting aggregates • Events represent state changes of aggregates; Publishes domain events on mutations of aggregates • Event log for the aggregates • Preserves the history of aggregates • Avoids the O/R impedance mismatch problem
  • 27. Aggregate ID Aggregate Type Event ID Event Type Event Date 301 Order 1001 OrderCreated … 301 Order 1002 OrderApproved … 301 Order 1003 OrderShipped … 301 Order 1004 OrderDelivered … Event Table of Event-Sourcing
  • 29. Event Sourcing defines Microservices architecture as a web of event-driven aggregates
  • 30. Query Model Sync with NATS QueueGroup Demo Client App Order Service REST API Event Store gRPC Server NATS ProducerProtoBuf Command -CockroachDB Cluster Node 1 Node 2 Node N Events NATS Streaming Server Event Logs Restaurant Service NATS Consumer Query Store -1 NATS Consumer Query Store -2 NATS Consumer Query -CockroachDB Cluster Node 1 Node 2 Node N Technology: • Go • gRPC with ProtoBuf • NATS Streaming • CockroachDB Source:https://github.com/shijuvar/gokit/tree/master/examples/nats-streaming Example Events: • OrderCreated • OrderApproved • OrderRejected • OrderShipped • OrderDelivered
  • 31. Distributed Saga Distributed Saga Local Transaction 1 Aggregate A Microservice 1 Command Local Transaction 2 Aggregate B Microservice 2 Command Local Transaction 3 Aggregate C Microservice 3 Command Saga Orchestrator orchestrates the transactions spans in multiple services on aggregates that ensures the data consistency