SlideShare a Scribd company logo
1 of 35
1
Tudip Technologies
Continuously Delivering Digital Solutions with
Integrity | Innovation | Serenity
https://tudip.com/
Database Design for
Containerized Microservices
The world where we live in...
Organizations which design
systems … are constrained to
produce designs which are copies
of the communication structures of
these organizations.
-  M. Conway
Corollary by
James and Neil:
Therefore: Make sure the
organization is compatible
with the product architecture.
“
”
© 2019 Tudip Technologies. All Rights Reserved.
OTT System in Microservice Architecture
What is Microservice Architecture?
● As per Martin Fowler, services in a
microservice architecture (MSA) are often
processes that communicate over a network to
fulfill a goal using technology-agnostic
protocols such as HTTP.
● Services are independently deployable.
● Services are organized around fine-grained
business capabilities.
● Services can be implemented using different
programming languages, databases, hardware
and software environment, depending on what
fits best.
● This does not mean that a single microservice
is written in a patchwork of programming
languages.
© 2019 Tudip Technologies. All Rights Reserved.
• Multiple Components
• Built For Business, instead of technology
• Simple Routing
• Decentralized
• Failure Resistant
• Evolutionary
Salient features of Microservices
© 2019 Tudip Technologies. All Rights Reserved.
Loose coupling is the operative word, that means microservices should be able
to be modified without requiring changes in other microservices.
Overall Microservices
© 2019 Tudip Technologies. All Rights Reserved.
Microservices Pros
• Freedom to independently develop and
deploy services
• A microservice can be developed by a
fairly small team
• Code for different services can be written
in different languages (though
practitioners discourage it)
• Easy integration and automatic
deployment
• Easy to understand and modify for
developers, thus can help a new team
member become productive quickly
• The developers can make use of the
latest technologies
• The code is organized around business
capabilities
• When change is required in a certain part
of the application, only the related service
can be modified and redeployed—no
need to modify and redeploy the entire
application
• Better fault isolation: if one microservice
fails, the other will continue to work
• Easy to scale and integrate with third-
party services
• No long-term commitment to technology
stack
© 2019 Tudip Technologies. All Rights Reserved.
Microservices Cons
• Due to distributed deployment, testing
can become complicated and tedious
• Increasing number of services can result
in information barriers
• The architecture brings additional
complexity as the developers have to
mitigate fault tolerance, network latency,
and deal with a variety of message
formats as well as load balancing
• Being a distributed system, it can result in
duplication of effort
• When number of services increases,
integration and managing whole products
can become complicated
• In addition to several complexities of
monolithic architecture, the developers
have to deal with the additional
complexity of a distributed system
• Developers have to put additional effort
into implementing the mechanism of
communication between the services
• Handling use cases that span more than
one service without using distributed
transactions is not only tough but also
requires communication and cooperation
between different teams
© 2019 Tudip Technologies. All Rights Reserved.
How Micro a Microservice should be?
Amazon's policy is that the team implementing a microservice
should be small enough that they can be fed by two-pizzas.
© 2019 Tudip Technologies. All Rights Reserved.
Is it all Rosy?
© 2019 Tudip Technologies. All Rights Reserved.
The Hardest Part About Microservices:
Database Design
© 2019 Tudip Technologies. All Rights Reserved.
Yes, database is the DOG!
© 2019 Tudip Technologies. All Rights Reserved.
Broadly, you have 2 options!
© 2019 Tudip Technologies. All Rights Reserved.
Option # 1, Monolithic Database
© 2019 Tudip Technologies. All Rights Reserved.
Option #1.1, Variation of Monolithic Database
© 2019 Tudip Technologies. All Rights Reserved.
Option #2, Multiple Databases
© 2019 Tudip Technologies. All Rights Reserved.
Problems in Monolithic Database
• You can NOT scale a service without scaling the database
• You can not deploy a service because change in 1 schema, going to affect other
microservices and hence you can not do Continuous Integration/Continuous
Deployments
• You would be stuck with an RDBMS OR NoSQL and can NOT pick what works the
best
• And hence, service preference of the DB would be completely lost
© 2019 Tudip Technologies. All Rights Reserved.
Well, what about 2PC (Phase Commits)
• 2PC, is a mechanism for implementing a transaction across different software
components (multiple databases, message queues etc.)
• Well, if that is how you implement, the ghosts of limitations of Monolithic Database are
going to Haunt You!
© 2019 Tudip Technologies. All Rights Reserved.
Again, monolithic database is a DOG!
© 2019 Tudip Technologies. All Rights Reserved.
The Hardest Part About Microservices:
Your Data
https://blog.christianposta.com/microservices/the-hardest-part-about-microservices-data/
But challenges of the Database per Service..
© 2019 Tudip Technologies. All Rights Reserved.
Multiple Databases has its own challenges!
● Complexity of managing multiple SQL and NoSQL databases
● Implementing business transactions that span multiple services is not straightforward.
Moreover, many modern (NoSQL) databases don’t support them. The best solution is
to use the Saga pattern. Services publish events when they update data. Other
services subscribe to events and update their data in response.
● Implementing queries that join data that is now in multiple databases is challenging.
© 2019 Tudip Technologies. All Rights Reserved.
Saga
• Implement each business transaction that spans multiple services as a saga.
• A saga is a sequence of local transactions.
• Each local transaction updates the database and publishes a message or event to
trigger the next local transaction in the saga. If a local transaction fails because it
violates a business rule then the saga executes a series of compensating
transactions that undo the changes that were made by the preceding local
transactions.
© 2019 Tudip Technologies. All Rights Reserved.
Saga Continues
© 2019 Tudip Technologies. All Rights Reserved.
2 ways to coordinating the Saga
• There are two ways of coordination sagas:
• Choreography - each local transaction publishes domain events that trigger
local transactions in other services
• Orchestration - an orchestrator (object) tells the participants what local
transactions to execute
© 2019 Tudip Technologies. All Rights Reserved.
Here is choreography-based Saga
© 2019 Tudip Technologies. All Rights Reserved.
Choreography-based saga
© 2019 Tudip Technologies. All Rights Reserved.
Orchestration-based saga
© 2019 Tudip Technologies. All Rights Reserved.
And here is an Orchestra
© 2019 Tudip Technologies. All Rights Reserved.
And then there is always CQRS
© 2019 Tudip Technologies. All Rights Reserved.
CQRS: Command Query Responsibility Segregation
© 2019 Tudip Technologies. All Rights Reserved.
How did it work in one of our OTT project?
© 2019 Tudip Technologies. All Rights Reserved.
What all we have used in this application?
● Saga
● Along with CQRS
© 2019 Tudip Technologies. All Rights Reserved.
References
• https://en.wikipedia.org/wiki/Microservices
• https://en.wikipedia.org/wiki/Conway%27s_law
• https://microservices.io/patterns/data/event-sourcing.html
• https://auth0.com/blog/introduction-to-microservices-part-4-dependencies/
• https://stackoverflow.com/questions/41640621/data-sharing-between-micro-services
• https://www.baeldung.com/transactions-across-microservices
35
Thank You
Know more about Tudip here!

More Related Content

What's hot (7)

Net essentials6e ch11
Net essentials6e ch11Net essentials6e ch11
Net essentials6e ch11
 
Exchange + WIndows Mobile Datasheet
Exchange + WIndows Mobile DatasheetExchange + WIndows Mobile Datasheet
Exchange + WIndows Mobile Datasheet
 
IT Infrastructure and Emerging Technologies
IT Infrastructure and Emerging TechnologiesIT Infrastructure and Emerging Technologies
IT Infrastructure and Emerging Technologies
 
IT Inftractructures - Evolution of IT Inftractructure
IT Inftractructures - Evolution of IT InftractructureIT Inftractructures - Evolution of IT Inftractructure
IT Inftractructures - Evolution of IT Inftractructure
 
Mobile Database and Service Oriented Architecture
Mobile Database and Service Oriented ArchitectureMobile Database and Service Oriented Architecture
Mobile Database and Service Oriented Architecture
 
Thin Client
Thin ClientThin Client
Thin Client
 
Mobile security
Mobile securityMobile security
Mobile security
 

Similar to Nasscom Presentation Microservices Database Architecture By Tudip

#dbhouseparty - Should I be building Microservices?
#dbhouseparty - Should I be building Microservices?#dbhouseparty - Should I be building Microservices?
#dbhouseparty - Should I be building Microservices?Tammy Bednar
 
Deployability
DeployabilityDeployability
DeployabilityLen Bass
 
QCon 2015 - Microservices Track Notes
QCon 2015 - Microservices Track Notes QCon 2015 - Microservices Track Notes
QCon 2015 - Microservices Track Notes Abdul Basit Munda
 
MICROSERVICES ARCHITECTURE unit -2.pptx
MICROSERVICES ARCHITECTURE unit -2.pptxMICROSERVICES ARCHITECTURE unit -2.pptx
MICROSERVICES ARCHITECTURE unit -2.pptxMohammedShahid562503
 
Technology insights: Decision Science Platform
Technology insights: Decision Science PlatformTechnology insights: Decision Science Platform
Technology insights: Decision Science PlatformDecision Science Community
 
Cisco Live 2019: New Best Practices for Hybrid and Multicloud Network Strategies
Cisco Live 2019: New Best Practices for Hybrid and Multicloud Network StrategiesCisco Live 2019: New Best Practices for Hybrid and Multicloud Network Strategies
Cisco Live 2019: New Best Practices for Hybrid and Multicloud Network StrategiesMen and Mice
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to MicroservicesMahmoudZidan41
 
6 microservice architecture
6 microservice architecture6 microservice architecture
6 microservice architectureLen Bass
 
MicroserviceArchitecture in detail over Monolith.
MicroserviceArchitecture in detail over Monolith.MicroserviceArchitecture in detail over Monolith.
MicroserviceArchitecture in detail over Monolith.PLovababu
 
Software Architectures, Week 3 - Microservice-based Architectures
Software Architectures, Week 3 - Microservice-based ArchitecturesSoftware Architectures, Week 3 - Microservice-based Architectures
Software Architectures, Week 3 - Microservice-based ArchitecturesAngelos Kapsimanis
 
Lanka government cloud: what, why & how?
Lanka government cloud: what, why & how?Lanka government cloud: what, why & how?
Lanka government cloud: what, why & how?Wasantha Deshapriya
 
Service-mesh options with Linkerd, Consul, Istio and AWS AppMesh
Service-mesh options with Linkerd, Consul, Istio and AWS AppMeshService-mesh options with Linkerd, Consul, Istio and AWS AppMesh
Service-mesh options with Linkerd, Consul, Istio and AWS AppMeshChristian Posta
 
2019 03-23-2nd-meetup-essential capabilities behind microservices
2019 03-23-2nd-meetup-essential capabilities behind microservices2019 03-23-2nd-meetup-essential capabilities behind microservices
2019 03-23-2nd-meetup-essential capabilities behind microservicesKim Kao
 
SYN207: Newest and coolest NetScaler features you should be jazzed about
SYN207: Newest and coolest NetScaler features you should be jazzed aboutSYN207: Newest and coolest NetScaler features you should be jazzed about
SYN207: Newest and coolest NetScaler features you should be jazzed aboutCitrix
 
Navigating the service mesh landscape with Istio, Consul Connect, and Linkerd
Navigating the service mesh landscape with Istio, Consul Connect, and LinkerdNavigating the service mesh landscape with Istio, Consul Connect, and Linkerd
Navigating the service mesh landscape with Istio, Consul Connect, and LinkerdChristian Posta
 

Similar to Nasscom Presentation Microservices Database Architecture By Tudip (20)

#dbhouseparty - Should I be building Microservices?
#dbhouseparty - Should I be building Microservices?#dbhouseparty - Should I be building Microservices?
#dbhouseparty - Should I be building Microservices?
 
Deployability
DeployabilityDeployability
Deployability
 
QCon 2015 - Microservices Track Notes
QCon 2015 - Microservices Track Notes QCon 2015 - Microservices Track Notes
QCon 2015 - Microservices Track Notes
 
MICROSERVICES ARCHITECTURE unit -2.pptx
MICROSERVICES ARCHITECTURE unit -2.pptxMICROSERVICES ARCHITECTURE unit -2.pptx
MICROSERVICES ARCHITECTURE unit -2.pptx
 
Technology insights: Decision Science Platform
Technology insights: Decision Science PlatformTechnology insights: Decision Science Platform
Technology insights: Decision Science Platform
 
Cisco Live 2019: New Best Practices for Hybrid and Multicloud Network Strategies
Cisco Live 2019: New Best Practices for Hybrid and Multicloud Network StrategiesCisco Live 2019: New Best Practices for Hybrid and Multicloud Network Strategies
Cisco Live 2019: New Best Practices for Hybrid and Multicloud Network Strategies
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to Microservices
 
6 microservice architecture
6 microservice architecture6 microservice architecture
6 microservice architecture
 
MicroserviceArchitecture in detail over Monolith.
MicroserviceArchitecture in detail over Monolith.MicroserviceArchitecture in detail over Monolith.
MicroserviceArchitecture in detail over Monolith.
 
Microservices: an introduction
Microservices: an introductionMicroservices: an introduction
Microservices: an introduction
 
Microservice intro
Microservice introMicroservice intro
Microservice intro
 
Software Architectures, Week 3 - Microservice-based Architectures
Software Architectures, Week 3 - Microservice-based ArchitecturesSoftware Architectures, Week 3 - Microservice-based Architectures
Software Architectures, Week 3 - Microservice-based Architectures
 
Lanka government cloud: what, why & how?
Lanka government cloud: what, why & how?Lanka government cloud: what, why & how?
Lanka government cloud: what, why & how?
 
Service-mesh options with Linkerd, Consul, Istio and AWS AppMesh
Service-mesh options with Linkerd, Consul, Istio and AWS AppMeshService-mesh options with Linkerd, Consul, Istio and AWS AppMesh
Service-mesh options with Linkerd, Consul, Istio and AWS AppMesh
 
Microservices vs monolithics betabeers
Microservices vs monolithics   betabeersMicroservices vs monolithics   betabeers
Microservices vs monolithics betabeers
 
Build A Scalable Mobile App
Build A Scalable Mobile App Build A Scalable Mobile App
Build A Scalable Mobile App
 
Microservices: Detailed Guide
Microservices: Detailed GuideMicroservices: Detailed Guide
Microservices: Detailed Guide
 
2019 03-23-2nd-meetup-essential capabilities behind microservices
2019 03-23-2nd-meetup-essential capabilities behind microservices2019 03-23-2nd-meetup-essential capabilities behind microservices
2019 03-23-2nd-meetup-essential capabilities behind microservices
 
SYN207: Newest and coolest NetScaler features you should be jazzed about
SYN207: Newest and coolest NetScaler features you should be jazzed aboutSYN207: Newest and coolest NetScaler features you should be jazzed about
SYN207: Newest and coolest NetScaler features you should be jazzed about
 
Navigating the service mesh landscape with Istio, Consul Connect, and Linkerd
Navigating the service mesh landscape with Istio, Consul Connect, and LinkerdNavigating the service mesh landscape with Istio, Consul Connect, and Linkerd
Navigating the service mesh landscape with Istio, Consul Connect, and Linkerd
 

Recently uploaded

Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
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 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
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
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
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 

Recently uploaded (20)

Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
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
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
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
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 

Nasscom Presentation Microservices Database Architecture By Tudip

  • 1. 1 Tudip Technologies Continuously Delivering Digital Solutions with Integrity | Innovation | Serenity https://tudip.com/
  • 3. The world where we live in... Organizations which design systems … are constrained to produce designs which are copies of the communication structures of these organizations. -  M. Conway Corollary by James and Neil: Therefore: Make sure the organization is compatible with the product architecture. “ ”
  • 4. © 2019 Tudip Technologies. All Rights Reserved. OTT System in Microservice Architecture
  • 5. What is Microservice Architecture? ● As per Martin Fowler, services in a microservice architecture (MSA) are often processes that communicate over a network to fulfill a goal using technology-agnostic protocols such as HTTP. ● Services are independently deployable. ● Services are organized around fine-grained business capabilities. ● Services can be implemented using different programming languages, databases, hardware and software environment, depending on what fits best. ● This does not mean that a single microservice is written in a patchwork of programming languages.
  • 6. © 2019 Tudip Technologies. All Rights Reserved. • Multiple Components • Built For Business, instead of technology • Simple Routing • Decentralized • Failure Resistant • Evolutionary Salient features of Microservices
  • 7. © 2019 Tudip Technologies. All Rights Reserved. Loose coupling is the operative word, that means microservices should be able to be modified without requiring changes in other microservices. Overall Microservices
  • 8. © 2019 Tudip Technologies. All Rights Reserved. Microservices Pros • Freedom to independently develop and deploy services • A microservice can be developed by a fairly small team • Code for different services can be written in different languages (though practitioners discourage it) • Easy integration and automatic deployment • Easy to understand and modify for developers, thus can help a new team member become productive quickly • The developers can make use of the latest technologies • The code is organized around business capabilities • When change is required in a certain part of the application, only the related service can be modified and redeployed—no need to modify and redeploy the entire application • Better fault isolation: if one microservice fails, the other will continue to work • Easy to scale and integrate with third- party services • No long-term commitment to technology stack
  • 9. © 2019 Tudip Technologies. All Rights Reserved. Microservices Cons • Due to distributed deployment, testing can become complicated and tedious • Increasing number of services can result in information barriers • The architecture brings additional complexity as the developers have to mitigate fault tolerance, network latency, and deal with a variety of message formats as well as load balancing • Being a distributed system, it can result in duplication of effort • When number of services increases, integration and managing whole products can become complicated • In addition to several complexities of monolithic architecture, the developers have to deal with the additional complexity of a distributed system • Developers have to put additional effort into implementing the mechanism of communication between the services • Handling use cases that span more than one service without using distributed transactions is not only tough but also requires communication and cooperation between different teams
  • 10. © 2019 Tudip Technologies. All Rights Reserved. How Micro a Microservice should be? Amazon's policy is that the team implementing a microservice should be small enough that they can be fed by two-pizzas.
  • 11. © 2019 Tudip Technologies. All Rights Reserved. Is it all Rosy?
  • 12. © 2019 Tudip Technologies. All Rights Reserved. The Hardest Part About Microservices: Database Design
  • 13. © 2019 Tudip Technologies. All Rights Reserved. Yes, database is the DOG!
  • 14. © 2019 Tudip Technologies. All Rights Reserved. Broadly, you have 2 options!
  • 15. © 2019 Tudip Technologies. All Rights Reserved. Option # 1, Monolithic Database
  • 16. © 2019 Tudip Technologies. All Rights Reserved. Option #1.1, Variation of Monolithic Database
  • 17. © 2019 Tudip Technologies. All Rights Reserved. Option #2, Multiple Databases
  • 18. © 2019 Tudip Technologies. All Rights Reserved. Problems in Monolithic Database • You can NOT scale a service without scaling the database • You can not deploy a service because change in 1 schema, going to affect other microservices and hence you can not do Continuous Integration/Continuous Deployments • You would be stuck with an RDBMS OR NoSQL and can NOT pick what works the best • And hence, service preference of the DB would be completely lost
  • 19. © 2019 Tudip Technologies. All Rights Reserved. Well, what about 2PC (Phase Commits) • 2PC, is a mechanism for implementing a transaction across different software components (multiple databases, message queues etc.) • Well, if that is how you implement, the ghosts of limitations of Monolithic Database are going to Haunt You!
  • 20. © 2019 Tudip Technologies. All Rights Reserved. Again, monolithic database is a DOG!
  • 21. © 2019 Tudip Technologies. All Rights Reserved. The Hardest Part About Microservices: Your Data https://blog.christianposta.com/microservices/the-hardest-part-about-microservices-data/ But challenges of the Database per Service..
  • 22. © 2019 Tudip Technologies. All Rights Reserved. Multiple Databases has its own challenges! ● Complexity of managing multiple SQL and NoSQL databases ● Implementing business transactions that span multiple services is not straightforward. Moreover, many modern (NoSQL) databases don’t support them. The best solution is to use the Saga pattern. Services publish events when they update data. Other services subscribe to events and update their data in response. ● Implementing queries that join data that is now in multiple databases is challenging.
  • 23. © 2019 Tudip Technologies. All Rights Reserved. Saga • Implement each business transaction that spans multiple services as a saga. • A saga is a sequence of local transactions. • Each local transaction updates the database and publishes a message or event to trigger the next local transaction in the saga. If a local transaction fails because it violates a business rule then the saga executes a series of compensating transactions that undo the changes that were made by the preceding local transactions.
  • 24. © 2019 Tudip Technologies. All Rights Reserved. Saga Continues
  • 25. © 2019 Tudip Technologies. All Rights Reserved. 2 ways to coordinating the Saga • There are two ways of coordination sagas: • Choreography - each local transaction publishes domain events that trigger local transactions in other services • Orchestration - an orchestrator (object) tells the participants what local transactions to execute
  • 26. © 2019 Tudip Technologies. All Rights Reserved. Here is choreography-based Saga
  • 27. © 2019 Tudip Technologies. All Rights Reserved. Choreography-based saga
  • 28. © 2019 Tudip Technologies. All Rights Reserved. Orchestration-based saga
  • 29. © 2019 Tudip Technologies. All Rights Reserved. And here is an Orchestra
  • 30. © 2019 Tudip Technologies. All Rights Reserved. And then there is always CQRS
  • 31. © 2019 Tudip Technologies. All Rights Reserved. CQRS: Command Query Responsibility Segregation
  • 32. © 2019 Tudip Technologies. All Rights Reserved. How did it work in one of our OTT project?
  • 33. © 2019 Tudip Technologies. All Rights Reserved. What all we have used in this application? ● Saga ● Along with CQRS
  • 34. © 2019 Tudip Technologies. All Rights Reserved. References • https://en.wikipedia.org/wiki/Microservices • https://en.wikipedia.org/wiki/Conway%27s_law • https://microservices.io/patterns/data/event-sourcing.html • https://auth0.com/blog/introduction-to-microservices-part-4-dependencies/ • https://stackoverflow.com/questions/41640621/data-sharing-between-micro-services • https://www.baeldung.com/transactions-across-microservices
  • 35. 35 Thank You Know more about Tudip here!