01

Why this matters

Partitioning is essential for managing large-scale data systems. It enables scalability, performance, and availability by splitting data into manageable chunks called shards.

Partitioning allows systems to scale out indefinitely as more shards are added when data volume grows. It reduces the volume of data processed in write and read operations, enabling parallel execution and better performance.

When a shard fails, only its data becomes unavailable. Other shards remain operational, improving system availability.

Partitioning is used across multiple system types, including messaging, databases, caches, and object storage.


02

Messaging Systems

RebitimQ uses sharded queues. Producers publish to a logical queue partitioned into regular queues (shards). Each shard has one consumer.

Message processing order is not guaranteed across shards. Message B may be processed before message A, though order is preserved within each shard.

Kafka and Kinesis divide incoming messages into partitions. Each partition is processed by one consumer.

Kinesis and Kafka do not allow competing consumers on the same partition. Parallelism is achieved by creating more partitions.


03

Databases

SQL and NoSQL databases use partitioning when a single server can no longer store all data.

Each shard holds a portion of data. Multiple storage nodes introduce key questions:

  • Which node should write data to?
  • How to pick a node for reading?
  • How to ensure even data distribution?

Even distribution may mean equal data volume or equal read/write request load.

Two key database design ideas:

  1. A configuration service knows shard details—how many exist and which holds which data.
  2. A request router directs client requests to the correct shard via the configuration service.

This model scales SQL databases. MongoDB uses centralized control.

Dynamo and Cassandra use decentralized peer-to-peer communication.


04

Cache Systems

Database shards become cache shards. Instead of disk storage, cache shards store data in memory.


05

Object Storage

Systems like AWS S3, Azure Blob Storage, and Google Cloud Storage use partitioning.

When a file is uploaded, one storage node is selected and stores the file.

Metadata service tracks which node holds which file.

On a GET request, the request router looks up the node in the metadata service and forwards the request.


Questions

  • How do messaging systems ensure message order across shards?
  • What are the two key design ideas for database partitioning?
  • How does object storage handle file location and retrieval?
  • Why can't competing consumers exist on the same partition in Kafka or Kinesis?
  • What does 'evenly distributed' mean in data partitioning?
  • How do configuration services and request routers work together?
  • How do database shards differ in SQL versus NoSQL systems?
  • What happens when a shard fails in a partitioned system?

Key takeaways

  • Partitioning splits data into shards to enable scalability, performance, and availability.
  • Messaging systems like Kafka and RebitimQ use sharded queues with order guarantees per shard.
  • Databases use configuration services and request routers to route data to shards.
  • SQL and MongoDB use centralized control; Dynamo and Cassandra use decentralized peer-to-peer models.
  • Cache systems use shard-based memory storage.
  • Object storage uses metadata services to track file locations and serve requests.
  • Even distribution in partitioning may refer to data volume or request load.
  • Shard failure impacts only data on that shard, not the entire system.