So there will come a day when you will need to calculate RCU/WCU for Dynamodb tables on AWS. This will probably come in the form of a word problem like this one…
From A Cloud Guru’s discussion group on a quiz on DynamoDB…
“You have a motion sensor which writes 600 items of data every minute. Each item consists of 5kb.
Your application uses eventually consistent reads. What should you set the read throughput to?”
Ignore the inconsistency of the first use of “writes” and let’s assume that we want reads and that the motion sensor reads 600 items of data every minute.
Here are a few simple steps:
- Is this a Read (RCU) or Write (WCU) calculation? – This matters for two reasons because:
- RCUs have a 4kb chunk size per operation
- WCUs have a 1kb chunk size per operation.
- Calculate the number of items per second – Why? Because the RCU and WCU (reads and writes) are provisioned by the second. In our example, above we take 600 items and divide it by 60 seconds (every minute). This comes out to 10 items per second are being read per our example. $IpS
- Calculate the number of actions per item needed. – Each item is 5kb and our chunk (or grab) size is 4kb per read unit. If this was a write then our chunk(or grab) size would be 1kb. This means in our example of 5kb we need two 4kb operations to read that file. One operation to grab the first 4kb and then one more to grab the remaining 1kb. So that means we need 2 actions per item. $ApI
- Multiply Items per Second times Actions per Item ($IpS * $ApI) – So in our example, above we take 10 items per second and multiply it by 2 actions per item. This tells you that for our read example you need 20 RCUs.
- If you are doing reads then you need to know if it is eventually consistent (2 reads per RCU) or strongly consistent (1 read per RCU).
- If you are using strongly consistent reads then you are done. Your answer is 20 RCU’s.
- If you are doing eventually consistent reads then you need to take the result of Step 4 and divide it by two. So in our example 20 RCUs/2 = 10 RCUs needed for our word problem.
This is mainly exam focused so if this is for certification then at present (09/2106) that is what you need to know. If this is for real throughput calculations then make sure you account for local secondary indexes which “share” RCU/WCU with the table they are indexed against. You will also need to account for Global Secondary Indexes which are basically a read only copy of a table with its own RCU/WCU.
Let me know.