2.1.4. Application State Management with Amazon DynamoDB
First Principle: Amazon DynamoDB provides a fast, flexible NoSQL database for high-performance state management at any scale, enabling developers to build applications with consistent, low-latency data access.
DynamoDB stores and retrieves data at any scale with single-digit millisecond latency ā but only if you design your table keys correctly. The partition key determines how data is distributed, and a poor choice creates hot partitions that throttle your application. It's designed for applications that require consistent, single-digit millisecond latency at any scale, making it ideal for managing application state.
- Tables: Collections of data.
- Items: A group of attributes that is uniquely identifiable among all of the other items in a table. In DynamoDB, there is no limit to the number of items you can store in a table.
- Attributes: Fundamental data element. Similar in concept to a field or column in other database systems.
- Primary Key: Uniquely identifies each item in a table. Composed of a Partition Key (hash attribute) and optionally a Sort Key (range attribute).
- NoSQL: Flexible schema, not relational. This gives developers freedom in defining attributes for each item.
Scenario: You're developing a mobile gaming application that needs to store millions of player profiles and game session data. The data schema might evolve, and the application requires very low-latency reads and writes for individual player items at massive scale.
ā ļø Exam Trap: DynamoDB is NOT a relational database. There are no joins, no foreign keys, no complex queries across tables. If a question requires relational operations, DynamoDB is the wrong answer ā use RDS or Aurora.
