- If you already run MySQL, use Vitess — it layers sharding and routing on top of MySQL.
- If you run Postgres, use Citus — it extends Postgres with distributed capabilities.
- If you’re starting new on AWS and mostly perform single-key lookups, consider DynamoDB.
- For very high write throughput distributed across many machines, consider Cassandra.
- For document-oriented workloads where entire documents move between shards naturally, consider MongoDB.

Chirp is a relational app (tables, rows, SQL), so adding Vitess or Citus is a natural fit depending on whether you run MySQL or Postgres. These systems take over routing, resharding (moving data between shards), and colocating related rows — responsibilities you otherwise implement manually — so your existing user_id key and table schemas remain usable.
What the sharded database will do for you
- Routing: directs queries to the correct shard based on shard key.
- Resharding: assists with moving data between shards.
- Colocation: keeps related rows together to reduce cross-shard joins.
- Shard key selection — the database won’t pick your key for you. We chose
user_id. - Keeping queries targeted — any query missing the shard key (for example, “everyone who joined between two dates”) triggers scatter-gather across shards.
- Hotspot mitigation — the database won’t automatically smooth a leader’s write hotspot; you’ll need caching, request routing, or techniques such as salting.
- Denormalization and copy maintenance — if you keep copies or denormalized rows (e.g., cached profiles), your application must update every copy when source data changes.

- Scale the primary vertically (bigger machine).
- Add read replicas to offload reads.
- Introduce an application cache to reduce read pressure (e.g., cache Lina’s posts).
- Write throughput has saturated a single primary — replicas only help reads.
- Dataset size makes backups or schema migrations (like adding a column) prohibitively long or unsafe.
- The working set no longer fits in memory on the largest rentable machine, causing increased disk I/O and slow reads.

Sharding permanently reshapes your system. Delay it until necessary and invest most effort in picking the right shard key, keeping queries targeted, preventing hotspots, and ensuring your application consistently maintains any denormalized or replicated copies.
- Vitess — scaling MySQL
- Citus — scaling Postgres
- DynamoDB — AWS managed key-value & document store
- Cassandra — distributed wide-column store
- MongoDB — distributed document database