Choosing a Database Sharding Strategy for Black Friday E-commerce Load
A Postgres orders table has grown to 500 million rows, pushing query latency from 40ms to 800ms and making vertical scaling no longer viable. The article notes that 80% of reads are customers viewing their own orders from the past 30 days, which shapes the choice of sharding approach. It argues that hash sharding on order ID and consistent hashing both force scatter-gather queries across all shards, slowing user-facing reads. Range sharding by date would concentrate Black Friday writes on a single current shard that could crash under load. The author recommends directory-based sharding, which maps each customer to a shard via a lookup service cached in Redis, though the directory itself may become a bottleneck.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in