Less traffic per database: Each database sees only its own reads and writes, so there is less to replicate and less replication lag.
Smaller working sets: Smaller databases mean more of the data fits in memory (PostgreSQLshared_buffers, MySQL's InnoDBbuffer pool), so more reads are cache hits.
Parallel writes: With no single primary serializing every write, the databases can accept writes in parallel, increasing throughput.
Independent sizing and failure isolation: A busy Orders DB can get bigger hardware than a quiet Users DB, and a runaway query on one database does not exhaust connections on another.
Trade-offs and architectural challenges
While federation is simpler to implement than full horizontal sharding, it introduces fundamental distributed systems constraints:
1. Cross-database joins get harder
Your application must now know which database to read from and write to. In a monolithic database:
SELECT o.id, u.email, p.title
FROM orders o
JOIN users u ON o.user_id = u.id
JOIN products p ON o.product_id = p.id;
Across federated databases, a single SQLjoin no longer works as is: joining data from two databases needs a server link between them (more complex and slower), or the application performs the join itself with fan-out queries:
Fetch order from Orders DB.
Concurrently fetch user_id from Users DB and product_id from Catalog DB.
Stitch the results in application memory.
2. Loss of referential integrity (foreign keys)
Foreign key constraints cannot reach across separate database servers. Application services or asynchronousevent streams must enforce referential integrity.
3. Uneven domain growth
Federation does not help if your schema needs one huge table or function. If most of the traffic lands on one domain (say the Orders DB), federating only buys time; when that database hits its ceiling, you need horizontal sharding. Federation also adds hardware and complexity.
Follow a request from the clients: the load balancer sends it to the service for its domain, and that service reads and writes only its own database. Each database carries only its own domain’s traffic, so it has less to replicate, keeps more of its data in memory, and takes writes in parallel with the others. The price is that a query joining users with orders now needs two databases.
Clients: 1 × Users
Load balancer: 2 × Load balancer
Users service: 4 × App server
Orders service: 4 × App server
Payments service: 4 × App server
Users database: 1 × Relational database
Orders database: 1 × Relational database
Payments database: 1 × Relational database
Clients sends requests to Load balancer
Load balancer sends requests to Users service
Load balancer sends requests to Orders service
Load balancer sends requests to Payments service
Users service sends requests to Users database
Orders service sends requests to Orders database
Payments service sends requests to Payments database
Key takeaways
Each federateddatabase carries only its own domain's reads and writes, so it replicates less, keeps more in memory and fails on its own.
A join across databases needs a server link or a fan-out from the application, and foreign keys cannot span databases.
If most traffic lands on one domain, federation only buys time: that database will need sharding.