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

Getting into DynamoDb

Getting into DynamoDb

AnkaraPhp - Haziran 2016
DynamoDb

E80bb03522c1606b401d0a87266e8910?s=128

Hasan Tayyar BEŞİK

June 09, 2016
Tweet

Transcript

  1. DynamoDb @htayyar github.com/hasantayyar Haziran 2016

  2. DynamoDb • Nosql • Hızlı • Performansı öngörülebilir • Ölçeklenebilir

    • Kolay yönetiliebilir
  3. 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/
  4. Data Size DynamoDb max Item size : 400KB S3 max

    Item size : 5TB
  5. 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/
  6. Table & Keys

  7. 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
  8. Data Type • String (S) - String Set (SS) •

    Number (N) - Number Set (NS) • Binary (B) - Binary Set (BS) • BOOL
  9. 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
  10. Hash Table UserId: 167 Name: Ali UserId: 168 Name: İsmail

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

    167 OrderDate: 1465033700 Status: Packing ... UserId: 167 Order: 1465035821 Status: Shipping ...
  12. Table

  13. Table

  14. Daha iyi bir partition key Suffix ekleme yöntemi • Random

    sonek • Kurallı son ek
  15. Index Dynamodb index türleri

  16. Indexes • Global Secondary Index • Local Secondary Index -

    bir çesit Sparse index • Sparse Global Index
  17. Scaling Throughput, Size, Partitioning

  18. 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
  19. Throughput • Throughput Hot Data ve Cold Data birlikte olmamalı

    Her zaman dilimi için farklı tablo kullanın Analytics201603 Analytics201604 Analytics201605
  20. 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
  21. 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
  22. RCU - WCU Read Capacity Unit : 4Kb/sec Write Capacity

    Unit : 1Kb/sec Birbirinden bağımsız degerler
  23. Burst Kapasiteniz bittiginde ek 5 dk daha veriyor DynamoDb

  24. Relations & Hiererchical Data Relational Data Structures

  25. Non-structured != non-relational

  26. 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 | +-------------+---------+
  27. Time Series Time series, Event logging

  28. Read Optimization Hot & popular data

  29. Sparse Global Index

  30. Para

  31. Tahmini Maliyet Hesaplama

  32. DynamoDb vs SimpleDb SimpleDb • Limited storage ☠ • Limited

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