DynamoDB's partition and storage pit

How is the partition of DynamoDB calculated? Go directly to the formula:

The actual set read capacity/maximum read support 3000 + the actual set write capacity/maximum write support 1000 The result should be rounded up.

即:(readCapacityUnits / 3000) + (writeCapacityUnits / 1000) = RoundUp(initPartitions).

For example, if 1000 reads and 500 writes are actually set, then

(1000 / 3000 ) + ( 500 / 1000) = RoundUp(5/6) = 1。

So the initial value of the partition is 1.

When necessary, DynamoDB will automatically split existing partitions to provide more partitions to support throughput.

A single partition can store 10G of data. When the data is written unbalanced, it may cause some partitions to exceed the storage limit of 10G. At this time, DynamoDB will split the partitions.


The specific steps are:

  1. DynamoDB will allocate two new partitions.
  2. DynamoDB will evenly distribute data from the original partition to the new partition.
  3. DynamoDB no longer allocates data to the original partition.

When will the split be performed? DynamoDB's partition operations are triggered when throughput settings increase and storage requirements increase.

1. If the current table partition cannot meet the new provisioned throughput, DynamoDB will double the current number of partitions.

For example, when the current read capacity is 5000 and the write capacity is 2000, the number of partitions set by DynamoDB is: (5000 / 3000) + (2000 / 1000) = 3.667 -> 4.

If the read capacity is adjusted from 5000 to 8000, the formula is calculated by partition: [(8000/3000)+(2000/1000)->5]. 4 partitions is not enough, DynamoDB will double the amount of partition data. As shown below:


2. If the data volume of a partition exceeds the limit of 10G, DynamoDB will split the partition into two, and the data will be evenly distributed to the two new partitions. as the picture shows:


After the partition in the red box in the above figure is filled, DynamoDB's strategy will remove two partitions from the partition. The capacity before removal is 80G, and the total capacity after removal is 90G.

There will be a pit here:

The partitions split by DynamoDB will only share the read and write throughput of the original partition. for example:

To start with 5000 reads and 2000 writes, DynamoDB will create 4 partitions: (5000 / 3000) + (2000 / 1000) = 3.667 -> 4.

The read and write capacity of each partition is:

5000/4 partitions = 1250

2000/4 partitions = 500

When a partition is split into two partitions, reads and writes will be split equally:

1250 / 2 = 625 reads

500 / 2 = 250 writes.

If the partition key is not broken to cause the partition write offset, DynamoDB will create too many partitions, so as DynamoDB splits, the actual read and write capacity available to each partition will become less and less. will result in a severe drop in performance.


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324731717&siteId=291194637