Skip to content

Commit ba52258

Browse files
committed
Edits copied over from elastic#120346
1 parent d1db65b commit ba52258

File tree

1 file changed

+25
-11
lines changed

1 file changed

+25
-11
lines changed

docs/reference/how-to/size-your-shards.asciidoc

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
11
[[size-your-shards]]
22
== Size your shards
3+
[discrete]
4+
[[what-is-a-shard]]
5+
=== What is a shard?
6+
7+
A shard is a basic unit of storage in {es}. Every index is divided into one or more shards to help distribute data and workload across nodes in a cluster. This division allows {es} to handle large datasets and perform operations like searches and indexing efficiently but not without cost. Each index and shard has some overhead and if you divide your data across too many shards then the overhead will degrade performance. Shards play several key roles in {es}:
8+
9+
* *Data Distribution:* Each shard contains a portion of the data from the index. When you add more nodes to your cluster, {es} will spread the shards across the nodes, balancing the workload between them.
10+
* *Replication:* Shards can have replicas which are copies of the original shard. Replicas ensure data availability and improve search performance by allowing multiple nodes to handle requests for that shard.
11+
* *Parallel Processing:* Shards enable {es} to distribute indexing of documents, and process queries in parallel across shards, making ingestion and searches faster and more efficient.
12+
13+
By effectively using shards, {es} can scale horizontally and provide fault tolerance, ensuring your data is distributed and indexing and searches are processed efficiently.
14+
15+
[discrete]
16+
[[sizing-shard-guidelines]]
17+
=== Sizing Shard Guidelines
18+
19+
Proper shard sizing is crucial for maintaining the performance and stability of an {es} cluster. _Oversharding_ occurs when data is distributed across an excessive number of shards (primary or replica), which can degrade search performance and make the cluster unstable. Conversely, very large shards may slow down search operations and prolong recovery times after failures.
20+
21+
To strike the right balance, the <<shard-size-recommendation,general guidelines>> are to aim for shard sizes between 10GB and 50GB, keeping the per-shard document count below 200 million. To ensure that each node is working optimally, it's important to distribute shards evenly across nodes. Uneven distribution can cause some nodes to work harder than others, leading to performance degradation and instability. While Elasticsearch automatically balances shards, it’s important to configure your indices with an appropriate number of shards and replicas to facilitate even distribution across nodes.
322

4-
Each index in {es} is divided into one or more shards, each of which may be
5-
replicated across multiple nodes to protect against hardware failures. If you
6-
are using <<data-streams>> then each data stream is backed by a sequence of
7-
indices. There is a limit to the amount of data you can store on a single node
8-
so you can increase the capacity of your cluster by adding nodes and increasing
9-
the number of indices and shards to match. However, each index and shard has
10-
some overhead and if you divide your data across too many shards then the
11-
overhead can become overwhelming. A cluster with too many indices or shards is
12-
said to suffer from _oversharding_. An oversharded cluster will be less
13-
efficient at responding to searches and in extreme cases it may even become
14-
unstable.
23+
If you are using <<data-streams>>, each data stream is backed by a sequence of indices, each index potentially having multiple shards.
24+
25+
Despite these general guidelines, it is good to develop a tailored <<create-a-sharding-strategy, sharding strategy>> that considers your specific infrastructure, use case, and performance expectations.
1526

1627
[discrete]
1728
[[create-a-sharding-strategy]]
@@ -208,6 +219,7 @@ index can be <<indices-delete-index,removed>>. You may then consider setting
208219
<<indices-add-alias,Create Alias>> against the destination index for the source
209220
index's name to point to it for continuity.
210221

222+
See this https://www.youtube.com/watch?v=sHyNYnwbYro[fixing shard sizes video] for an example troubleshooting walkthrough.
211223

212224
[discrete]
213225
[[shard-count-recommendation]]
@@ -571,6 +583,8 @@ PUT _cluster/settings
571583
}
572584
----
573585

586+
See this https://www.youtube.com/watch?v=tZKbDegt4-M[fixing "max shards open" video] for an example troubleshooting walkthrough. For more information, see <<troubleshooting-shards-capacity-issues,Troubleshooting shards capacity>>.
587+
574588
[discrete]
575589
[[troubleshooting-max-docs-limit]]
576590
==== Number of documents in the shard cannot exceed [2147483519]

0 commit comments

Comments
 (0)