Let’s start with what Amazon Dynamo DB is and what it can be useful for. It is one of the services of the Amazon cloud, delivered as a service, i.e. – AWS deals with the management of individual components of this service. DynamoDB is a NoSQL database and has been designed to store and manage data in the form of a single table. The Dynamo DB table itself can be located in many AWS regions and act as a multi-master table. Its capabilities allow you to handle over 10 billion requests per day and accept up to 20 million requests per second.
The undeniable advantages are the performance and scalability of the service. You can virtually apply it to any amount of data you have. Another advantage is that it is a 100% serverless service – AWS deals with low-level management and scaling of infrastructure needed for its operation.
Dynamo DB automatically scales tables to adjust capacity and maintains performance with zero administration. In on-demand mode, the Amazon Dynamo DB service automatically adjusts to appearing loads. The result is greater efficiency and no need to change the application code and the ability to use existing APIs. Dynamo DB provides automatic scaling of bandwidth and storage based on previously set performance and monitors application performance.
The integration of the service with AWS Lambda allows you to use triggers, with the help of which you can automatically perform a custom function after detecting a change in status in the Dynamo DB table.
The last and also very important aspect is the enterprise readiness of the service. It means more or less that it is built with critical load in mind as support for ACID transactions that require complex business logic. The service also supports data protection by coding and continuous backup guaranteeing a contractual SLA level.
If it is clear what Dynamo DB is, let’s get to the best practices related to it.
The first principle is the effective design and use of partition keys.
There are two types of keys to choose from: basic and composite. The basic one is a simple partition key, while the complex one can be extended with a sort key. The right way to design them allows you to get benefits related to the available capacity and its adaptation to changing requirements. Dynamo DB has been designed to most efficiently process data distributed evenly into partitions.
The second rule is to use a sort key to categorize data.
Well-designed sort keys collect related information in one place. Complex sorting keys also allow you to define hierarchical (one-to-many) relationships in data.
The third principle is the effective use of secondary indexing.
Additional indexes are often necessary to handle the query patterns required by the application. At the same time, if you do not need to use indexing, you should not use it. We can then unnecessarily increase costs and reduce the efficiency of our application.
The fourth principle is to understand how to store data and their attributes.
The Dynamo DB service limits the size of each resource so that it can be stored in the table. Thanks to the possibilities of compressing, there is an option to reduce the size of stored items. Efficient use of indexing by sorting keys, also allows you to divide a larger element into several smaller ones. And thanks to the integration of Dynamo DB with the Amazon S3 service, it is possible to store resources in it as objects or object identifier in S3 in the Dynamo DB table.
The fifth rule refers to the use of tables in Dynamo DB.
The recommendations say that the number of tables used should be kept to a minimum. One table is enough for several applications, However, when it comes to data in time series, one table for applications per cycle should be used.
The sixth rule is the management of many dependencies.
The demarcation lists appearing here are a design pattern in modeling the management of many dependencies. They provide a way to represent chart data in Dynamo DB.
The seventh principle refers to the implementation of hybrid environments.
If the migration of data to the Dynamo DB service is not feasible, it is worth thinking about the solution, which may be the creation of a hybrid environment.
In the eighth principle, we devote attention to the modeling of relational data in NoSQL.
When we expect fast realized inquiries, during high traffic, the use of NoSQL has its economic and technical advantages. Thanks to Dynamo DB – its properties and favourable price list, we can avoid problems with scalability limitations.
The ninth principle is related to queries and data scanning.
In this aspect, best practices related to the performance of scanning, avoiding jumps in the activity of readings or using parallel scanning. More can be found in the AWS documentation available here.
The last, tenth principle is related to global tables and their use.
The Amazon Dynamo DB service allows you to create fully scalable and manageable solutions without having to maintain and create your own replica. When creating a global table, we specify the AWS regions in which the table should be available. And Dynamo DB will take care of the rest of the tasks related to creating and updating the remaining tables in selected regions.
All the aforementioned principles are the basis for obtaining the best possible results, both in implementation and financial aspects. Why Amazon Dynamo DB is a competitive solution on the market? Because it allows you to quickly and efficiently apply the service to any amount of data, including the lack of server facilities. In order to get answers to bothering your questions, it is worth looking at the AWS’ forum devoted to Dynamo DB.