# Federation

> Split the data by feature into separate databases, so each service owns its tables and one busy feature cannot slow the rest.

Federation gives each feature its own database, so orders, users and the catalog stop sharing one machine.

## Use it when

- One database serves unrelated features, and a slow report or a busy feed slows checkouts.
- Teams want to deploy and size their own data without asking each other.
- The features rarely join each other's tables.

## How it works

Pick the seams where tables do not join: orders on one database, the catalog on another, sessions on a third. Each service talks to its own database, and anything it needs from another feature comes through that service's API, not a join. If orders get 1,000 writes a second and the catalog 20, they stop competing for the same disk.

Unlike [sharding](https://wiki.playquorum.dev/patterns/sharding.md), every database holds different tables, so federation spreads load by feature, not by row. The two combine: shard the biggest federated database later.

## What it costs

A query or transaction that crossed features now crosses services. Joins become application code, and a change that touches two databases needs a [saga](https://wiki.playquorum.dev/patterns/saga.md) or an accepted gap. You also run more databases, with more backups and more things to patch. Federation helps only up to the number of features, and the busiest one is still one database.

## In Quorum



The game has no per-table split, so the Design splits by request kind. The [Load Balancer](https://wiki.playquorum.dev/components/lb.md) Links carry a list of request kinds, so writes, checkouts and logins reach the orders service and everything else reaches the catalog service. Each [App Server](https://wiki.playquorum.dev/components/server.md) has its own [Database](https://wiki.playquorum.dev/components/database.md), sized apart from the other.

[Split the database by feature](https://wiki.playquorum.dev/patterns/split-the-database-by-feature.md) is the ladder rung, and [The data tier](https://wiki.playquorum.dev/explanation/the-data-tier.md) covers the choices.

Source: https://wiki.playquorum.dev/patterns/federation
