---
library: "bootstrap"
slug: "Shard"
name: "Shard"
ref: "Shard#4d41"
hash: "sema:Shard#mh:SHA-256:4d41232416e3d414c714e0892e8559c2180899b4c21c25af29984372220f8704"
type: "Data Structures"
layer: "Infrastructure"
version: "0.11.0"
root: "a6a3d1ff0f982ee30430c5b42f3784c8ec901fd68482cfc1bc30899c1e5e48c5"
license: null
url: "https://semahash.org/vocabularies/bootstrap/patterns/Shard"
---

# Shard

Deterministic partitioning of state

Infrastructure · Data Structures

## Mechanism

The fundamental primitive of distribution. It deterministically partitions a [Resource](https://semahash.org/vocabularies/bootstrap/patterns/Resource.md), [State](https://semahash.org/vocabularies/bootstrap/patterns/State.md), or [Vector](https://semahash.org/vocabularies/bootstrap/patterns/Vector.md) into disjoint subsets (Shards) based on a Key (e.g., ID, Hash, Time). Unlike [Decompose](https://semahash.org/vocabularies/bootstrap/patterns/Decompose.md), which splits complexity, Shard splits volume and load.

## Invariants

- [Conservation](https://semahash.org/vocabularies/bootstrap/patterns/Conservation.md): Sum(Shards) == Total.
- Disjointness: Intersection(Shard_A, Shard_B) == Empty.
- Determinism: Key K always routes to Shard S.

## Parameters

- key_function: type=Enum, range={Hash, Range, Directory}, description=Partitioning strategy for distributing data across shards
- partitions: type=Integer, range=[2, 256], description=Number of partitions to divide state into

## Failure modes

- Hot shard: skewed keys concentrate load on one partition — a consequence of Determinism.
- Rebinding on resize: changing the partition count invalidates every routing decision taken under the old count.
- Cross-shard operation: spanning shards requires coordination, because Disjointness guarantees no shard holds another's data.

## Where this came from

—

## Builds on

- [Conservation](https://semahash.org/vocabularies/bootstrap/patterns/Conservation.md) (references)
- [Vector](https://semahash.org/vocabularies/bootstrap/patterns/Vector.md) (references)
- [Resource](https://semahash.org/vocabularies/bootstrap/patterns/Resource.md) (references)
- [State](https://semahash.org/vocabularies/bootstrap/patterns/State.md) (references)
- [Decompose](https://semahash.org/vocabularies/bootstrap/patterns/Decompose.md) (references)

## Used by

- [ExperienceSharding](https://semahash.org/vocabularies/bootstrap/patterns/ExperienceSharding.md) (references)
- [FabricSharding](https://semahash.org/vocabularies/bootstrap/patterns/FabricSharding.md) (references)

## Identity

- Library: bootstrap 0.11.0 (root a6a3d1ff0f98)
- Ref: Shard#4d41
- Hash: sema:Shard#mh:SHA-256:4d41232416e3d414c714e0892e8559c2180899b4c21c25af29984372220f8704

## Links

- Page: https://semahash.org/vocabularies/bootstrap/patterns/Shard
- JSON: https://semahash.org/vocabularies/bootstrap/patterns/Shard.json
- Library: https://semahash.org/vocabularies/bootstrap
- Library index: https://semahash.org/vocabularies/bootstrap/index.json
