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

AWS DynamoDB Accelerator (DAX) 101

Ken Wagatsuma
February 14, 2020

AWS DynamoDB Accelerator (DAX) 101

Introduction to AWS DynamoDB Accelerator (DAX)

Ken Wagatsuma

February 14, 2020
Tweet

More Decks by Ken Wagatsuma

Other Decks in Programming

Transcript

  1. DAX 101
    1
    2020/2/15
    Kenju Wagatsuma

    View full-size slide

  2. DAX Wrap Up
    2

    View full-size slide

  3. DAX is…
    DynamoDB-specific
    in-memory cache store
    3

    View full-size slide

  4. [DAX] Glossary of Terms
    4
    5FSN %FTDSJQUJPO
    /PEFT
    "OPEFJTUIFNJOJNVNDPNQPOFOUGPSB%"9DMVTUFSl1SJNBSZOPEFzIBOEMFSFBE
    XSJUFSFRVFTUTBOElSFQMJDBOPEFTzPOMZIBOEMFSFBESFRVFTUT
    $MVTUFST "DMVTUFSJTDPNQPTFEGSPNOPEFT
    1BSBNFUFS(SPVQT :PVDBODIBOHF55-CZTFUUJOHDVTUPN1BSBNFUFS(SPVQT

    View full-size slide

  5. [DAX] Comparison to other cache store
    5
    %"9 &MBTUJDBDIFNFNDBDIFE JONFNPSZ
    .BOBHFE ✅ ✅
    4IBSFEDBDIF ✅ ✅
    #BDLFOEEBUBTPVSDF %ZOBNP%#POMZ BOZUIJOH .Z42- %JTL 31$ FUD

    .FUSJDT ✅ ✅
    55-

    HMPCBM55-
    ✅ ⚠
    IBSEXPSLSFRVJSFE
    1FSGPSNBODF ЖdNT dNT ЖdЖ

    View full-size slide

  6. [DAX] Single-leader Replication
    6
    +3 nodes for different Multi-A/Z for production
    Background replication (eventually consistent model)
    Single “primary node” handles all write requests

    View full-size slide

  7. Subnet C
    Subnet B
    DAX
    Cluster Subnet A
    [DAX] Single-leader Replication - Write
    7
    Primary
    Replica
    Replica

    View full-size slide

  8. DAX
    Cluster
    [DAX] Single-leader Replication - Write
    8
    Primary
    Replica
    Replica
    Application
    DynamoDB
    Table
    DynamoDB
    Table
    Write
    Read

    View full-size slide

  9. DAX
    Cluster
    [DAX] Single-leader Replication - Replicate
    9
    Primary
    Replica
    Replica
    Application
    DynamoDB
    Table
    DynamoDB
    Table
    Write
    Read

    View full-size slide

  10. DAX
    Cluster
    [DAX] Single-leader Replication - Read
    10
    Primary
    Replica
    Replica
    Application
    DynamoDB
    Table
    DynamoDB
    Table
    Write
    Read

    View full-size slide

  11. [DAX] Cache Algorithm
    11
    Least Recently Used (LRU) cache
    Negative cache also implemented
    Eviction happens when items are taken & cache is full
    Global Time-To-Live (TTL)

    View full-size slide

  12. [DAX] Item Cache / Query Cache
    12
    Item Cache Query Cache
    Operation GetItem / BatchGetItem Query / Scan
    Metrics ItemCacheHits/ItemCacheMisses
    QueryCacheHits/QueryCacheMisses
    ScanCacheHits/ScanCacheMisses

    View full-size slide

  13. [DAX] Write Strategy - Write-Through
    13
    #write
    #read
    Application DAX DynamoDB
    Application DAX DynamoDB

    View full-size slide

  14. [DAX] Write Strategy - Write-Around
    14
    #write
    #read
    Application DynamoDB
    Application DAX DynamoDB

    View full-size slide

  15. [DAX] Write Strategy
    15
    8SJUF5ISPVHI 8SJUF"SPVOE
    1SPT
    4ZODISPOJ[FEJUFNTCFUXFFO%"9
    BOE%ZOBNP%#
    8SJUFDBOTDBMF FHCVMLVQEBUF

    $POT
    ☹8SJUFPQFSBUJPOIBTPWFSIFBE
    ☹*UFNTDBOCFJODPOTJTUFOU JGPUIFS
    BQQXSJUFUP%ZOBNP%#EJSFDUMZ

    ☹&WFOUVBMMZ$POTJTUFOU JUFNTJO%"9
    OPEFTDBOCFPVUEBUFE

    View full-size slide

  16. [DAX] Within VPC + Multi-A/Z
    16

    View full-size slide

  17. [DAX] Limitation
    17
    Maximum nodes is 10 (1 primary node + ~9 replica nodes)
    Maximum nodes is 50 per Region.
    Maximum Parameter Groups is 20 per Region
    Maximum DAX Subnet Groups is 50 per Region.
    Maximum subnets per groups is 20.

    View full-size slide

  18. Monitoring
    18

    View full-size slide

  19. [Monitoring] CloudWatch Metrics
    19
    NFUSJDT EFTDSJQUJPO
    $166UJMJ[BUJPO
    PG$16VUJMJ[BUJPOUTNBMMVTFW$16
    ⚠:PVOFFEUPTDBMFVQJGUIJTNFUSJDTJTTBUVSBUFE
    *UFN$BDIF)JUT
    *UFN$BDIF.JTTFT
    $BMDVMBUF$BDIF)JU3BUJP
    GSPNUIFTFNFUSJDT
    ⚠*UFN$BDIF2VFSZ$BDIF

    View full-size slide

  20. [Monitoring] CloudWatch Metrics
    20
    NFUSJDT EFTDSJQUJPO
    5ISPUUMJOH3FRVFTU$PVOU
    PGSFRVFTUTUISPUUMFECZUIFOPEFPSDMVTUFS
    ⚠5ISPUUMFEBU%"95ISPUUMFEBU%ZOBNP%#
    'BJMFE3FRVFTU$PVOU
    PGSFRVFTUTUIBUSFTVMUFEJOBOFSSPSSFQPSUFE
    ⚠&SSPS3FR$PVOU5ISPUUMFE'BJMFE

    View full-size slide

  21. [Monitoring] CloudWatch Metrics
    21
    NFUSJDT EFTDSJQUJPO
    &WJDUFE4J[F
    ⚠*G$BDIF)JU3BUJP&WJDUFE4J[FJTHSPXJOH UIF
    XPSLJOHTFUNJHIUJODSFBTF4IPVMEDPOTJEFSTDBMFVQ
    $MJFOU$POOFDUJPOT
    PGTJNVMUBOFPVTDPOOFDUJPOTGSPNDMJFOUT
    ⚠$MJFOU$PO$PVOU㲈PG3VOOJOH5BTLT

    View full-size slide

  22. [Monitoring] Grafana
    22

    View full-size slide

  23. [Monitoring] SLI/SLO
    23

    View full-size slide

  24. [Alerting] CW Alarm - Infrastructure
    25
    CW
    Alarm
    SNS
    Topic
    Lambda Slack

    View full-size slide

  25. [Alerting] CW Alarm - CPUUtilization
    26

    View full-size slide

  26. [Alerting] CW Alarm - Cache Hit Ratio
    27
    ItemCacheHitRatio =
    ItemCacheHits / ( ItemCacheHits + ItemCacheMisses )

    View full-size slide

  27. [Alerting] CW Alarm - Cache Hit Ratio
    28

    View full-size slide

  28. [Alerting] DAX Events - Infrastructure
    29
    DAX
    Event
    SNS
    Topic
    Lambda Slack

    View full-size slide

  29. [Alerting] DAX Events - Infrastructure
    30
    failure/success
    in adding a node
    changes to the
    security groups

    View full-size slide