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

Amazon DynamoDB Deep Dive

oranie
May 16, 2019
68

Amazon DynamoDB Deep Dive

Mix Leap Study #42 - DB Night Osaka Vol.1での登壇資料です。
https://yahoo-osaka.connpass.com/event/128246/

oranie

May 16, 2019
Tweet

Transcript

  1. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark Amazon DynamoDB Deep Dive 2019/05/16
  2. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark G.C$ • 2> '(  ) id:oranie • D: –Web%- IPLI" E1J+-*;8)/  K=9ADM –(F WebB&@  40#MySQL Cassandra K=6 –Cassandra summit JPN 2014, 2017 !!?, • AWSJ 40 –NoSQL!<DynamoDB 3H75
  3. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark 
  4. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark      Users 1 million+ Data volume TB, PB, EB Locality Global Performance Milliseconds, microseconds Request rate Millions Access Mobile, IoT, devices Scale Up and down Economics Pay as you go Developer access Instant API access
  5. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark 3:6/$4/&/<9 0853 EC$"  Amazon.com :6# %/'.(.!. 17=+-/)!,*  /&/ ;2   — Werner Vogels CTO, Amazon
  6. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark Amazon DynamoDB Fully managed nonrelational database for any scale Fast, consistent performance Virtually unlimited throughput Virtually unlimited storage Encryption at rest and transit Fine-grained access control PCI, HIPAA, FIPS140-2 eligible Service-level agreement Maintenance free Serverless Auto scaling Backup and restore Global tables
  7. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark DynamoDB Advancements over the last 21 months VPC endpoints April 2017 Auto scaling June 2017 DynamoDB Accelerator (DAX) April 2017 Time To Live (TTL) February 2017 Global tables On-demand backup Encryption at rest November 2017 November 2017 November 2017 Point-in-time recovery March 2018 SLA June 2018 99.999% SLA August 2018 Adaptive capacity ACID November 2018 Transactions November 2018 On-demand
  8. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark
  9. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark You build it, you run it.
  10. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark Fully managed Maintenance free      Security Operating system patching Database patching Access control Audit Encryption Compliance Durability Sustain server, rack, and datacenter outages Re-replicate data quickly upon hardware failure Manage backup and restore Availability High availability configuration Monitoring Cross-region replication Performance Performance tuning Indexing In-memory caching Scalability Capacity planning Host provisioning Host repair and retirement
  11. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark 
  12. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark    table items attributes Partation Key Sort Key @M 0",*0< #0 / 07B 8G %+/ 1:N) - ,.0+/% J= Query'0! $-! 2 DL? CL 0FIG ==, <, >, >=, <= “begins with” “between” sorted results counts 5N/E> N3 &0:469 name/value <JSON <H (K1A ;O 
  13. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark 00 55 A9 54 FF AA 00 FF Partition Keys ")&()$  ")&() !%(   )')#' Id = 1 Name = Jim Hash (1) = 7B Id = 2 Name = Andy Dept = Eng Hash (2) = 48 Id = 3 Name = Kim Dept = Ops Hash (3) = CD Key Space
  14. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark Partition 3 Partition:Sort Key /5,5&04:)5.$5 6!Item!  /5,5&04)5.$5  /5,5&04$5)5.$5  (∞) §35#2(#4*1"4-+%'  00:0 FF:∞ Hash (2) = 48 Customer# = 2 Order# = 10 Item = Pen Customer# = 2 Order# = 11 Item = Shoes Customer# = 1 Order# = 10 Item = Toy Customer# = 1 Order# = 11 Item = Boots Hash (1) = 7B Customer# = 3 Order# = 10 Item = Book Customer# = 3 Order# = 11 Item = Paper Hash (3) = CD 55 A9:∞ 54:∞ AA Partition 1 Partition 2
  15. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark Partitions are three-way replicated Id = 2 Name = Andy Dept = Engg Id = 3 Name = Kim Dept = Ops Id = 1 Name = Jim Id = 2 Name = Andy Dept = Engg Id = 3 Name = Kim Dept = Ops Id = 1 Name = Jim Id = 2 Name = Andy Dept = Engg Id = 3 Name = Kim Dept = Ops Id = 1 Name = Jim Replica 1 Replica 2 Replica 3
  16. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark A,D B,E C,F Parition1 Partition2 ParitionN $,!(+5 ),' " !,&)),' "$,!(+8B /. 40 7E2<C6FE  ,3A@ ; <C  >  Partation KeyFE?=:D 1  1$,!,(+ RCU 3000 or WCU 1000-G !,&)9'*%(+#),' ": x x/N x/N x/N
  17. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark Local Secondary Index (LSI) • 0 a G 0G • 0 1 • B e SP G1b A1 (PK) A3 (Sort) A2 (table key) A1 (PK) A2 (Sort) A3 A4 A5 LSIs A1 (PK) A4 (Sort) A2 (table key) A3 (projected) Table KEYS_ONLY INCLUDE A3 A1 (PK) A5 (Sort) A2 (table key) A3 (projected) A4 (projected) ALL
  18. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark LSI#, 40" $  *-, '3 $2 +3  . 5!  %(&/ '3 $2 15LSI *-&/ Query '3 $2   1 5'3 . $25 )   *-&/ ()
  19. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark Global Secondary Index (GSI) Partition Key!"  Partition Key #&'   %$ A1 (PK) A2 A3 A4 A5 GSIs A5 (PK) A4 (Sort) A1 (table key) A3 (projected) Table INCLUDE A3 A4 (PK) A5 (Sort) A1 (table key) A2 (projected) A3 (projected) ALL A2 (PK) A1 (table key) KEYS_ONLY
  20. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark GSI%.#7$"& ,/.  .GSI -6 &53 82 4+ ,/'1 ,/. GSI  (6 *)0 !38 ,/'1 ) ( K IK K GK F ( IK K GK K F ( K IK K GK
  21. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark GSI  Table Primary table Primary table Primary table Primary table Global Secondary Index Client 1. Update request 2. Asynchronous update (in progress) 2. Update response GSI (&!$  $-'*"+#%), !
  22. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark    • - / d _d S aic jhk V Q f Xi • - / MB c k V vPz k Xi Ø cxn wg b HHD N B D N B MB H H D = H D H= H Ø HHD M H H . 2: ? Ø HHD N B D B H MB B M =B L H = D E M D : B B H • a _d a k Q_ b k V m qPs rPx_ b QXje b iR Q yl ou pXicR • , g b vPz tnP d Xi
  23. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. •   •  • Read/Write   • Query • Data-modeling • NoSQL  • Review -> Repeat -> Review TENETS OF DYNAMODB DATA MODELING
  24. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark AWS  Webinar https://amzn.to/JPWebinar  https://amzn.to/JPArchive Solutions Architect   2018/12/25
  25. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark
  26. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark Capacity Control
  27. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark      • D • B • DB 1 B • BD B
  28. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark      1 L • r i H r • e M Q • S W Q • H 1 L y t
  29. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark RDS for MySQL   B a D I A I A e a D I AM D Amazon RDS Amazon RDS AWS Cloud VPC Amazon EC2 Amazon EC2 Auto Scaling group
  30. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark # !  or or other ? "    $ large or xlarge or other ?
  31. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark    !$  %&#   "
  32. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark   • M c o m • p • Vc • i a c • . c • d . n l s e Jc V d y R Jc V a Cr d t
  33. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark Burst Capacity 0 400 800 1200 1600 Capacity Units Time Provisioned Consumed               : 300 (1200 × 300 = 3600 CU) 3 0 B D
  34. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark Auto Scaling Auto Scaling M; Auto ScalingR • 68  GPWCU RCU^@ 7N]I • ,03"/20$(JD [< WA_F? • 0$(O L[<WA_YC! $(:O • -*#.2(!2%31>\= SEX U>Z • +1-*3#)WCURCUGSIB ^@X U • ^@&3 '(8VT4`5`^@   • -*#.2(!2%31CLISDKH7>Z • 9VRK 9Qa
  35. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark DynamoDB on-demand DynamoDB ' capacity unitprovision  +83: pay-per-request " +8,9 61%"  +8<4, 9 5=( Virginia Region0- Write request : 100&/ $1.25 Read request : 100&/ $0.25 +8*#%;=27 ) .8!% $ +8,9
  36. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark Parition1 Partition2 ParitionN "*&)2 '*% *$''*% "*&) 5? -, 1. 4B/9@3 CB  * 0>= 8  9@  ; Partation KeyCB <:7A 1"**&)RCU 3000 or WCU 1000 +D *$' 6%(#&)!'*% : x x/N x/N x/N
  37. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark Parition1 Partition2 Parition3 FC4('"&- 65I ''"&<$'!' $.*28''"&: 2 :, ' $.* 500 Request/sec / >0;E7''"&B *+3=9 keyH)  ''"&G@E7 $'!D1%#& A?
  38. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark Adaptive capacity https://docs.aws.amazon.com/ja_jp/amazondynamodb/latest/developerguide/bp-partition-key- design.html#bp-partition-key-partitions-adaptive
  39. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark Instant adaptive capacity DynamoDB ""!,7 Key benefits: • #(3 ""&* )+$0 • - '2 • ON 9%.:  5146 Santa Clara summit8./;< https://www.slideshare.net/AmazonWebServices/scale-fearlessly-with-amazon- dynamodb-adaptive-capacity-adb302-santa-clara-aws-summit
  40. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark RDBMS -3%2 <I%3#"&[P DA0" #U8LS;K App:YXZV96 @4)3'ZV\5  QO DynamoDB.33WG HB 7EZVF ?R*3$3 /2<= Dynamic partitioning MTNCon-demand mode J> DynamoDBZV+(!,2&2$1!2"HB
  41. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark  • B S • Q D L N •    
  42. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon Confidential and Trademark Thank you!