1 00:00:00,240 --> 00:00:01,170 ‫So let's have a look at 2 00:00:01,170 --> 00:00:05,540 ‫how we can define the RCU and WCU of our tables. 3 00:00:05,540 --> 00:00:07,990 ‫So if we take our User's table, for example, 4 00:00:07,990 --> 00:00:09,500 ‫and you go on the right hand side 5 00:00:09,500 --> 00:00:10,730 ‫and you do Additional settings, 6 00:00:10,730 --> 00:00:12,210 ‫you have the Read/Write capacity 7 00:00:12,210 --> 00:00:13,560 ‫and you can edit it. 8 00:00:13,560 --> 00:00:15,910 ‫So this is what we had defined at table creation time. 9 00:00:15,910 --> 00:00:17,620 ‫But the cool thing about DynamoDB 10 00:00:17,620 --> 00:00:19,510 ‫is that we can switch between the capacity modes 11 00:00:19,510 --> 00:00:20,660 ‫if we needed to 12 00:00:20,660 --> 00:00:23,100 ‫and then we can also change them over time. 13 00:00:23,100 --> 00:00:25,540 ‫So let's take the most simple capacity mode right now, 14 00:00:25,540 --> 00:00:27,010 ‫which is On-demand. 15 00:00:27,010 --> 00:00:28,670 ‫And this is simplified billing for paying 16 00:00:28,670 --> 00:00:31,250 ‫for the actual reads and writes of your application. 17 00:00:31,250 --> 00:00:32,440 ‫But this is twice 18 00:00:32,440 --> 00:00:34,880 ‫or three times as more as expensive as provisioned. 19 00:00:34,880 --> 00:00:36,640 ‫And so obviously this is when you have 20 00:00:36,640 --> 00:00:40,340 ‫a very unusual, unpredictable type of workload, 21 00:00:40,340 --> 00:00:43,440 ‫or maybe this is like in your development environments, 22 00:00:43,440 --> 00:00:45,920 ‫and let's consider that you're not using the table at all 23 00:00:45,920 --> 00:00:48,070 ‫for like 24 hours a day, 24 00:00:48,070 --> 00:00:50,470 ‫but maybe one day for one hour, 25 00:00:50,470 --> 00:00:52,120 ‫you'll be using the table a lot. 26 00:00:52,120 --> 00:00:54,360 ‫And so therefore this is a great capacity mode 27 00:00:54,360 --> 00:00:57,070 ‫because it actually builds you for what you've been using, 28 00:00:57,070 --> 00:00:59,050 ‫which is quite amazing. 29 00:00:59,050 --> 00:01:00,510 ‫Now there's Provisioned capacity mode, 30 00:01:00,510 --> 00:01:02,600 ‫and this is the one we spent most of the time on 31 00:01:02,600 --> 00:01:05,240 ‫to understand and to compute the Reads and Writes. 32 00:01:05,240 --> 00:01:07,600 ‫And so let's go into the capacity calculator. 33 00:01:07,600 --> 00:01:08,810 ‫So as we can see here, 34 00:01:08,810 --> 00:01:11,400 ‫you can specify the average item size, for example, 35 00:01:11,400 --> 00:01:14,110 ‫six kilobytes, how many reads per second you want, 36 00:01:14,110 --> 00:01:17,470 ‫so maybe three reads per second and two writes per second. 37 00:01:17,470 --> 00:01:18,710 ‫The type of reads you want to have 38 00:01:18,710 --> 00:01:21,350 ‫so eventually consistent and strongly consistent, 39 00:01:21,350 --> 00:01:22,183 ‫there is transactional, 40 00:01:22,183 --> 00:01:23,810 ‫but I will define this a bit later on. 41 00:01:23,810 --> 00:01:25,580 ‫I didn't want to overwhelm you right now. 42 00:01:25,580 --> 00:01:28,740 ‫So eventually or strongly consistent, 43 00:01:28,740 --> 00:01:30,140 ‫and then for the write consistency 44 00:01:30,140 --> 00:01:31,550 ‫same standard or transactional, 45 00:01:31,550 --> 00:01:34,130 ‫but again, traditional, we'll see it a little bit later. 46 00:01:34,130 --> 00:01:36,380 ‫And as we can see, based on what I choose, 47 00:01:36,380 --> 00:01:39,430 ‫it gives me the RCU and the WCU 48 00:01:39,430 --> 00:01:42,550 ‫as well as the estimated cost I will have for my table. 49 00:01:42,550 --> 00:01:44,610 ‫So this is quite a handy calculator, 50 00:01:44,610 --> 00:01:47,920 ‫and I would suggest that you practice a little bit 51 00:01:47,920 --> 00:01:51,040 ‫with these settings and you try to guess correctly 52 00:01:51,040 --> 00:01:53,900 ‫what's the RCU and WCU for this table, 53 00:01:53,900 --> 00:01:56,960 ‫because this is something that the exam will ask you. 54 00:01:56,960 --> 00:01:57,960 ‫Cool. 55 00:01:57,960 --> 00:02:00,160 ‫Now, let's take a look at the table capacity. 56 00:02:00,160 --> 00:02:02,880 ‫So we can obviously have Off Auto scaling 57 00:02:02,880 --> 00:02:05,760 ‫and Off Auto scaling for read and write 58 00:02:05,760 --> 00:02:08,200 ‫and so therefore you need to Provision capacity units 59 00:02:08,200 --> 00:02:09,440 ‫and they won't change over time 60 00:02:09,440 --> 00:02:12,160 ‫unless you manually change them. 61 00:02:12,160 --> 00:02:14,470 ‫But you can also set up Auto scaling. 62 00:02:14,470 --> 00:02:15,660 ‫And Auto scaling is really cool 63 00:02:15,660 --> 00:02:16,900 ‫because we're just saying 64 00:02:16,900 --> 00:02:19,910 ‫what's my min and my maximum limit to consider? 65 00:02:19,910 --> 00:02:22,950 ‫And what's my target utilization as a percentage? 66 00:02:22,950 --> 00:02:24,470 ‫And DynamoDB will try, 67 00:02:24,470 --> 00:02:28,560 ‫for example, if we have a maximum capacity of 100, 68 00:02:28,560 --> 00:02:30,330 ‫it will set it to 100 the WCU 69 00:02:30,330 --> 00:02:35,330 ‫if you're actually consuming on average 70 WCUs and so on. 70 00:02:35,690 --> 00:02:39,250 ‫But if you're consuming, say seven WCUs, 71 00:02:39,250 --> 00:02:41,540 ‫then automatically the Auto scaling will kick in 72 00:02:41,540 --> 00:02:45,500 ‫and the desired capacity units will be 10 for that table. 73 00:02:45,500 --> 00:02:46,370 ‫So Auto scaling is nice 74 00:02:46,370 --> 00:02:48,470 ‫because you don't have to think too hard 75 00:02:48,470 --> 00:02:51,540 ‫about setting the WCU and RCU. 76 00:02:51,540 --> 00:02:53,500 ‫You just need you to think about what's my min, 77 00:02:53,500 --> 00:02:54,333 ‫what's my max, 78 00:02:54,333 --> 00:02:57,250 ‫and what's my target utilization and your application 79 00:02:57,250 --> 00:02:59,130 ‫and then DynamoDB will do the rest, 80 00:02:59,130 --> 00:03:02,300 ‫which is nice to have a better pricing and a better scaling. 81 00:03:02,300 --> 00:03:05,570 ‫Okay, so this is applying to both Auto scaling 82 00:03:05,570 --> 00:03:07,170 ‫for Reads and for Writes. 83 00:03:07,170 --> 00:03:08,280 ‫So this is good. 84 00:03:08,280 --> 00:03:10,680 ‫And then you would get the estimated cost and so on. 85 00:03:10,680 --> 00:03:15,490 ‫So if I set it to Auto scaling max three and min one, 86 00:03:15,490 --> 00:03:18,080 ‫and then again, max three and min one, 87 00:03:18,080 --> 00:03:19,603 ‫and click on save changes. 88 00:03:22,340 --> 00:03:23,173 ‫Now, what I'm going to do 89 00:03:23,173 --> 00:03:24,900 ‫is just to wait a little bit of time 90 00:03:24,900 --> 00:03:26,170 ‫for Auto scaling to kick in 91 00:03:26,170 --> 00:03:28,850 ‫and to see the auto scaling activities. 92 00:03:28,850 --> 00:03:29,683 ‫And as we can see, 93 00:03:29,683 --> 00:03:33,950 ‫the Provisioned was two and two for WCUs and RCUs. 94 00:03:33,950 --> 00:03:38,440 ‫But we had 1, 2, 3 in terms of range for Auto scaling 95 00:03:38,440 --> 00:03:40,750 ‫and I refresh Auto scaling activities. 96 00:03:40,750 --> 00:03:42,850 ‫And as we can see for this table, 97 00:03:42,850 --> 00:03:45,090 ‫the Setting Read capacity and was set to one 98 00:03:45,090 --> 00:03:46,120 ‫and Write capacity was set to one 99 00:03:46,120 --> 00:03:47,410 ‫because I'm not using a table. 100 00:03:47,410 --> 00:03:49,500 ‫And so auto is getting kicked in and it worked. 101 00:03:49,500 --> 00:03:51,520 ‫And so therefore, if I refresh this page 102 00:03:52,380 --> 00:03:53,810 ‫and remove this here, 103 00:03:53,810 --> 00:03:58,200 ‫as we can see now, the RCU and WCUs are one and one. 104 00:03:58,200 --> 00:03:59,270 ‫So I'll just going, it's quite cool. 105 00:03:59,270 --> 00:04:00,490 ‫It works just like EC2, 106 00:04:00,490 --> 00:04:02,140 ‫but for DynamoDB. 107 00:04:02,140 --> 00:04:03,080 ‫So that's it for this lecture. 108 00:04:03,080 --> 00:04:03,913 ‫I hope you liked it. 109 00:04:03,913 --> 00:04:05,800 ‫And I will see you in the next lecture.