Sobes.tech
Senior

What are replication, partitioning, sharding — what are they?

sobes.tech AI

Answer from AI

Replication is the process of creating copies of data on multiple servers or nodes to increase fault tolerance and availability. For example, in a database, one primary node accepts writes, and replicas synchronize with it, providing backup storage and read access from different nodes.

Partitioning is the division of data within a single database or table into logical parts (partitions) based on a certain criterion, such as date or region. This helps speed up queries and simplifies management of large data volumes.

Sharding is the horizontal division of data across different servers (shards), where each shard stores a part of the overall dataset. Unlike partitioning, sharding usually involves load distribution and system scaling by adding new servers.

Example:

  • Replication: master-slave data copying
  • Partitioning: order table divided by months
  • Sharding: users distributed across different databases by ID (for example, ID 1-10000 on one shard, 10001-20000 on another)