The topics you need to know for the Dynamo DB:
- Primary Key
- RCU / WCU
- APIS
- Query VS Scan
- GSI
- LSI
- Stream
- TTL
- Transection
- Dynamo DB as session state cache
- Write Types
- Fast, Flexible No SQL Database
- Single digit ms latency, fully managed
- Supports document and key-value(web, gaming, ad-tech, IOT)
- Table, Item(row), attribute ( key-value )
- Writes are written into 3 different location/facilities/datacenter (synchronous)
- Synchronously replicates data across the three facilities in AWS region, Giving you high availability and data durability.
- Optimistic locking
- Conditional Updates
- TTL Expiry Date ( Epoch format)
- Amazon DMS : migrate to dynamoDB from mongo oracl, mysql etcs
- Primary Key
- Two types of primary key
- Single Attribute( Unique Id) : Partition key (Hash Key) composted of 1 attribute
- No Nesting allowed here
- It helps to determine the physical location of data
- Composite Key( Unique id and Range) : Partition Key (Hash Key) and Sort Key ( Range Key) eg, date
- Composed of two attributes
- If two data has same partition key then it must have a different sort key
- Single Attribute( Unique Id) : Partition key (Hash Key) composted of 1 attribute
- Secondary Indexes
- Local Secondary Index
- Same Partition Key + Different Sort Key
- Can only be created while creating the table, Can’t be added/removed or modified later
- Global Secondary Index
- Different Partition Key + Different Sort Key
- Can be created during the table creation and Can be added
- later or remove/modify later
- Same Partition Key + Different Sort Key
- Query VS Scan
- ProjectionExpression parameter : Only returns a selected attributes.
- Query Operation is more efficient then Scan Operation
- For Quick response time design Use
- Query Get or BatchGetItem ( read multiples items, Can get upto 100 items or upto 16MB of Data
Query | Scan |
Find items in a table by using only primary key attributes. Must provide partition attribute name and the value to searchOptionally provide a sort key attribute name and value to refine search | Examine every item |
By default, Returns all the data attributes for those items with specified primary keys | By default, Returns all the data attributes |
Results are always sorted by the sort key (By default,ascending for both number and string). To reverse the sort order set the ScanIndexForward Parameter to false | |
By default, Going to be eventually consistent | |
Max limit of data can be retrieved by a scan operation: 1MB |
- RCU / WCU
- Provisioned Throughput
- Read Provisioned Throughput
- RCU Price per hour : $0.00013
- All units are rounded upto 4KB
- Strongly reads 4KB items 1 read : 4KB chunks * no of items
- Eventually reads 4KB items 2 reads : 4KB chunks * no of items / 2
- Write Provisioned Throughput
- WCU Price per hour : $0.00065
- All units are rounded up to 1 KB
- Strongly consist of 1KB item 1 write per second : 1KB * no of items
- Eventually consist of 2KB item 1 write per second : 2KB * no of items
- Read Provisioned Throughput
- ProvisionedThroughputExceedExpection :
- 400 HTTP Status code
- Exceed maximum allowed provisioned throughput for a table
- Exceed maximum allowed One or more global secondary index
- Exceed particular hash key
- ProvisionedThroughput
- Per account for US East 80K read and 80K write
For other region 20K
- Per account for US East 80K read and 80K write
- Smallest amount of reserved capacity 100RCU or 100WCU
- AssumeRoleWithWebIdentity : role
- Idempotent Conditional write
- Must use If data is critical and no margin of error
- Atomic counter : always need to increment so its not Idempotent
- DAX(Dynamo DB Accelerator)
- Dedicated service designed to cache DynamoDB request
- Automatically add the data in DAX if there is cache miss or update the data if it is updated in the table
- Dedicated service designed to cache DynamoDB request
- Total Number of tables per region :
- 256 tables per region
- Maximum limit of data that can be retrive from scan operation is :
- 1MB
- BatchGetItem returns Maximum of :
- 16MB or 100 items
- Maximum Allowed Scondary index per Dynamo DB :
- 25( 20 Global + 5 Local )
- Maximum Collection Size of Items in Dynamo DB :
- 10 GB
- Maximum size of items in Dynamo Table :
- 400 KB ( 5 TB in S3 bucket)
- ItemCollectionSizeLimitExceedException :
- Size of group of items with the same partition key value has exceeded 10GB.
- Strategy : Optimistic concurrency control/lock