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

AuroraかRDSどちらを選ぶべきか | Developers.IO 2019 in OSAKA

F9ace682a6b4ff7b2eef422f21ace8a4?s=47 kazue
October 11, 2019

AuroraかRDSどちらを選ぶべきか | Developers.IO 2019 in OSAKA

https://dev.classmethod.jp/cloud/aws/developers-io-2019-in-osaka-aurora-or-rds/
こちらに詳細を記載していますのでこちらをご覧ください。

F9ace682a6b4ff7b2eef422f21ace8a4?s=128

kazue

October 11, 2019
Tweet

More Decks by kazue

Other Decks in Programming

Transcript

  1. "VSPSB͔3%4
 ͲͪΒΛબͿ΂͖͔ "84ࣄۀຊ෦ίϯαϧςΟϯά෦ ਺ࢬਖ਼थ

  2. ࣗݾ঺հ  ͔ͣ͑ • AWSࣄۀຊ෦ ίϯαϧςΟϯά෦ • େࡕΦϑΟεۈ຿ • 2019೥1݄JOIN

    • ৬ྺ • WEBίϯαϧʢडୗ։ൃʣ8೥ • ࣗࣾαʔϏε։ൃӡ༻อक 2೥ • ޷͖ͳAWSαʔϏε • Terraform
  3. #cmdevio
 #Classmethod

  4. ͜ͷηογϣϯͷΰʔϧ  AuroraͱRDSͷҧ͍Λཧղͯ͠ɺ
 ద੾ʹ࢖͍෼͚Δ͜ͱ͕Ͱ͖ΔΑ͏ʹͳΔ

  5. ΋͘͡  • RDSͱ͸ • Auroraͱ͸ • RDSͱAuroraͷҧ͍ • RDS͔AuroraͲͪΒΛબͿ΂͖͔

    • ·ͱΊ
  6. 3%4ͱ͸  "NB[PO3FMBUJPOBM%BUBCBTF4FSWJDF w ϚωʔδυܕϦϨʔγϣφϧσʔλϕʔεαʔϏε w γϯϓϧ͔ͭਝ଎ʹεέʔϧ w ߴ଎ɺ҆ఆͨ͠ύϑΥʔϚϯε w

    ௿ίετɺैྔ՝ۚ w ϑΣʔϧΦʔόʔߏ੒Λ؆୯ʹ࣮ݱՄೳ
  7. "VSPSBͱ͸  "NB[PO"VSPSB w Ϋϥ΢υ޲͚ʹ"84͕ߏஙͨ͠3%#αʔϏε w ίϚʔγϟϧσʔλϕʔεͷੑೳͱՄ༻ੑ w Φʔϓϯιʔεσʔλϕʔεͷγϯϓϧ͞ͱίετޮՌ w

    .Z42-ͱ1PTUHSF42-ͱͷޓ׵ੑ͋Γ w .Z42-ͷ࠷େഒɺ1PTUHSF42-ͷ࠷େഒߴ଎
  8. ͦ΋ͦ΋ɺ͜ͷηογϣϯͷλΠτϧ͸͓͔͍͠  Aurora͸RDSͷҰ෦ ਖ਼֬ʹ͸
 "VSPSB͔
 "VSPSB͡Όͳ͍3%4
 ͲͪΒΛબͿ΂͖͔

  9.  RDSͱAuroraͷҧ͍

  10. 3%4ͱ"VSPSBͷҧ͍  w ΞʔΩςΫνϟͷҧ͍ w "VSPSBʹ͔͠ͳ͍ػೳ

  11.  ΞʔΩςΫνϟͷҧ͍

  12. ΞʔΩςΫνϟͷҧ͍3%4  w IUUQTJNBHFTMJEFTIBSFDEODPNBXTCMBDLCFMUBVSPSBQPTUHSFTRMBXT CMBDLCFMUPOMJOFTFNJOBSBNB[POBVSPSBXJUIQPTUHSFTRMDPNQBUJCJMJUZKQH DC

  13. ΞʔΩςΫνϟͷҧ͍"VSPSB  w IUUQTJNBHFTMJEFTIBSFDEODPNBXTCMBDLCFMUBVSPSBQPTUHSFTRMBXT CMBDLCFMUPOMJOFTFNJOBSBNB[POBVSPSBXJUIQPTUHSFTRMDPNQBUJCJMJUZKQH DC w ";ܭՕॴͷετϨʔδʹ
 σʔλίϐʔ w

    ֤ετϨʔδؒͰ΍ΓͱΓ͠ ͯࣗಈम෮ w ՕॴฒྻʹΞΫηε w ॻ͖ࠐΈ͸ɺಡΈࠐΈ ͕੒ޭͨ͠Β"$,
  14.  Auroraʹ͔͠ͳ͍ػೳ

  15. 1SPUFDUJPO(SPVQT  w IUUQTBXTBNB[PODPNKQCMPHTEBUBCBTFJOUSPEVDJOHUIFBVSPSBTUPSBHFFOHJOF

  16. 1SPUFDUJPO(SPVQT  όοΫΞοϓ/ϦετΞ/ϦΧόϦʔ͕ૣ͍ w IUUQTJNBHFTMJEFTIBSFDEODPNBXTCMBDLCFMUBVSPSBQPTUHSFTRMBXT CMBDLCFMUPOMJOFTFNJOBSBNB[POBVSPSBXJUIQPTUHSFTRMDPNQBUJCJMJUZKQH DC

  17. #BDL5SBDL  Ϣʔεέʔε • Φϖϛε࣌ͷ෮چ • σʔλมߋλΠϛϯάͷௐࠪ σʔλΛר͖໭͢ w IUUQTJNBHFTMJEFTIBSFDEODPNBXTCMBDLCFMUBVSPSBNZTRMBXTCMBDLCFMU

    POMJOFTFNJOBSBNB[POBVSPSBNZTRMKQH DC
  18. ΫϥελΩϟογϡ؅ཧʹΑΔߴ଎ϦΧόϦ  ͜Ε·Ͱ:ϑΣΠϧΦʔόʔޙͷΩϟογϡͷճ෮ʹ͔͔࣌ؒΔ w IUUQTQBHFTBXTDMPVEDPNST5;.JNBHFT%QEG

  19. ΫϥελΩϟογϡ؅ཧʹΑΔߴ଎ϦΧόϦ  w IUUQTQBHFTBXTDMPVEDPNST5;.JNBHFT%QEG ϓϥΠϚϦঢ֨ͨ͠Πϯελϯε͕࠷ॳ͔ΒϗοτͳΩϟογϡอ࣋

  20. ฒྻΫΤϦ  w IUUQTQBHFTBXTDMPVEDPNST5;.JNBHFT%QEG • ΫΤϦ࣮ߦɺτϥϯβΫγϣϯͳͲ͸
 Πϯελϯεͷ໾ׂ • ετϨʔδଆʹ΋CPU͕ଘࡏ(਺ઍݸʣ •

    Ұ෦ΛɺετϨʔδଆϦιʔεͰߦͳ͏
 ˠ ॲཧߴ଎Խ • ΫΤϦ͕࠷େͰ120ഒߴ଎ʹͳͬͨ • 22ΫΤϦͷ͏ͪ8ΫΤϦͰ10ഒҎ্ߴ଎Խ ➡ ΠϯελϯελΠϓΛr3.8xlarge→r3.2xlarge
 ʹམͱͤͨ
  21. (MPCBM%BUBCBTF  ετϨʔδϨΠϠͰͷϦʔδϣϯؒϨϓϦέʔγϣϯ w IUUQTTQFBLFSEFDLDPNNBSPPOTUPTIPVRJOHOJSJ[JZPOKJBOESHBEFLJSVBVSPSBHMPCBMEBUBCBTFGBMTFTIJMJXPKJBO UFNJUB TMJEF ैདྷͷCross-Region Read Replica

  22. (MPCBM%BUBCBTF  ετϨʔδϨΠϠͰͷϦʔδϣϯؒϨϓϦέʔγϣϯ w IUUQTQBHFTBXTDMPVEDPNST5;.JNBHFT%QEG w IUUQTEFWDMBTTNFUIPEKQDMPVEBXTSFHSPXUIBVSPSBHMPCBMEBUBCBTF • 1ඵҎ಺ͷϨϓϦΧ஗Ԇ •

    1෼Ҏ಺ͷ෮چ • ϨϓϦέʔγϣϯઌϦʔ δϣϯʹDBΠϯελϯε ݐͯͳͯ͘΋OK
 →௿Ձ֨ͰDRରԠՄ
  23. "VSPSB4FSWFSMFTT  w IUUQTQBHFTBXTDMPVEDPNST5;.JNBHFT%QEG • DBΠϯελϯεͷ؅ཧෆཁ:
 ෛՙʹԠͯࣗ͡ಈεέʔϧ • ࢖༻͍ͯ͠ͳ͍࣌ʹ͸γϟοτμ΢ ϯˠΠϯελϯεͷྉ͔͔ۚΒͳ͍

    • Ϣʔεέʔεɿ։ൃ؀ڥ/धཁ͕ಡΊ ͳ͍ϫʔΫϩʔυ • REST API / SDK ͔Β΋ΞΫηεՄೳ ʹʢAurora Serverless Data APIʣ
  24. "VSPSBʹ͔͠ͳ͍ػೳ  • όοΫΞοϓ/ϦετΞ/ϦΧόϦʔ͕ૣ͍(Protection Groups) • BackTrack • ΫϥελΩϟογϡ؅ཧʹΑΔߴ଎ϦΧόϦ •

    ฒྻΫΤϦ • Global Database • Aurora Serverless • ΄͔ʹ΋৭ʑ৭ʑ ✴ DBΤϯδϯɺόʔδϣϯʹΑͬͯରԠঢ়گ͕·ͪ·ͪͳͷͰ஫ҙ
  25.  RDS͔AuroraͲͪΒΛબͿ΂͖͔

  26. 

  27.  ͦͷલʹ

  28. 

  29. ϦϨʔγϣφϧσʔλϕʔε͕࠷ద͔  • RDBҎ֎ʹ΋༷ʑͳσʔλϕʔεαʔϏε͕͋Δ • ·ͣ͸RDBҎ֎΋ީิʹೖΕͯݕ౼͠Α͏ • SUMMITͷηογϣϯ͕͓͢͢Ί https://www.youtube.com/watch?v=h1r8AzOdlqo

  30. 

  31. "VSPSBΛ࢖͑ͳ͍έʔε  • DBΤϯδϯ͕ҟͳΔ • όʔδϣϯ͕ҟͳΔ • ετϨʔδΤϯδϯ͕ҟͳΔʢMySQLͷ৔߹ʣ • ΠϯελϯελΠϓ͕ҟͳΔ

  32. %#Τϯδϯ͕ҟͳΔ 

  33. όʔδϣϯ͕ҟͳΔ         

     
  34. ετϨʔδΤϯδϯ͕ҟͳΔʢ.Z42-ͷ৔߹ʣ  • Aurora͕αϙʔτ͍ͯ͠Δͷ͸ InnoDBͷΈ • MyISAMͳͲଞͷετϨʔδΤϯδϯΛ࢖͍͍ͨ৔߹͸RDS • ͨͩ͠RDSͰ΋ਪ঑͸InnoDB

  35. ΠϯελϯελΠϓ͕ҟͳΔ  U NJDSP TNBMM NFEJVN MBSHF YMBSHF YMBSHF U

    NJDSP TNBMM NFEJVN MBSHF YMBSHF YMBSHF N NFEJVN MBSHF YMBSHF YMBSHF N MBSHF YMBSHF YMBSHF YMBSHF YMBSHF YMBSHF N MBSHF YMBSHF YMBSHF YMBSHF YMBSHF YMBSHF S MBSHF YMBSHF YMBSHF YMBSHF YMBSHF S MBSHF YMBSHF YMBSHF YMBSHF YMBSHF YMBSHF S MBSHF YMBSHF YMBSHF YMBSHF YMBSHF YMBSHF RDS for MySQL(5.6)
  36. ΠϯελϯελΠϓ͕ҟͳΔ  U NJDSP TNBMM NFEJVN MBSHF YMBSHF YMBSHF U

    NJDSP TNBMM NFEJVN MBSHF YMBSHF YMBSHF N NFEJVN MBSHF YMBSHF YMBSHF N MBSHF YMBSHF YMBSHF YMBSHF YMBSHF YMBSHF N MBSHF YMBSHF YMBSHF YMBSHF YMBSHF YMBSHF S MBSHF YMBSHF YMBSHF YMBSHF YMBSHF S MBSHF YMBSHF YMBSHF YMBSHF YMBSHF YMBSHF S MBSHF YMBSHF YMBSHF YMBSHF YMBSHF YMBSHF Aurora MySQL (5.6)
  37. "VSPSBΛ࢖͑ͳ͍έʔεʢ࠶ܝʣ  • DBΤϯδϯ͕ҟͳΔ • όʔδϣϯ͕ҟͳΔ • ετϨʔδΤϯδϯ͕ҟͳΔʢMySQLͷ৔߹ʣ • ΠϯελϯελΠϓ͕ҟͳΔ

  38. 

  39.  ʢ͋·Γͳ͍(^_^;)ʣ

  40. ʢ"VSPSBΑΓ΋ʣ3%4Λ࢖͏΂͖έʔε  • DBΤϯδϯͷ৽ػೳΛ͍ͪૣ͘࢖͍͍ͨ • ద༻͞Εͳ͍ύϥϝʔλʔ͕ॏཁ • ͍҆ͨ͘͠

  41. %#Τϯδϯͷ৽ػೳΛ͍ͪૣ͘࢖͍͍ͨ  • RDSͷํ͕࠷৽ͷDBΤϯδϯόʔδϣϯରԠ͕ૣ͍ • ྫ1: PostgreSQL 10ରԠ • RDS:

    2018/02/27 (10.1)
 2018/07/25 (10.4) • Aurora: 2018/09/25 (10.4 ޓ׵) • ྫ2: MySQL 5.7ରԠ • RDS: 2016/02/22 • Aurora: 2018/02/06
 w IUUQTEPDTBNB[POBXTDOFO@VT"NB[PO3%4MBUFTU"VSPSB6TFS(VJEF8IBUT/FXIUNM w IUUQTEPDTBXTBNB[PODPNKB@KQ"NB[PO3%4MBUFTU6TFS(VJEF8IBUT/FXIUNM
  42. ద༻͞Εͳ͍ύϥϝʔλʔ͕ॏཁ  AuroraͰ͸Ұ෦ͷMySQL/PostgreSQLͷύϥϝʔλʔ͕ແޮ w IUUQTEPDTBXTBNB[PODPNKB@KQ"NB[PO3%4MBUFTU"VSPSB6TFS(VJEF "VSPSB.Z42-3FGFSFODFIUNM"VSPSB.Z42-3FGFSFODF1BSBNFUFST*OBQQMJDBCMF w IUUQTEPDTBXTBNB[PODPNKB@KQ"NB[PO3%4MBUFTU"VSPSB6TFS(VJEF "VSPSB1PTUHSF42-3FGFSFODFIUNM"VSPSB1PTUHSF42-3FGFSFODF1BSBNFUFS(SPVQT

  43. ద༻͞Εͳ͍ύϥϝʔλʔ͕ॏཁ  AuroraͰ͸Ұ෦ͷMySQL/PostgreSQLͷύϥϝʔλʔ͕ແޮ • ྫ: MySQL innodb_change_buffering • σʔλߋ৽࣌ͷσΟεΫ΁ͷॻ͖ࠐΈΛ஗ΒͤΔػೳ
 มߋΛҰ࣌తʹϝϞϦʹΩϟογϡͯ͠ɺॻ͖ࠐΈॲཧΛߴ଎Խ

    ➡ ηΧϯμϦΠϯσοΫεΛେྔʹߋ৽͢ΔΑ͏ͳॲཧͷ৔߹ɺσΟεΫ্ ͷ༷ʑͳՕॴʹରͯ͠ॻ͖ࠐΈ͕ൃੜ͢Δˠ஗͍
  44. ͍҆ͨ͘͠՝ۚܗଶͷҧ͍  w IUUQTBXTBNB[PODPNKQSETNZTRMQSJDJOH w IUUQTBXTBNB[PODPNKQSETBVSPSBQSJDJOH RDS Aurora DBΠϯελϯε ࣌ؒैྔ՝ۚ

    ετϨʔδ ࣌ؒैྔ՝ۚ DBΠϯελϯε ࣌ؒैྔ՝ۚ ετϨʔδ ࣌ؒैྔ՝ۚ I/O ϦΫΤετ਺ैྔ՝ۚ ʴ ʴ ʴ > 100 ສ݅ͷϦΫΤετ͋ͨΓ
 0.24USD (@౦ژϦʔδϣϯ)
  45. ͍҆ͨ͘͠%#Πϯελϯεैྔ՝ۚ  w IUUQTBXTBNB[PODPNKQSETNZTRMQSJDJOH w IUUQTBXTBNB[PODPNKQSETBVSPSBQSJDJOH RDS(USD/h) Aurora(USD/h) Ձ֨ࠩ r5.large

    0.285 0.35 122.81% r5.xlarge 0.57 0.7 122.81% r5.2xlarge 1.14 1.4 122.81% r5.4xlarge 2.28 2.8 122.81% r5.12xlarge 6.84 8.4 122.81% ౦ژϦʔδϣϯɾMySQLɾγϯάϧAZɾr5ΠϯελϯελΠϓͰൺֱ
  46. ͍҆ͨ͘͠  ඞͣRDSͷํ͕҆͘ͳΔɺ
 ͱ͸ݴ͑ͳ͍

  47. ͍҆ͨ͘͠"VSPSBͷํ͕҆͘ͳΔ෦෼  Multi-AZʹ͠ͳͯ͘ྑ͍͔΋ • DBΠϯελϯε͕1AZͰ΋ɺετϨʔ δ͸3AZܭ6Օॴʹίϐʔ ➡ ͭ·Γ଱ٱੑ͸͋Δ • DBΠϯελϯε΋௨ৗ10෼ະຬͰճ෮

    ➡ ͜ͷμ΢ϯλΠϜΛڐ༰Ͱ͖ ΔͳΒAurora Single-AZ=1Π ϯελϯεͰ΋ྑ͍ͷͰ͸
  48. ͍҆ͨ͘͠"VSPSBͷํ͕҆͘ͳΔ෦෼  Aurora͸StandbyϨϓϦΧෆཁ • ϦʔυϨϓϦΧΛϓϥΠϚϦʹࣗಈঢ֨Մೳ • RDS͸Ͱ͖ͳ͍ʢStandbyΛϦʔυϨϓϦΧͱͯ͠࢖͑ͳ͍) ➡ Multi-AZ͔ͭϦʔυϨϓϦΧߏ੒ͷ৔߹ɺ
 DBΠϯελϯεΛҰ୆ݮΒͤΔ

  49. ͍҆ͨ͘͠"VSPSBͷํ͕҆͘ͳΔ෦෼  ϨϓϦΧ෼ͷετϨʔδྉ͔͔ۚΒͳ͍ • RDS͸Πϯελϯε͝ͱʹετϨʔδΛ࣋ͭ • Aurora͸ετϨʔδΫϥελΛΠϯελϯε ؒͰڞ༗ ➡ ϨϓϦΧΠϯελϯεΛ૿΍ͨ͠

    ࡍʹ௥ՃͰ՝ۚ͞ΕΔͷ͸ɺΠϯ ελϯε࣌ؒैྔ՝ۚͷΈ
  50. ͍҆ͨ͘͠"VSPSBͷํ͕҆͘ͳΔ෦෼  ϦʔυϨϓϦΧͷ୆਺ݮΒ͢orεϖοΫԼ͛ΒΕΔ͔΋ • RDS͸Πϯελϯε͝ͱʹε τϨʔδΛ࣋ͭ ➡ ॻ͖ࠐΈΫΤϦΛ֤Πϯ ελϯεͰ࣮ߦ͢Δඞཁ ͕͋Δ

  51. ͍҆ͨ͘͠"VSPSBͷํ͕҆͘ͳΔ෦෼  ϦʔυϨϓϦΧͷ୆਺ݮΒ͢orεϖοΫԼ͛ΒΕΔ͔΋ • Aurora͸ετϨʔδΫϥελΛΠϯελϯ εؒͰڞ༗ ➡ RR͸ॻ͖ࠐΈॲཧෆཁ
 ˠಡΈࠐΈॲཧ͚ͩʹઐ೦Ͱ͖ Δ


    →RDSͷ৔߹ͱಉ͡୆਺orε ϖοΫͷRRཁΒͳ͍͔΋ • Auto Scaling΋Ͱ͖·͢ʂ
  52. ͍҆ͨ͘͠"VSPSBͷํ͕҆͘ͳΔ෦෼  τʔλϧίετͰߟ͑Δ • Auroraʹ͸࡞ۀෛՙΛԼ͛ΒΕΔ෦෼͕ͨ͘͞Μ͋Δ • ΫΤϦνϡʔχϯά͠ͳͯ͘΋଎౓͕ग़Δʢग़΍͍͢ʣ • ϨϓϦΧ͙͢૿΍ͤΔɺAutoScalingͰ͖Δ •

    ॠ࣌ʹಛఆͷ࣌఺΁ר͖໭͢(Backtrack) • ͳͲͳͲ ➡ AWSར༻අ͸্͕ͬͯ΋ɺਓతίετΛ཈͑ΒΕΔͷͰ͸
  53. ʢ"VSPSBΑΓ΋ʣ3%4Λ࢖͏΂͖έʔε ࠶ܝ  • DBΤϯδϯͷ৽ػೳΛ͍ͪૣ͘࢖͍͍ͨ • ద༻͞Εͳ͍ύϥϝʔλʔ͕ॏཁ • ͍҆ͨ͘͠ •

    I/O Ͱ΋՝ۚ • Πϯελϯεྉ͕ۚߴ͍ • Auroraͷํ͕҆͘ͳΔ෦෼ • Multi-AZෆཁͳέʔε • StandByϨϓϦΧෆཁ • ϨϓϦΧ෼ͷετϨʔδྉ͔͔ۚΒͳ͍ • ϨϓϦΧͷ୆਺ݮΒ͢orεϖοΫԼ͛ΒΕΔ͔΋ • τʔλϧίετͰߟ͑Δ
  54. ·ͱΊ  • AuroraͱRDSͷҧ͍Λཧղͯ͠ɺ
 ద੾ʹ࢖͍෼͚Δ͜ͱ͕Ͱ͖ΔΑ͏ʹ • ΞʔΩςΫνϟͷҧ͍ • Auroraʹ͔͠ͳ͍ػೳ •

    Aurora࢖͑ͳ͍৔߹ • RDS࢖͏΂͖৔߹ • Aurora͍͢͝ɻΈΜͳ΋·ͣAuroraࢼͦ͏ͥ • ͕͢͝͞఻Θͬͯͳ͔ͬͨΒࢲͷ੹೚Ͱ͢
  55.  ͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠