Hey, everyone, and welcome back.
Now, in today's video, we are going to discuss about the read and the write capacity units in Dynamo
DB.
Now, before we discuss about them, it is important for us to understand the concept of throughput.
Now, at a high level overview, throughput in Dynamo DB is the maximum amount of capacity that an application
can consume from a table or an index.
For example, you have a Dynamo DB and you have a specific set of data and you have this throughput
pipe over here.
Now, how much amount of data can you retrieve from this throughput pipe will depend upon the capacity
that you set as part of the read and write capacity units.
It's not that the throughput pipe is small and you're trying to consume a lot of data in case if you
try to do that, you will go through throttling and things will not really work as expected.
And if throughput pipe is quite big, which allows a huge amount of data to be written or to be retrieved,
and you are writing or reading small amount of data, then the challenge is that you have to pay extra
because your throughput pipe is quite big.
So for production environments it is important to set a right throughput to balance between cost and
performance.
Now in Dynamo TB, we can specify the overall throughput capacity in terms of the read capacity units
and the right capacity unit.
So even in this specific screenshot, you will see that you have a read capacity related setting, right
capacity related setting.
And within you can specify the unit.
Here you have five, you can specify one, ten, etc..
We'll be discussing what exactly this number would really mean.
Now, before we quickly look into it, let's quickly see where exactly the setting is really shown.
Now, if you go a bit down under the custom settings over here.
You will see that you have the capacity units related to read and as well as the capacity units related
to.
Right.
So let me just deselect auto scaling just for simplicity at this stage.
And this is where you can define a specific number.
You can give one, you can give one.
Basically, the higher the number that you add the warrior, the more it will cost you because the more
the throughput it is.
So let's quickly discuss about the specific unit here.
So one read request unit represents one strongly consistent read request or two eventually consistent
read request for an item up to four KB in size.
And if you need to read an item that is larger than four KB, Dynamo DB needs additional read request
units here.
So let's understand this with an example.
So you have a four KB of item size the warrior.
Now question is how much read units?
What do you need both for strong as well as eventual consistency?
So for the four AB of size you need one read capacity units and even four.
Eventually you will need 148 GB of size for four read capacity unit of strong consistency.
You need two because you need one read capacity unit for strong read for four kb of size.
Since this is eight KB you need two.
However, the read capacity unit for eventual consistency would be one, primarily because as we're
discussing, one request unit represents one strongly consistent read and two eventually consistent
read.
Now since you have a eventually consistent reader warrior, it can take up to eight KB of data and 410
GB of data.
A read capacity unit for strong consistency is three and eventually consistency is two.
Now you can also test it within the capacity calculator easily.
So within year you have eventual consistency, strong consistency.
So let's say for an item size of one, you have a read capacity unit of one.
In fact, let's just select the write capacity unit to zero just for simplicity.
So for an item size of four, the read capacity unit that would be required for eventual consistent
is one.
Now as soon as we turn it to five, you see eventually consistent and the read capacity unit is still
five.
But as soon as you turn it to strong consistent immediately the RCU went to two and let's say you change
it to nine.
Over here the strong consistent would require three.
The eventual consistent would still require two.
In a similar way, you also have a write request unit.
So a write request unit represents one right for an item up to one KB in size.
This is very simple to understand.
For one KB you have one right unit for four KB for 1010.
So this is quite similar to understand this can be a little confusing, but true capacity calculator
as we're discussing it becomes much more easier to understand this.
All right, so this time let's set the E to zero and let's set right to one.
All right.
So for nine KB of size, the write capacity unit is nine for 15 KB of data.
Right capacity unit is 15.
All right.
So I hope that this at a high level overview you understood on how we can control the overall throughput
of Dynamo DB through the read capacity units and the write capacity units.
Now again, for your application, depending upon the item size and how many reads your application
will be making, you will have to go ahead and configure this depending upon your use cases.
Great.
So this will conclude today's video.