Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Microservice pattern: Database per service #2666

Open
iluwatar opened this issue Oct 15, 2023 · 1 comment
Open

Microservice pattern: Database per service #2666

iluwatar opened this issue Oct 15, 2023 · 1 comment

Comments

@iluwatar
Copy link
Owner

iluwatar commented Oct 15, 2023

Description:

The Microservices - Database per Service design pattern advocates for each microservice to have its own private database. This design pattern is crucial for achieving loose coupling between microservices, allowing each service to be developed, deployed, and scaled independently. Here are the main elements of this pattern:

  1. Service Independence: Each microservice has its own database schema and database server. This isolation ensures that services do not interfere with each other’s data.
  2. Scalability: Individual microservices can be scaled independently according to their specific data access and storage needs.
  3. Polyglot Persistence: Different microservices can use different types of databases (SQL, NoSQL, etc.) based on their specific requirements.
  4. Data Consistency: Ensuring eventual consistency through patterns like Saga or event sourcing is crucial since distributed transactions are not feasible.
  5. Security and Access Control: Each microservice manages its own database security, ensuring data encapsulation and reducing the risk of unauthorized access.

References:

Acceptance Criteria:

  1. Design and Documentation:

    • Clearly define the architecture diagram showing multiple microservices with their own databases.
    • Update project documentation to include details on the Database per Service pattern, its benefits, and challenges.
  2. Implementation:

    • Implement a sample microservices application demonstrating the Database per Service pattern.
    • Each microservice should interact with its own separate database.
    • Demonstrate polyglot persistence by using at least two different types of databases.
  3. Testing:

    • Write unit tests to ensure each microservice can independently access and manipulate its data.
    • Implement integration tests to validate data consistency across services using eventual consistency mechanisms.
  4. Example Scenario:

    • Provide an example scenario (e.g., e-commerce application) where multiple services (e.g., Order, Product, User) have their own databases.
    • Show how these services interact with each other and maintain data consistency.
@Dinozavvvr
Copy link

Hi @iluwatar, I would be glad to implement it! please assign it to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

No branches or pull requests

2 participants