English 中文(简体)
Database per Service
  • 时间:2024-11-03

Database per Service


Previous Page Next Page  

Problem Statement

Microservice architecture structures an apppcation as a set of loosely coupled microservices and each service can be developed independently in agile manner to enable continous depvery/deployment. What should be the database structure/architecture in microservices based apppcation.

Solution

We can keep each microservice data private to that microservice and this data will be accessible only via relevant microservice. The microservice will use its own database for transactions. Following diagram shows database per service design pattern implementation.

Database per Service Microservices Design Pattern

Database per Service does not always need to have seperate databases provisioned. We can implement the pattern using following ways considering a relational database.

    Private tables per Service − Each microservice can utipze a set of tables and these tables should be accessible only via their relevant microservice.

    Schema per Service − A seperate schema can be defined per microservice.

    Database Server per Service − Entire database server can be configured per microservice.

Advertisements