Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥

Web サービスの信頼性と運用の自動化について / iot40-rrreeeyyy

rrreeeyyy
March 08, 2018

Web サービスの信頼性と運用の自動化について / iot40-rrreeeyyy

第40回インターネットと運用技術研究発表会の招待講演で『Web サービスの信頼性と運用の自動化について』というタイトルで発表しました。

rrreeeyyy

March 08, 2018
Tweet

More Decks by rrreeeyyy

Other Decks in Technology

Transcript

  1. Web αʔϏεͷ৴པੑͱ ӡ༻ͷࣗಈԽʹ͍ͭͯ ΫοΫύουגࣜձࣾ ΠϯϑϥετϥΫνϟʔ෦ SRE άϧʔϓ ٢઒ ཽଠ (

    @rrreeeyyy ) ୈ 40 ճΠϯλʔωοτͱӡ༻ٕज़ݚڀൃදձ (2018/03/05) | Yoshikawa Ryota ( @rrreeeyyy ) 1
  2. Agenda • Site Reliability Engineering (SRE) ʹ͍ͭͯ • SRE ͱ͸

    • ӡ༻ͷݱ৔ͱӡ༻ٕज़ݚڀ • ӡ༻ͷࣗಈԽʹ͍ͭͯ • ࣌ܥྻσʔλͷॲཧͱҟৗݕ஌ʹ͍ͭͯ ୈ 40 ճΠϯλʔωοτͱӡ༻ٕज़ݚڀൃදձ (2018/03/05) | Yoshikawa Ryota ( @rrreeeyyy ) 2
  3. Me • Yoshikawa Ryota ( @rrreeeyyy [reɪ] ) • ిؾ௨৴େֶ

    (2010/04 ʙ 2014/03) • ৘ใཧ޻ֶ෦ ৘ใɾ௨৴޻ֶՊ • גࣜձࣾϋʔτϏʔπ (2010/11ʙ2016/12) • MSP ࣄۀ෦ ӡ༻ελοϑɾӡ༻ΤϯδχΞ • ΫοΫύουגࣜձࣾ (2017/01 ʙ) • ΠϯϑϥετϥΫνϟʔ෦ SRE άϧʔϓ ୈ 40 ճΠϯλʔωοτͱӡ༻ٕज़ݚڀൃදձ (2018/03/05) | Yoshikawa Ryota ( @rrreeeyyy ) 4
  4. Me • ిؾ௨৴େֶ (2010/04 ʙ 2014/03) • mruby Λ༻͍ͨLinux ϩʔυόϥϯαΠϯλϑΣʔεͷ࣮૷Ͱଔۀ

    • גࣜձࣾϋʔτϏʔπ (2010/11ʙ2016/12) • ਺୆ʙ਺ઍ୆ن໛ͷӡ༻ɾߏஙɾ؅ཧΛܦݧ • ϝσΟΞɾήʔϜɾEC ౳ͷ༷ʑͳ෼໺ͷӡ༻Λܦݧ • ΫοΫύουגࣜձࣾ (2017/01 ʙ) • ΠϯϑϥετϥΫνϟʔ෦ SRE άϧʔϓ • ਺ઍ୆ن໛ͷγεςϜͷ৴པੑʹؔΘΔ෦෼શͯΛ୲౰ ୈ 40 ճΠϯλʔωοτͱӡ༻ٕज़ݚڀൃදձ (2018/03/05) | Yoshikawa Ryota ( @rrreeeyyy ) 5
  5. Site Reliability Engineering ͱ͸ • αΠτͷ৴པੑͷશͯʹ੹೚ൣғΛ࣋ͭɺͱ͢ΔΤϯδχΞϦϯάख๏ • ಛʹɺιϑτ΢ΣΞɾγεςϜΤϯδχΞϦϯάΛ༻͍ͯ՝୊Λղܾ͢Δ • ྫ͑͹ɺύϑΥʔϚϯε

    • ύϑΥʔϚϯεʹ໰୊͕͋Δίʔυ͸ SRE ࣗ਎͕ίʔυΛॻ͍ͯमਖ਼͢Δ • ྫ͑͹ɺεέʔϥϏϦςΟɾΞϕΠϥϏϦςΟ • ਓؒʹΑΔखಈͷ࡞ۀΛίʔυʹΑΓࣗಈԽ͢Δ • ن໛΍ΞΫηε͕૿େͯ͠΋҆ఆͯ͠αʔϏεΛఏڙͰ͖Δঢ়ଶʹ͢Δ • ΠϯϑϥΤϯδχΞͷ੹೚ൣғ͕૿େͨ͠தͰ͋Δछɺ৬੹Λ࠶ఆٛͨ͠෺ͱଊ͍͑ͯΔ ୈ 40 ճΠϯλʔωοτͱӡ༻ٕज़ݚڀൃදձ (2018/03/05) | Yoshikawa Ryota ( @rrreeeyyy ) 7
  6. SRE ͷ׆ಈ SRE ͷ׆ಈ͸େ͖͘෼͚ͯ࣍ͷ 4 ͭʹ෼ྨͰ͖Δͱ͞Ε͍ͯΔ • So#ware Engineering •

    Systems Engineering • Toil • Overhead ୈ 40 ճΠϯλʔωοτͱӡ༻ٕज़ݚڀൃදձ (2018/03/05) | Yoshikawa Ryota ( @rrreeeyyy ) 8
  7. SRE ͷ׆ಈ • So#ware Engineering • ίʔυͷ࡞੒΍मਖ਼, ͦΕʹؔ࿈͢Δઃܭ΍υΩϡϝϯςʔγϣϯͷ࡞ۀͳͲ • ࣗಈԽεΫϦϓτͷ࡞੒,

    πʔϧ΍ϑϨʔϜϫʔΫͷ࡞੒ ... • αʔϏε΁ͷ৴པੑΛߴΊΔػೳͷ௥Ճ ... • Systems Engineering • 1 ճͷ࡞ۀͰӬଓతͳվળΛੜΉ࣍ͷΑ͏ͳ࡞ۀ • ຊ൪γεςϜͷઃఆมߋ ... • ։ൃνʔϜͷαʔϏεΞʔΩςΫνϟઃܭ ... ୈ 40 ճΠϯλʔωοτͱӡ༻ٕज़ݚڀൃදձ (2018/03/05) | Yoshikawa Ryota ( @rrreeeyyy ) 9
  8. SRE ͷ׆ಈ • Toil • αʔϏεΛՔಇͤ͞ΔͨΊ͚ͩʹ܁Γฦ͠ߦΘΕΔखಈͰͷ࡞ۀ • ௕ظతͳՁ஋Λ࣋ͨͳ͍, αʔϏεͷ੒௕ʹରͯ͠ O(n)

    Ͱ͋Δ ... • ͭ·Βͳ͍࢓ࣄͰ΋௕ظతͳՁ஋͕͋Ε͹ Toil Ͱ͸ͳ͍ • Overhead • αʔϏεΛՔಇͤ͞Δ͜ͱʹ௚݁͠ͳ͍؅ཧతͳ࡞ۀ • ࠾༻, ϛʔςΟϯά, ධՁ, τϨʔχϯά ... ୈ 40 ճΠϯλʔωοτͱӡ༻ٕज़ݚڀൃදձ (2018/03/05) | Yoshikawa Ryota ( @rrreeeyyy ) 10
  9. ӡ༻ͷݱ৔ͱӡ༻ٕज़ݚڀ • ΤϯδχΞϦϯάΛͪΌΜͱ΍Δࣄ͕ݱ৔ϨϕϧͰ΋ධՁ͞ΕΔΑ͏ʹ • ͜ͷจ຺ͷҰͭͱͯ͠ SRE ͷΑ͏ͳख๏ɾ৬छ͕ग़͖ͯͨͱ͍͏ཧղ • ࿦จΛॻ͍ͨΓಡΜͰཧղɾ࣮૷͢Δࣄ͕ධՁ͞ΕΔΑ͏ʹͳ͖ͬͯͨ •

    ࣮ࡍͷӡ༻ͷݱ৔Ͱ΋ಡΜͰཧղ͢Δࣄ͸ඞཁʹͳ͖ͬͯͨ • ٕज़બఆͷࢦඪͷҰͭͱͯ͠΍ϛυϧ΢ΣΞͷڍಈͷཧղͳͲ • ͍ΘΏΔݚڀ։ൃͷΑ͏ͳ෦໳Ͱͳͯ͘΋೔ৗతʹߦ͏Α͏ʹ • ଟ͘ͷٕज़اۀͰӡ༻ɾϛυϧ΢ΣΞ౳ͷ࿦จ͕ଟ͘ग़ͯ͘ΔΑ͏ʹ ୈ 40 ճΠϯλʔωοτͱӡ༻ٕज़ݚڀൃදձ (2018/03/05) | Yoshikawa Ryota ( @rrreeeyyy ) 11
  10. େखΫϥ΢υϕϯμ౳ͷ࿦จ • Google, Amazon, Facebook, Ne3lix... • ଞʹ΋େখؔΘΒ༷ͣʑͳاۀ͔Β࿦จ͕ग़͍ͯΔ • USENIX

    ͷΧϯϑΝϨϯε౳Ͱٕज़اۀ͕ੵۃతʹൃද • FAST, OSDI, Security ... • Ϋϥ΢υαʔϏεͷ಺෦࣮૷΍಺੡ϛυϧ΢ΣΞؔΘΒͣ • Ϋϥ΢υαʔϏεͷڍಈΛਖ਼͘͠ཧղ͢ΔͨΊʹ࿦จΛಡΉ • ৽͍͠ΞʔΩςΫνϟɾϛυϧ΢ΣΞͷબఆͷͨΊʹ࿦จΛಡΉ ୈ 40 ճΠϯλʔωοτͱӡ༻ٕज़ݚڀൃදձ (2018/03/05) | Yoshikawa Ryota ( @rrreeeyyy ) 12
  11. ࿦จͷ಺༰Λ࣮ӡ༻Ͱ࢖͑Δϛυϧ΢ΣΞ΁ • HashiCorp • Vagrant, Terraform ౳Λ࡞͍ͬͯΔϕϯνϟʔ • ࿦จͷ಺༰Λ࣮ӡ༻Ͱ࢖͍΍͍͢ܗʹམͱ͠ࠐΜͰ͍Δ •

    Serf, Consul, Vault ౳ • ͜ΕΒͷϛυϧ΢ΣΞΛਖ਼͘͠ཧղͯ͠ӡ༻͢ΔͨΊʹ࿦จΛಡΉ • ͳͥ Consul ͷϊʔυ͸࠷௿ 3 ୆ඞཁͳͷ͔ʁ ୈ 40 ճΠϯλʔωοτͱӡ༻ٕज़ݚڀൃදձ (2018/03/05) | Yoshikawa Ryota ( @rrreeeyyy ) 18
  12. ΫοΫύουʹ͓͚Δ SRE ͷ׆ಈ • SRE ͱͯ͠ͷ׆ಈΛΫοΫύου಺Ͱ΋༷ʑߦ͍ͬͯΔ • ΫοΫύουͷ SRE ͷ׆ಈΛ͍͔ͭ͘঺հ

    • ৽نαʔϏεʹର͢Δ SRE ͷಈ͖ • ϞχλϦϯάͷվળ • ϩʔυόϥϯγϯάͷվળ • ৽ଔݚम • ... ୈ 40 ճΠϯλʔωοτͱӡ༻ٕज़ݚڀൃදձ (2018/03/05) | Yoshikawa Ryota ( @rrreeeyyy ) 23
  13. ΫοΫύουʹ͓͚Δ SRE ͷ׆ಈ • SRE ͱͯ͠ͷ׆ಈΛΫοΫύου಺Ͱ΋༷ʑߦ͍ͬͯΔ • ΫοΫύουͷ SRE ͷ׆ಈΛ͍͔ͭ͘঺հ

    • ৽نαʔϏεʹର͢Δ SRE ͷಈ͖ • ϞχλϦϯάͷվળ • ϩʔυόϥϯγϯάͷվળ • ৽ଔݚम • ... ୈ 40 ճΠϯλʔωοτͱӡ༻ٕज़ݚڀൃදձ (2018/03/05) | Yoshikawa Ryota ( @rrreeeyyy ) 25
  14. ϞχλϦϯάͷվળ • େྔͷσʔλΛ౤ೖɾॲཧ͢ΔΑ͏ͳ࣌ܥྻσʔλϕʔεͷج൫͸੔͖ͬͯͨ • ΫοΫύουͰ͸ Prometheus Λ TSDB ͱͯ͠࠾༻ •

    Long-term storage ͱͯ͠͸ S3 ΛόοΫΤϯυͱͯ͠ݕ౼த • औಘͰ͖ΔϝτϦΫεͷղ૾౓ͷ޲্ɾछྨͷ૿ڧ • 15 ඵ୯ҐͷϝτϦΫεऔಘ͕ग़དྷΔΑ͏ʹͳ͍ͬͯΔ • ϚΠΫϩαʔϏεͷαʔϏεؒͷ࿈ܞͷ༷ࢠ΋ՄࢹԽΛݕ౼த ୈ 40 ճΠϯλʔωοτͱӡ༻ٕज़ݚڀൃදձ (2018/03/05) | Yoshikawa Ryota ( @rrreeeyyy ) 26
  15. ࣌ܥྻσʔλͷॲཧʹ͍ͭͯ • ͜Ε·Ͱ͸΄ͱΜͲ੩తͳᮢ஋ͰԿͱ͔͍ͯͨ͠ঢ়ଶ • ͜Ε͔Β͸࣌ܥྻσʔλʹ؆୯ͳ౷ܭతॲཧ͕ࢪͤΔΑ͏ʹ • ઢܗճؼ, ࢦ਺ฏ׈Խ, ҠಈฏۉͳͲ... •

    ࣄલʹى͖͏Δҟৗ͕෼͔͍ͬͯΔ࣌ʹ͸Α͘ಈ͘ • Πϯγσϯτ΍ো֐ͷ "ੵΈॏͶ" Ͱݕ஌Ͱ͖ΔΑ͏ʹ • ࣮ࡍʹ͸औΕΔϝτϦΫε͕૿͑ҟৗ࣌ʹͲ͏ͳΔ͔༧ଌࠔ೉ͳࣄ΋ ୈ 40 ճΠϯλʔωοτͱӡ༻ٕज़ݚڀൃදձ (2018/03/05) | Yoshikawa Ryota ( @rrreeeyyy ) 31
  16. ࣌ܥྻσʔλͱҟৗݕ஌ • ࣌ܥྻσʔλͷҟৗ(֎Ε஋)ݕ஌͸༷ʑͳख๏͕طʹݚڀ͞Ε͖͍ͯͯΔ • Gaussian Mixture Model, Isola5on forest ͳͲͳͲ...

    • ࣮ࡍͷӡ༻Ͱग़ݱ͢ΔϝτϦΫεͰ͸ඇઢܗͳཁૉ͕ଟ͘ग़ݱ͢Δ • ैདྷͷख๏͸ෳࡶͳඇઢܗม׵ͳͲͷදݱʹऑ͍͜ͱ͕͋ͬͨ • ࠷ۙͷख๏Ͱ͸ CNN Λ༻͍ͯҟৗݕ஌ߦ͏Α͏ͳख๏͕ొ৔ͨ͠ • ෳ਺ͷೖྗ͕͋ΔΑ͏ͳ૬ؔҟৗͰ΋ൺֱత؆୯ʹ༧ଌ͢Δࣄ͕Մೳ ୈ 40 ճΠϯλʔωοτͱӡ༻ٕज़ݚڀൃදձ (2018/03/05) | Yoshikawa Ryota ( @rrreeeyyy ) 34
  17. LSTM ʹΑΔ࣌ܥྻσʔλͷҟৗݕ஌ • LSTM Λ༻͍ͯਖ਼ৗͳ࣌ܥྻσʔλͷֶशΛߦ͏ • ߦֶͬͨशʹج͍ͯɺ࣍ͷσʔλͷ༧ଌΛߦ͏ • ࣮ࡍͷσʔλͱ༧ଌ஋Λൺֱ͢Δ͜ͱͰҟৗ౓Λଌఆ͢Δ •

    ֶश͢Δσʔλͷೖྗ૚ͱͯ͠ϝτϦΫεҎ֎ʹαʔόͷίϯςΩετΛೖΕΔ • ྫ͑͹σϓϩΠதɾόον࣮ߦதɾΦʔτεέʔϧத... • ͦͷ࣌ͷαʔόͷίϯςΩετΛؚΊͯ༧ଌ஋Λ࡞ΕΔ • ΑΓαʔόͷঢ়گΛՃຯͨ͠ҟৗ౓ΛଌΔ͜ͱ͕ग़དྷΔ ୈ 40 ճΠϯλʔωοτͱӡ༻ٕज़ݚڀൃදձ (2018/03/05) | Yoshikawa Ryota ( @rrreeeyyy ) 38
  18. ༧ଌର৅ʹͳΔ࣌ܥྻσʔλͷྫ timestamp,cpu,deploying,autoscaling,batching 2018-03-05 12:00:00,80,1,0,0 2018-03-05 12:00:15,81,1,0,0 2018-03-05 12:00:30,82,1,0,0 2018-03-05 12:00:45,82,1,1,0

    2018-03-05 12:01:00,75,1,1,0 2018-03-05 12:01:15,60,1,1,0 2018-03-05 12:01:30,55,1,1,0 2018-03-05 12:01:45,40,0,1,0 2018-03-05 12:02:00,35,0,0,0 • ࣮ࡍʹ͸ Prometheus ͷϥϕϧػೳΛ༻্͍ͯهͷίϯςΩετΛೖྗ ୈ 40 ճΠϯλʔωοτͱӡ༻ٕज़ݚڀൃදձ (2018/03/05) | Yoshikawa Ryota ( @rrreeeyyy ) 39
  19. Keras Λ༻͍࣮ͨ૷ɾ࣮ݧ • ϊΠζΛؚ·ͤͨਖ਼ݭ೾Λ LSTM Ͱֶशͤ͞Δ • ݩͱͳͬͨਖ਼ݭ೾ʹҟৗΛؚ·ͤΔ • ҟৗͷ͋Δ೾ܗͱֶशࡁΈͷϞσϧ͔Βੜ੒͞Εͨ೾ܗͷೋ৐ޡࠩΛऔΔ

    • ߋʹ࣮ࡍʹલϖʔδͷ࣌ܥྻσʔλΛֶशͯ͠༧ଌ஋Λग़ͯ͠ΈΔ • ࣮ࡍͷσʔλʹݶΓͳ͍ۙ͘ܗͷ toy-data ͱͯ͠ར༻ • CPU ࢖༻཰ʹؔͯ͠͸ 0-1 ͷൣғʹਖ਼نԽֶͯ͠शΛऩଋͤ͞Δ • ز͔ͭͷ CPU ࢖༻཰ɾσϓϩΠपظͷϞσϧΛֶशͤͯ͞༧ଌͤͯ͞ΈΔ ୈ 40 ճΠϯλʔωοτͱӡ༻ٕज़ݚڀൃදձ (2018/03/05) | Yoshikawa Ryota ( @rrreeeyyy ) 40
  20. ·ͱΊ • SRE ͱ͍͏ΤϯδχΞϦϯάख๏ʹ͍ͭͯ঺հ • ΠϯϑϥΤϯδχΞͷ৬੹͕޿͕͖ͬͯͨ • αΠτͷ৴པੑࣗମʹ৬੹Λ࣋ͭ͜ͱΛ໌֬ʹ͢Δ SRE ͕ొ৔

    • αΠτͷ৴པੑΛकΔͨΊʹ͸ "ਖ਼͘͠ΤϯδχΞϦϯάΛ͢Δ" ࣄ͕ॏཁ • ΫοΫύουͰͷ SRE ͷऔΓ૊Έͱͯ͠ϞχλϦϯάͷվળΛ঺հ • ࣌ܥྻσʔλΛର৅ʹอଘɾղੳ͕ߦ͑Δج൫͕੔͖ͬͯͨ • ࣍ͳΔεςʔδͱͯ࣌͠ܥྻσʔλͷҟৗݕ஌ʹ͍༷ͭͯʑͳख๏Λ໛ࡧத ୈ 40 ճΠϯλʔωοτͱӡ༻ٕज़ݚڀൃදձ (2018/03/05) | Yoshikawa Ryota ( @rrreeeyyy ) 45
  21. ࢀߟࢿྉ • h#ps:/ /landing.google.com/sre/book.html • h#ps:/ /www.allthingsdistributed.com/files/p1041-verbitski.pdf • h#p:/ /lamport.azurewebsites.net/tla/formal-methods-amazon.pdf

    • h#ps:/ /staAc.googleusercontent.com/media/research.google.com/en/ /archive/spanner-osdi2012.pdf • h#p:/ /techlife.cookpad.com/entry/Ameseries-database-001 • h#p:/ /www.vldb.org/pvldb/vol8/p1816-teller.pdf • h#ps:/ /qiita.com/rrreeeyyy/items/6bbd1f09c96e2af4a8ce • h#p:/ /ramcloud.stanford.edu/raH.pdf • h#p:/ /www.cs.cornell.edu/~asdas/research/dsn02-swim.pdf • h#ps:/ /speakerdeck.com/rrreeeyyy/jK-2017-site-reliability-engineering • h#ps:/ /speakerdeck.com/yuukit/the-study-of-Ame-series-database-for-server-monitoring • h#ps:/ /speakerdeck.com/rrreeeyyy/introducAon-to-prometheus-pracAce • h#ps:/ /github.com/NeKlix/vizceral • h#ps:/ /github.com/nghialv/promviz ୈ 40 ճΠϯλʔωοτͱӡ༻ٕज़ݚڀൃදձ (2018/03/05) | Yoshikawa Ryota ( @rrreeeyyy ) 46