Database Sharding for MACH Microservices: Global Scale Partitioning Strategies
In global-scale MACH architectures where an individual microservice handles tens of millions of records and thousands of transactions per second, vertical scaling of the database (increasing server CPU and RAM) has a physical and economic limit. Database Sharding (horizontal partitioning) is the technique that allows a database to scale beyond the capabilities of a single server.
Database sharding is a technique to scale a database beyond the capabilities of a single server by distributing data across multiple instances. It's typically considered when other scaling techniques, such as query optimization, caching, read replicas, and vertical scaling, are no longer sufficient. Indicators that a microservice needs sharding include write latency above 50ms, inability to add more read replicas, data volume over 10TB, and write throughput exceeding 50,000 transactions per second.
There are three main sharding strategies: Hash, Range, and Directory, each with its advantages and disadvantages. Citus, a PostgreSQL extension, is a mature and widely-adopted solution for implementing sharding in microservices that use PostgreSQL.
Summarised by urgent.news, not translated. Machine-written; may contain errors — check the original.
Source: dev.to