57
Amazon DynamoDB Yuko Mori Solutions Architect Amazon Data Services Japan K.K.

Amazon’DynamoDB - dbstudychugoku.github.iodbstudychugoku.github.io/pdf/tyokyo01-dynamodb-MyNA.pdf · Agenda • DyanamoDBとは • Table,%API , Data Type • Indexes • Scaring

  • Upload
    lytruc

  • View
    225

  • Download
    3

Embed Size (px)

Citation preview

  • Amazon DynamoDBYuko MoriSolutions ArchitectAmazon Data Services Japan K.K.

  • ( )

    SierPLPM

    AWS

  • Agenda

    DyanamoDB Table, API, Data Type Indexes Scaring & DynamoDB Streams

  • DyanamoDB

  • Amazon DynamoDB Amazon.comRDBMS

    RDBMSDynamo

    HW

  • Amazon DynamoDB NoSQL

    3x API

  • Tables, API, Data Types

  • Table tableitems

    attributes

    HashKey

    RangeKey

    1:NQuery

    ==, , >=,

  • CreateTable UpdateTable DeleteTable DescribeTable ListTables

    GetItem PutItem UpdateItem DeleteItem

    Query Scan

    BatchGetItem BatchWriteItem

    Liststreams DescribeStream GetShardIterator GetRecords

    Table API

    Streams API

    DynamoDB

    In preview

  • AWS SDKs and CLI

    SDKCLI

    Java Python PHP .NET Ruby nodeJS

    iOS AndroidJavascriptin the Browser AWS CLI

  • Data Types

    String (S) Number (N) Binary (B)

    String Set (SS) Number Set (NS) Binary Set (BS)

    Boolean (BOOL) Null (NULL) List (L) Map (M)

    JSON

  • Document (JSON)

    (M, L, BOOL, NULL) JSON

    Document SDKs JSONJSON Java, JavaScript, Ruby, .NET

    Javascript DynamoDBstring Snumber Nboolean BOOLnull NULLarray Lobject M

  • 00 55 A954 AA FF

    Hash Table Hash key ()

    00 FF

    Id = 1Name = Jim

    Hash (1) = 7B

    Id = 2Name = AndyDept = EnggHash (2) = 48

    Id = 3Name = KimDept = Ops

    Hash (3) = CD

    Key Space

  • 3

    Id = 2Name = AndyDept = Engg

    Id = 3Name = KimDept = Ops

    Id = 1Name = Jim

    Id = 2Name = AndyDept = Engg

    Id = 3Name = KimDept = Ops

    Id = 1Name = Jim

    Id = 2Name = AndyDept = Engg

    Id = 3Name = KimDept = Ops

    Id = 1Name = Jim

    Replica 1

    Replica 2

    Replica 3

    Partition 1 Partition 2 Partition N

  • Hash-Range Table Hash + Range Hash keyRange key

    Hash KeyLocal Secondary Indexes

    00:0 FF:

    Hash (2) = 48

    Customer# = 2Order# = 10Item = Pen

    Customer# = 2Order# = 11Item = Shoes

    Customer# = 1Order# = 10Item = Toy

    Customer# = 1Order# = 11Item = Boots

    Hash (1) = 7B

    Customer# = 3Order# = 10Item = Book

    Customer# = 3Order# = 11Item = Paper

    Hash (3) = CD

    55 A9:54: AAPartition 1 Partition 2 Partition 3

  • DynamoDB

    Write Ack

    Read

    Consistent Read ReadWrite

  • Indexes

  • Local Secondary Index (LSI) Range keykey Hash key 10 GB

    A1(hash)

    A3(range)

    A2(table key)

    A1(hash)

    A2(range)

    A3 A4 A5

    LSIs A1(hash)

    A4(range)

    A2(table key)

    A3(projected)

    Table

    KEYS_ONLY

    INCLUDE A3

    A1(hash)

    A5(range)

    A2(table key)

    A3(projected)

    A4(projected) ALL

  • Global Secondary Index (GSI) Hash Key Hash Key

    A1(hash)

    A2 A3 A4 A5

    GSIs A5(hash)

    A4(range)

    A1(table key)

    A3(projected)

    Table

    INCLUDE A3

    A4(hash)

    A5(range)

    A1(table key)

    A2(projected)

    A3(projected) ALL

    A2(hash)

    A1(table key) KEYS_ONLY

  • GSI

    Table

    Primary tablePrimary tablePrimary tablePrimary table

    Global Secondary Index

    Client

    2. Update(in progress)

    GSI

  • Scaling

  • Scaling

    DynamoDB

    1 400 KB local secondary index 10GB

  • Read Capacity Units (RCU) 1 x (4 KB ) 2

    11.2KB(1.2/ 4 = 0.3 1 )1000/1000 1 = 1000 RCU

    2:4.5KB (4.5 / 41.1 2 ) 1000/1000 2 = 2000 RCU1000 2 = 1000 RCU

  • Write Capacity Units (WCU)

    1 x (1 KB ) 1KB

    1512B(0.512/ 1 0.5 1 ) 1000/1000 1 = 1000 WCU

    2:2.5KB (2.5 / 1 = 2.5 3 ) 1000/1000 3 = 3000 WCU

    RCU WCU

  • CloudWatch

  • DynamoDB

    partition 1 ..N

    partitions1 .. N

    table

  • # ( )

    = 678 89:;