본문 바로가기

AWS Database/AWS DynamoDB

[AWS Certificate]-DynamoDB Partition

DynamoDB Partitions

 

  • Store DynamoDB table data (physically)
  • Each (physical) partition = 10GB SSD volume
  • Not to be confused with table's partition/hash key (which is a logical partition)
  • One partition can store items with multiple partition keys
  • A table can have multiple partitions
  • Number of table partitions depend on its size and provisioned capacity
  • Managed internally by DynamoDB
  • Provisioned capacity is evenly distributed across table partitions
  • Partitions once allocated, cannot be deallocated (important!)

Calculating DynamoDB Partitions

  • 1 Partition = 1000 WCUs or 3000 RCUs (Maximum supported throughput per partition)
  • 1 Partition = 10GB of data
  • No. of Partitions = Either the number of partitions based on throughput or the number of partitions based on size, whichever is higher

Partition Behavior Example (Scaling up Capacity)

 

  • Provisioned Capacity: 500 RCUs and 500 WCUs
  • Storage requirement < 10 GB
  • Number of Partitions:
           P = (500 RCUs/3000 + 500 WCUs/1000)
           = 0.67 => rounded up => 1 parition
  • Say, we scale up the provisioned capacity
  • New Capacity: 1000 RCUs and 1000 WCUs
           P = (1000 RCUs/3000 + 1000 WCUs/1000)
           = 1.33 => rounded up => 2 partitions 

Partition Behavior Example (Scaling up Storage)

 

  • Provisioned Capacity = 1000 RCUs and 500 WCUs
  • Storage Size = 5GB


Partition Behavior Example (Scaling up Storage)

  • Provisioned Capacity = 1000 RCUs and 500 WCUs
  • New Storage size = 50GB


Partition Behaviro Example (Scaling up Storage)

  • Provisioned Capacity = 1000 RCUs and 500 WCUs
  • New Storage size = 50GB

 


Partition Behavior Example (SCaling up Storage)

  • Provisioned Capacity = 1000 RCUs and 500 WCUs
  • New Storage size = 500GB

 


DynamoDB Scaling

 

  • You can manually scale up provisioned capacity as and when need
  • You can only scale down up to 4 times in a day
  • Additional one scale down if no scale downs in last 4 hours
  • Effectively 9 sclae downs per day
  • Scaling affects partition behavior
  • Any increase in partitions on scale up will not result in decrease on scale down (Important!)
  • Partitions once allocated will not get deallocated later

Auto Scaling in DynamoDB

 

  • No additional costs, uses AWS Application Auto Scaling service
  • You set the desired target utilization, minimum and maximum provisioned capacity


DynamoDB Scaling and Partition Behavior

  • Say, we want to migrate a 5GB SQL database to DynamoDB
  • Provisioned Capacity needed during BAU is 1000 RCUs and 500 WCUs


 

DynamoDB Scaling and Partition Behavior

 

  • Say, we want to migrate a 5 GB SQL database to DyanmoDB
  • Provisioned Capacity needed during BAU is 1000 RCUs and 500 WCUs
  • To speed up the migration, we scale up the write capacity temporarily to 5000 WCUs


DynamoDB Scaling and Partition Behavior

 

  • Say, we want to migrate a 5GB SQL database to DynamoDB
  • Provisioned Capacity needed during BAU is 1000 RCUs and 500 WCUs
  • To speed up the migration, we scale up the write capacity temporarily to 5000 WCUs

 


DynamoDB Scaling and Partition Behavior

 

  • Say, we want to migrate a 5 GB SQL database to DynamoDB
  • Provisioned Capacity needed during BAU is 1000 RCUs and 500 WCUs
  • To speed up the migration, we scale up the write capacity temporarily to 5000 WCUs
  • Post migration, we scale back to 500 WCUs

 


DynamoDB Scaling and Partition Behavior

 

  • Say, we want to migrate a 5 GB SQL database to DynamoDB
  • Provisioned Capacity needed during BAU is 1000 RCUs and 500 WCUs
  • To speed up the migration, we scale up the write capacity temporarily to 5000 WCUs
  • Post migration, we scale back to 500 WCUs