Manage shards
Simple Log Service (SLS) uses shards to control read and write throughput for Logstores, Eventstores, and Metricstores. Split or merge shards to adjust the active shard count and total throughput — splitting can be automatic, but merging is manual only.
Key concepts
Shard range
Each shard covers a left-closed, right-open MD5 hash range: [BeginKey,EndKey). Ranges do not overlap and collectively span the entire MD5 space: [00000000000000000000000000000000,ffffffffffffffffffffffffffffffff). When you create a Logstore or Metricstore, SLS divides the MD5 range equally among the specified number of shards.
-
BeginKey: The start of the shard range. This value is inclusive.
-
EndKey: The end of the shard range. This value is exclusive.
For example, Logstore A has four shards with the following ranges:
Table 1. Example shard ranges
|
Shard ID |
Range |
|
Shard0 |
[00000000000000000000000000000000,40000000000000000000000000000000) |
|
Shard1 |
[40000000000000000000000000000000,80000000000000000000000000000000) |
|
Shard2 |
[80000000000000000000000000000000,c0000000000000000000000000000000) |
|
Shard3 |
[c0000000000000000000000000000000,ffffffffffffffffffffffffffffffff) |
Reading data requires specifying a shard ID. Writing data supports two modes:
-
Load balancing mode: Each data packet is randomly written to an available shard.
Recommended when write traffic exceeds a single shard's capacity.
-
Hash key routing mode: You specify an MD5 key, and the data is written to the shard whose range contains the key.
For example, based on the shard range example, if you write data with an MD5 key of 5F, the data is written to Shard1. If you use a key of 8C, the data is written to Shard2.
Shard read and write capacity
Each shard has specific read and write capacity limits. For more information, see Data reads and writes.
Plan shard count based on actual data traffic. Split shards when traffic exceeds capacity; merge shards when traffic is well below capacity to reduce active shard count and cost.
-
If write API calls persistently return 403 or 500 errors, check traffic and status codes in Cloud Monitor to determine whether you need more shards.
-
If requests exceed a shard's capacity, SLS processes them on a best-effort basis without guaranteeing service quality.
Shard status
Shard status can be readwrite or readonly.
New shards start as readwrite. After a split or merge, original shards become readonly and new readwrite shards are created. Status does not affect read performance. readwrite shards guarantee write performance, while readonly shards do not accept new writes.
Split and merge
You can adjust active shard count in two ways:
-
A split divides one shard into two new
readwriteshards placed after the original. Their combined MD5 range equals the original shard's range.Only
readwriteshards can be split. After splitting, the original shard becomesreadonly— you can still consume its data but cannot write new data to it. -
A merge combines two adjacent shards into one new
readwriteshard placed after them. Its MD5 range covers the combined range of the two originals.Select a
readwriteshard that is not the last in the sequence. SLS automatically merges it with the adjacent shard to its right. Both original shards becomereadonly— you can still consume their data but cannot write new data.
Split shard
Plan shard count based on your data traffic. Each shard supports write throughput of 5 MB/s or 500 requests/s and read throughput of 10 MB/s or 100 requests/s. These are not hard limits — if exceeded, SLS handles requests on a best-effort basis. Split shards when throughput is insufficient.
If write API calls persistently return 403 or 500 errors, check traffic and status codes in Cloud Monitor to determine whether you need more shards.
Console operations
Log on to the Simple Log Service console.
In the Projects section, click the one you want.

-
In the left-side navigation pane, choose
Log Storage > Logstores. On the Logstores page, hover over the target logstore and choose . -
On the Logstore Attributes page, click Modify.
-
Select a shard to split and click Split.
ImportantOnly
readwriteshards can be split.On the Shard Management page, find the
readwriteshard to split, and click Split in the Actions column. -
In the dialog box that appears, select the number of new shards and click OK.
-
Click Save.
View shards
Console operations
Log on to the Simple Log Service console.
In the Projects section, click the one you want.

-
In the left-side navigation pane, choose
Log Storage > Logstores. On the Logstores page, hover over the target logstore and choose . -
On the Logstore Attributes page, view the shard list for the logstore.
This page displays the Total Shards (including the number of readwrite and readonly shards), and details for each shard, including its Id, Status, BeginKey/EndKey, and Creation Time.
Automatic shard splitting
SLS automatically splits a shard when all of the following conditions are met:
-
The Auto Split Shard switch is enabled.
-
The write traffic to the shard has exceeded its write capacity for more than five minutes.
-
The number of
readwriteshards in the logstore is less than the configured Maximum Shards value.
Shards created by a split within the last 15 minutes are not eligible for automatic splitting.
Enable automatic shard splitting and set the Maximum Shards value when you create or modify a Logstore.
-
Auto Split Shard
For example, if you have four shards, SLS evaluates each shard independently. It splits any shard that meets the conditions, provided the total shard count does not exceed the configured maximum.
-
Maximum Shards
The upper limit on total shards after automatic splitting. Maximum supported value: 256
readwriteshards.
Merge shards
When data traffic is well below shard capacity, merge shards to reduce active shard count and cost. A merge combines a shard with its right-adjacent shard. Merging is manual only.
To merge shards, you must specify a shard that is in the readwrite status and is not the last readwrite shard in the sequence.
-
In the left-side navigation pane, choose
Log Storage > Logstores. On the Logstores page, hover over the target logstore and choose . -
On the Logstore Attributes page, click Modify.
-
Select a shard to merge and click Merge.
The Shard Management page lists all shards with their details. The Actions column provides Split or Merge options for
readwriteshards. No actions are available forreadonlyshards. -
Click Save.
After the merge, the two original shards become
readonly. A newreadwriteshard is created with an MD5 range that covers the combined range of the original two.
Delete shard
Deleted shards cannot be restored. Proceed with caution.
-
Automatic deletion
If you set a data retention period for the logstore, SLS automatically deletes shards and their data when the period expires.
-
Manual deletion
If you enabled permanent storage, delete the entire Logstore to remove its shards and data. Stop billing/Delete logstore.
API reference
|
Actions |
API |
|
Split a shard |
|
|
Merge shards |
|
|
List shards |
> Modify