Think of a utility like electricity. Anytime you use electricity, your bill captures the number of units (kWH = Killo Watt Hour) that you use. At the end of the month you pay based on number of units you consumed in the entire month.
Monthly charge = (Number of units of kWH consumed) x (price of 1 kWH in your area)
You are charged for reads and writes similar to electricity usage billing. Keep this analogy in mind in the next few chapters.
Every time you read/write to a DynamoDB table, you get charged for the I/O usage.
In an earlier lesson I mentioned that the data in a partition is replicated across 3 availability zones. Data is written to a single primary partition and then asynchronously replicated to secondary partition. You can get the latest data by reading from primary partition, this read request for latest item data is referred to as Strongly consistent read. Data reads from secondary partitions may return stale item data and are referred to as Eventually consistent read. You will learn more about it in later chapters.
For DynamoDB reads you are charged in terms of Read Request Unit (RRU). All reads are measured in terms of 4 KB chunks of data.
For 1 strongly consistent read you will be charged 1 RRU. In layman terms what that means is that if you read an item’s latest state with size less than or equal to 4 KB, you will be charged 1 RRU. Price of 1 RRU depends on the region, capacity mode used for the table and more.
1 Strongly consistent read = 1 RRU
An eventually consisten reads cost half of strongly consistent read.
1 Eventually consistent read = 0.5 RRU
To calculate the RRU usage for Strongly consistent read, use the formula:
Round_UP(data size read to nearest multiple of 4)/4 x (1 RRU)
To calculate the RRU usage for Eventually consistent read, use the formula:
Round_UP(data size read to nearest multiple of 4)/4 x (0.5 RRU)
Go through the example below for clarity.