Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Getting into DynamoDb

Getting into DynamoDb

AnkaraPhp - Haziran 2016
DynamoDb

Hasan Tayyar BEŞİK

June 09, 2016
Tweet

More Decks by Hasan Tayyar BEŞİK

Other Decks in Technology

Transcript

  1. Neden güzel • Ölçeklenebilir • Hızlı ve öngörülebilir performans •

    3 way replicated default • Automatic distribution • Amazon DynamoDB stores three geographically distributed replicas of each table to enable high availability and data durability. • SSD • In-place Atomic Updates • Tahmini maliyet hesaplayabilme https://aws.amazon.com/dynamodb/faqs/
  2. NoSql? Key-Value Stores • Voldemort, Dynomite, Tokyo Cabinet BigTable •

    “Column family, i.e. a tabular model where each row at least in theory can have an individual configuration of columns.” • HBase, Hypertable, Cassandra Document Databases • CouchDB, MongoDB, Riak Graph Databases • “Nodes & relationships, both which can hold key- value pairs” • Example: AllegroGraph, InfoGrid, Neo4j http://neo4j.com/blog/nosql-scaling-to-size-and-scaling-to-complexity/
  3. Table, Item, Query, Operator Queries • (Batch) Put/Get Item •

    Update Item • Delete Item • Query • Scan • Create/Delete/Update/Describe Table • Ayrıca DynamoDb Streams Api için ek sorgular • SortKey’e özel operatorler
  4. Data Type • String (S) - String Set (SS) •

    Number (N) - Number Set (NS) • Binary (B) - Binary Set (BS) • BOOL
  5. Keys • Partition/Hash key * ◦ Bu key ile DynamoDb

    unordered hash index olusturur. ◦ Bu hash index tablonun bölüntülenmesini saglar. • Sort/Range Key ◦ (HashKey + RangeKey) = Composite Key
  6. Hash Table UserId: 167 Name: Ali UserId: 168 Name: İsmail

    UserId: 169 Name: Sarah Partition0 PartitionN
  7. HashRange Table UserId: 167 OrderDate: 1465033834 Status: Delivered ... UserId:

    167 OrderDate: 1465033700 Status: Packing ... UserId: 167 Order: 1465035821 Status: Shipping ...
  8. Indexes • Global Secondary Index • Local Secondary Index -

    bir çesit Sparse index • Sparse Global Index
  9. Throuhput “To get the most out of DynamoDB throughput, create

    tables where the partition key has a large number of distinct values, and values are requested fairly uniformly, as randomly as possible.” http://docs.aws.amazon. com/amazondynamodb/latest/developerguide/GuidelinesForTables.html
  10. Throughput • Throughput Hot Data ve Cold Data birlikte olmamalı

    Her zaman dilimi için farklı tablo kullanın Analytics201603 Analytics201604 Analytics201605
  11. Partitioning Otomatik Partition ( readCapacityUnits / 3,000 ) + (

    writeCapacityUnits / 1,000 ) = initialPartitions ( 1,000 / 3,000 ) + ( 500 / 1,000 ) = 0.8333 --> 1 ( 1,000 / 3,000 ) + ( 1,000 / 1,000 ) = 1.333 --> 2
  12. Veri Boyutu Item sayısı sınırı yok ve item sayısının artması

    ile performans arasında doğrudan bir ilişki yok. Tablo büyüklügü sınırı yok ama dönemsel olarak bölmeniz tavsiye edilir En büyük Item 400KB olabilir LSI en fazla 10GB olabilir
  13. RCU - WCU Read Capacity Unit : 4Kb/sec Write Capacity

    Unit : 1Kb/sec Birbirinden bağımsız degerler
  14. Non-structured != non-relational StudentLesson +---------+-------------+ | Student | Lesson |

    +---------+-------------+ | Ali | Ekonomi | | Ali | İstatistik | | İsmail | Jazz Tarihi | | Sarah | Jazz Tarihi | +---------+-------------+ LessonStudents +-------------+---------+ | Lesson | Student | +-------------+---------+ | Ekonomi | Ali | | Ekonomi | İsmail | | Jazz Tarihi | İsmail | +-------------+---------+
  15. DynamoDb vs SimpleDb SimpleDb • Limited storage ☠ • Limited

    write/read capacity ☠ • Limited Scalability features ☠ • Tüm degerler indexlenir ☠ • Küçük projeler için ideal ✔