3
votes

Input data

DynamoDB free tier provides:

  • 25 GB of Storage
  • 25 Units of Read Capacity
  • 25 Units of Write Capacity

Capacity units (SC/EC - strongly/eventually consistent):

  • 1 RCU = 1 SC read of 4kB item/second
  • 1 RCU = 2 EC reads of 4kB item/second
  • 1 WCU = 1 write of 1kB item/second

My application:

  • one DynamoDB table 5 RCU, 5 WCU
  • one lambda
    • runs each 1 minute
    • writes 3 items ~8kB each to the DynamoDB
    • lambda execution takes <1 second

The application works ok, no throttling so far.

CloudWatch

In my CloudWatch there are some charts (ignore the part after 7:00):

  • the value on this chart is 22 WCU

enter image description here

  • on this chart it is 110 WCU - actually figured it out - this chart resolution is 5min - 5*22=110 (leaving it here in case my future self gets confused)

enter image description here

Questions

We have 3 writes of ~8kB items/second - that's ~24 WCU. That is consistent with what we see in the CloudWatch (22 WCU). But the table is configured to have only 5 WCU. I've read some other questions and as far as I understand I'm safe from paying extra if the sum of WCUs in my tables configurations is below 25.

  • Am I overusing the write capacity for my table?
  • Should I expect throttling or extra charges?
  • As far as I can tell my usage is still within the free tier limits, but it is close (22 of 25). Am I to be charged extra if my usage gets over 25 on those charts?
1

1 Answers

7
votes

The configured provisioned capacity is per second, while the data you see in CloudWatch is per minute. So your configured 5 WCU per second translate to 300 WCU per minute (5 WCU * 60 seconds), which is well above the consumed 22 WCU per minute.

That should already answer your question, but to elaborate a bit on some details:

A single write of 7KB with a configured amount of 5 WCU would in theory never succeed and cause throttling, as 7KB would require 7 WCU to write, while you only have 5 WCU configured (and we can safely assume that your write would occur within one second). Fortunately the DynamoDB engineers thought about that and implemented burst capacity. While you're not using provisioned capacity you'll save them up for up to 5 minutes to use them when you need more than the provisioned capacity. That's something to keep in mind when increasing the utilization of your capacity.