AlgoViz

Database per service

medium 28 min

Each service owns its data, and only that service may touch it.

Where it shows up

The same pattern appears across everyday software.

  • Netflix

    Its February 2016 announcement says that it went from a monolithic app to hundreds of microservices and denormalised its data model, using NoSQL databases.

  • Amazon Dynamo

    The Dynamo paper describes the store for the cart: the service that manages shopping carts must always be able to write to and read from its data store, also when disks or networks fail.

  • GitHub

    An engineering post describes grouping tables into schema domains, with linters that reject queries and transactions across domains, before moving the tables to separate databases.

  • GitLab

    Its documentation describes splitting the application database into main, ci and sec. GitLab.com runs them separately, and loose foreign keys clean up across databases.

  • Shopify

    A 2020 post on its modular monolith wants each data model used only by the component that owns it: the same idea inside one program.

  • AWS guidance

    AWS Prescriptive Guidance describes both the database-per-service and the shared-database patterns, and says that the first needs another pattern for queries that span services.