primary key is unique 1. hash only 2. hash + range
hash range key key
optional
table item
attribute attributes are associated with items rather than tables (as in RDBMS)
hash range key key
sparse schema
Faster Development Customer Experiences Weatherbug mobile app
Super Bowl promotion
Lightning detection & alerting for 40M users/month
Millions of interactions over a relatively short period of time
Developed and tested in weeks, at “1/20th of the cost of the traditional DB approach”
Built the app in 3 days, from design to production-ready
Faster Development
Four Tips design for scale leverage range keys use libraries & tools develop & test locally
Design for Scale Common Problem = inefficiently designed schemas Hot spots create premature throttling Excessive payloads cost more to move
Design Goals: • Optimize the schema to the access patterns • Minimize multi-table fetches (for high-scale patterns) • Minimize payload size for each pattern
Design for Scale – Partitioning • DynamoDB automatically partitions data by the hash key Hash key spreads data (& workload) across partitions
• Auto-partitioning driven by:
table
Data set size Throughput provisioned large number of unique hash keys
ready to scale!
+ uniform distribution of workload across hash keys
partitions 1 .. N
Design for Scale – Efficient Schema Design 1. Identify the individual access patterns 2. Model each pattern to its own discrete data set 3. Consolidate data sets into tables and indexes Abbreviated Example: File Sharing Access Patterns given userid… • return all items by file name • return all items by date created • return all items by size • return all items by type • return all items by date updated
Range Keys • Enable modeling 1:M relationships hash
range
attributes
userid=“@mza”
postdate=“201309-12T20:59:28Z”
posttext=“New! Develop and test your apps with DynamoDB Local: http://aws.typepad.com/aws/2013/09/dynamodb-local-for-desktop-development.html … #aws”
userid=“@mza”
postdate=“201309-13T09:17:37Z”
posttext=“Also! Copy DynamoDB data between regions with Data Pipeline: http://aws.typepad.com/aws/2013/09/copy-dynamodb-data-between-regions-using-the-awsdata-pipeline.html … #aws”
userid=“@werner”
postdate=“201310-04T17:41:09Z”
posttext=“cool! RT @dialtone_: Worldwide DynamoDB replication for billions of rows a day? No problem! http://tech.adroll.com/blog/ops/2013/10/02/dynamodb-replication.html … @AdRoll can handle that!”
Range Keys – Simple API • Currently 13 operations in total Read and Write Items
Thank you for interesting in our services. We are a non-profit group that run this website to share documents. We need your help to maintenance this website.