Shard
lastmod 2018-09-14created 2017-02-0611 edits
A database shard is a horizontal partition of data in a database or web search engine. Each individual partition is called a shard or database shard. Each shard is held on a separate database server instance to spread the load.
Some data in a database is present in all shards, but some appears only in a single shard. Each shard (or server) acts as the "single" source for this subset of data.
Sharding vs Partitioning
- Differences between sharding and partitioning
- What's the difference between sharding DB tables and partitioning them?
- Partitioning
- A general term for the act of splitting your logical data elements into multiple entities (tables) for the purpose of performance, availability, or maintainability.
- Sharding is the same as horizontal partitioning.
- When you shard a database, the schema that would otherwise be a single one is set up as multiple replicas, and which data is stored in each shard is separated based on a shard key. For example, I decided to shard a customer database using CustomerId as the shard key. I decided to store information for customers 0 ~ 10000 in one shard and information for customers 10001 ~ 20000 in another shard. The DBA decides on an appropriate shard key by considering data access patterns and storage space issues (proper distribution of load, even storage of data).
- Vertical partitioning
- Refers to splitting the data stored in one entity into multiple entities (likewise, for reasons of space or performance). For example, a customer may have one billing address. However, I can split the billing address information into a separate table that references CustomerId, to move the information to another database for data flexibility or for reasons such as security issues.
In summary...
파티셔닝은 퍼포먼스, 가용성, 정비용이성등의 목적을 위해 논리적인 엔티티들을 다른 물리적인 엔티티들로 나누는것을 의미하는 일반적인 용어이다.
수평 파티셔닝 또는 샤딩은 스키마 복제 후 샤드키를 기준으로 데이터를 나누는것을 말한다.
수직 파티셔닝은 스키마를 나누고 데이터가 따라 옮겨가는것을 말한다.
See also
Favorite site
- Wikipedia (en) Shard (database architecture)
- The Introduce of Sharding System - MongoDB Internals - Overview of the sharding system
- Naver D2 - Inside and Outside NHN: Sharding Platform
- How does sharding work (translation of How Sharding Works) 1
References
-
How_Sharding_Works_-_ko.pdf ↩