Back to explorer
Core Fundamentals 5 Min

Scaling Writes

MEDIUM

Scaling Database Writes

Scaling writes involves structuring databases to handle high-throughput write traffic through partition strategies and log-structured storage.


1. Writing Architectures

  • Database Sharding:

Partitions tables horizontally across multiple database instances using a hash of the partition key (e.g., user_id % N).

  • Queue-Based Writes:

Saves incoming writes to a messaging broker (Kafka) and database workers consume events at a steady rate, protecting databases from traffic spikes.

  • LSM Trees (Log-Structured Merge):

Used by Cassandra/RocksDB. Writes are appended sequentially to an in-memory buffer (MemTable) and periodically flushed to disk as immutable SSTables, avoiding random disk seeks.


2. CQRS (Command Query Responsibility Segregation)

Separates read and write operations into distinct data models and databases, optimizing the write database for transactional throughput and the read database for queries.


3. References & Tech Blogs