I have explained DynamoDB basics and its main features in my last blog post. If you are meeting with DynamoDB for the first time, you might want to check it out first. In this blog post, I will dig a little bit deeper but it’s still going to be basics. 👷🏼♀️
Let’s talk about On-Demand and Provisioned Capacity differences.
DynamoDB offers 2 types of capacity allocation; on-demand and provisioned.
Basically, pricing for on-demand capacity is determined by the number of read and write request units consumed by the application throughout a month.
Provisioned capacity allows you to assign read/write capacity units and pay depending on the allocated capacity. Regardless of how much of that capacity was used, this usage is paid hourly. AWS throttles requests if the application exceeds the provisioned capacity, and the application won't be able to read or write data during those periods.
On-demand capacity is a good option for applications with unpredictable or sudden increases in traffic, because it automatically provisions read/write capacity and you can look forward to no longer having to worry about database capacity planning.
For example, if your application’s traffic pattern varies between 2000 and 4000 reads per second where 4000 reads per second is the previous traffic peak, on-demand capacity mode can instantly scale sustained traffic of up to 8000 reads per second or more.
While it is the best fit for scalability, it can be much more expensive than provisioned capacity. The flexibility of on-demand may be worth the extra cost for small applications, but it might cost hundreds or thousands of dollars per month for large applications.
Basically it is good for;
Provisioned capacity is best suited for applications that have a predictable amount of traffic. It can save you money if your applications have predictable traffic patterns and you don't mind investing the time to analyze those patterns. The provisioned capacity variation can also dynamically change capacity during periods of high consumption when used in conjunction with DynamoDB Auto Scaling.
Basically it is good for;
DynamoDB is a fully managed database so its pricing is not straightforward. There are some tips that can help you to optimize your costs. Let’s dive in! 🤿
Firstly, you need to select your region wisely. You can provision your tables in cheaper regions if you aren't concerned about the location of your data because you don't need to fulfill any legislation or compliance criteria.
Cheapest regions are; us-east-1, us-east-2, us-west-2, eu-north-1, eu-west-1.
DynamoDB includes two methods for retrieving a collection of items: Query and Scan. While they appear to serve the same goal, there is a significant difference between them. Query does a direct lookup to a particular partition based on primary or secondary partition/hash key, whereas Scan "scans" the whole database.
Queries will be much cheaper since you are charged only for items which are returned. In the scan case, you're being charged for all the rows scanned.
DynamoDB uses size dependent billing for both on-demand and provisioned capacity mode. Always strive to keep your records as short as possible. This helps you save storage by reducing the amount of data you need to store.
Saving photos to DynamoDB is like fueling your hybrid car full of gasoline. You can, but why use DynamoDB when you have an ore like S3? It will skyrocket your costs. Simply save your image in S3 and put the URL on DynamoDB.
Unused DynamoDB tables drain resources and increase your costs needlessly. Try to spot any tables that aren't in use and remove them. You'll need to go over the read/write operations on your tables to achieve this. Decide on frequency of use and it's an unused table if there hasn't been any read/write action in these given periods.
You may use AWS's free tier to scale up your operations. The free tier of DynamoDB has 25 GB of storage, 25 provisioned write capacity units (WCU), and 25 provisioned read capacity units (RCU). You can utilize these resources for up to a year for free, which will lower your monthly DynamoDB subscription cost.
Thank you for joining my adventure with DynamoDB; hope this article will help you. Don’t forget to check our other blog posts! Stay tuned for more! 🤓
A technology nerd, specializing in interpreting data and marketing, Melih is eager to learn and share his knowledge of business technologies. He is always extremely curious to learn more about how technology impacts organizations.
Subscribe to Our Newsletter
Our Service
Specialties
Copyright © 2018-2024 Sufle
We use cookies to offer you a better experience with personalized content.
Cookies are small files that are sent to and stored in your computer by the websites you visit. Next time you visit the site, your browser will read the cookie and relay the information back to the website or element that originally set the cookie.
Cookies allow us to recognize you automatically whenever you visit our site so that we can personalize your experience and provide you with better service.