Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
APIへのアクセスが急増して慌てた話 / We Should Know our Applica...
Search
Takeshi Nakamoto
July 04, 2018
Programming
0
730
APIへのアクセスが急増して慌てた話 / We Should Know our Application Performance
Takeshi Nakamoto
July 04, 2018
Tweet
Share
More Decks by Takeshi Nakamoto
See All by Takeshi Nakamoto
JJUG-2018-Fall-MF2
tksh_n6o
0
540
Other Decks in Programming
See All in Programming
Nurturing OpenJDK distribution: Eclipse Temurin Success History and plan
ivargrimstad
0
1.2k
@nifty天気予報のフロントエンドを 実装するまで - NIFTY Tech Talk #22
niftycorp
PRO
0
100
Flutterを言い訳にしない!アプリの使い心地改善テクニック5選🔥
kno3a87
3
260
Ethereum_.pdf
nekomatu
0
480
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
1
110
エンジニアとして関わる要件と仕様(公開用)
murabayashi
0
320
ActiveSupport::Notifications supporting instrumentation of Rails apps with OpenTelemetry
ymtdzzz
1
260
Enabling DevOps and Team Topologies Through Architecture: Architecting for Fast Flow
cer
PRO
0
370
[Do iOS '24] Ship your app on a Friday...and enjoy your weekend!
polpielladev
0
120
CSC509 Lecture 13
javiergs
PRO
0
110
Vapor Revolution
kazupon
2
1.5k
DevTools extensions で 独自の DevTool を開発する | FlutterKaigi 2024
kokiyoshida
0
160
Featured
See All Featured
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
44
2.2k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.3k
Automating Front-end Workflow
addyosmani
1366
200k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
0
150
Building Your Own Lightsaber
phodgson
103
6.1k
Art, The Web, and Tiny UX
lynnandtonic
297
20k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
RailsConf 2023
tenderlove
29
910
Transcript
APIͷΞΫηε͕ٸ૿ͯ͠߄ͯͨ 2018/06/29 Minami Aoyama Night#6 தຊ ࢤ 1
ࣗݾհ தຊࢤʢͳ͔ͱ͚ͨ͠ʣ גࣜձࣾϚωʔϑΥϫʔυʢʙʣ αʔόʔαΠυΤϯδχΞʢ+BWBʣ ੩Ԭݝॣ౦܊ઘொࡏॅ 2
ઘொ ɾࡾౡӺʙాொӺ࣌ؒ ͩ͜·ͷΈ ɾࢠҭͯࢧԉΛܝ͍͛ͯΔ ग़ੜ͕੩Ԭݝτοϓ ɾڈʮ͞Θ͔ʯ͕Ͱ͖·ͨ͠ 3
ຊͷ༰ ˔ ϚωʔϑΥϫʔυͱΞάϦήʔγϣϯγεςϜͷհ ˔ ಥવͷෛՙ૿ͰγεςϜ͕ࢭ·Γ͔͚ͨ࣌ʹͨ͜͠ͱ ˔ ࢭ·Βͳ͍Α͏ʹ͢ΔͨΊʹͨ͜͠ͱ ˔ ·ͱΊ 4
ຊͷ༰ ˔ ϚωʔϑΥϫʔυͱΞάϦήʔγϣϯγεςϜͷհ ˔ ಥવͷෛՙ૿ͰγεςϜ͕ࢭ·Γ͔͚ͨ࣌ʹͨ͜͠ͱ ˔ ࢭ·Βͳ͍Α͏ʹ͢ΔͨΊʹͨ͜͠ͱ ˔ ·ͱΊ 5
ϚωʔϑΥϫʔυʹ͍ͭͯ ʮ͓ۚΛલɻਓੜΛͬͱલɻʯͱ͍͏ϛογϣϯʹͱ͖ͮɺ ݸਓ๏ਓɺͯ͢ͷਓͷ͓ۚͷ՝Λղܾ͢ΔαʔϏεΛఏڙ͍ͯ͠·͢ɻ 6
ΞΧϯτΞάϦήʔγϣϯͱ ిࢠϚωʔ EC ূ݊ ۜߦ ɾߴɺೖग़ۚ໌ࡉ 0000-0000-0000-0000 0000-0000-0000-0000 ΫϨδοτΧʔυ ɾ໌ࡉɺར༻ߴ
ɾҾམɾֹ ɾϙδγϣϯ ɾߪೖཤྺ ɾར༻ཤྺ Ϗδωε ɾച্ใ 7
ΞάϦήʔγϣϯγεςϜͷߏ ΞάϦ%# ΞάϦ ϓϩμΫτ܈ ֤ۚ༥ػؔ : σʔλͷྲྀΕ … BEFORE 8
ΞάϦήʔγϣϯγεςϜͷߏ ΞάϦ%# ΞάϦ ϓϩμΫτ܈ ֤ۚ༥ػؔ : σʔλͷྲྀΕ … BEFORE ͍Ζ͍ΖπϥΠʜ
9
ΞάϦήʔγϣϯγεςϜͷߏ ΞάϦ%# ΞάϦ ϓϩμΫτ܈ ֤ۚ༥ػؔ : σʔλͷྲྀΕ AFTER ΞάϦ API
"1*ܦ༝ʹ౷Ұ … 10
ΞάϦήʔγϣϯγεςϜͷߏ ΞάϦ%# ΞάϦ ϓϩμΫτ܈ ֤ۚ༥ػؔ : σʔλͷྲྀΕ AFTER ΞάϦ API
… ࠓճίίͷ 11
ຊͷ༰ ˔ ϚωʔϑΥϫʔυͱΞάϦήʔγϣϯγεςϜͷհ ˔ ಥવͷෛՙ૿ͰγεςϜ͕ࢭ·Γ͔͚ͨ࣌ʹͨ͜͠ͱ ˔ ࢭ·Βͳ͍Α͏ʹ͢ΔͨΊʹͨ͜͠ͱ ˔ ·ͱΊ 12
ಥવͷ503 ˔ ಥαʔϏε͔ΒΞϥʔτ͕͘ΔʢΤϥʔϖʔδΛฦ͢ʣ ˓ ͜ͷ࣌ͰΞάϦ"1*ͷύϑΥʔϚϯε͕ྼԽ͍ͯ͠Δೝࣝͳ͠ ˔ ଞͷ։ൃऀ͕ௐࠪͯ͠ɺΞάϦ"1*͕Ϋοι͍ͱ࿈བྷ͕͋Δ ˓ ͜ͷ࣌ͰॳΊͯμογϡϘʔυΛ֬ೝ ˔
ݟͨ͜ͱͷͳ͍άϥϑΛ֬ೝ ˓ ୈҰใ͔Β΄Ͳܦա -PBE"WFSBHF 13
ॳಈͷল ˔ ϦϦʔε࡞ۀͳͲΛ͍ͯ͠ͳ͍ͷͰͳ͍ͱࢥ͍͜ΜͰ͍ͨ ˓ ͔ͤͬ͘༻ҙ͍ͯ͠ΔμογϡϘʔυ͢Βݟͯͳ͔ͬͨ 14
ௐࠪ & ϦϦʔε ˔ /FX3FMJD%BUB%PHΛݟͯ%#ίωΫγϣϯपΓͰ٧·ͬͯͦ͏ ˓ %#ෛՙΛ্͛ͳ͍Α͏ߜͬͯಈ͔͍ͯͨ͠ ˔ ͍ͬͨΜϓʔϧΛ૿͢ϦϦʔεΛߦ͏ ˔
ϦϦʔε͕ྃ͠ɺ"1*͕ਖ਼ৗʹϨεϙϯεΛฦ͢Α͏ʹͳΔ ˓ ͨͩɺϦϦʔεͷӨڹͱ͍͏ΑΓɺෛՙͷϐʔΫΛա͗ͨ͜ͱ͕େ͖͔ͬͨ ˔ ୈҰใ͔Β࣌ؒ΄ͲͰฏৗ௨Γͷঢ়ଶʹͳͬͨ 15
ෆதͷ͍ ˔ "1.ʢ/FX3FMJDʣΛ͍ͬͯͨͷͰͱΓ͋͑ͣͷରԠ͕Ͱ͖ͨ ˔ ϝτϦΫεϞχλϦϯάʢ%BUB%PHʣ͍ͯͨ͠ͷͰ ޙ͔ΒͲΜͳঢ়ଶͩͬͨͷ͔Λ؍͢Δ͜ͱ͕Ͱ͖ͨ ˔ Ϩεϙϯε͘ͳ͕ͬͨɺશʹఀࢭ͠ͳ͔ͬͨ 16
ෛՙ૿ͷݪҼ ˔ .'͕৽͘͠࿈ܞΛ։࢝ͨ͠αʔϏε͔Βͷྲྀೖ૿ ˓ ࿈ܞઌͷϢʔβʔ͚ʹΩϟϯϖʔϯ͕ߦΘΕ͍ͯͨ ˓ ࣄલͷڞ༗͕ͪΌΜͱͰ͖ͯͳ͔ͬͨ ˔ ௨ৗ࣌ͷഒ΄ͲͷϦΫΤετ૿ ˓
ϐʔΫ࣌ͷഒ 17
ຊͷ༰ ˔ ϚωʔϑΥϫʔυͱΞάϦήʔγϣϯγεςϜͷհ ˔ ಥવͷෛՙ૿ͰγεςϜ͕ࢭ·Γ͔͚ͨ࣌ʹͨ͜͠ͱ ˔ ࢭ·Βͳ͍Α͏ʹ͢ΔͨΊʹͨ͜͠ͱ ˔ ·ͱΊ 18
·ͣௐࠪɺͷલʹ ˔ ࣮͜ͷલʹߴෛՙʹͳΓαʔϏε͕ෆ҆ఆʹͳ͍ͬͯͨ ˔ ϦΫΤετ૿ՃʹΑΓɺ%#͕͘ͳΓɺͭΒΕͯ"1*͘ͳͬͨ ˔ εϩʔΫΤϦվળ ˔ ࢭΊͯྑ͍ॲཧΛࢭΊΔ ˔
"1*αʔόʔ૿͞ͳ͍ͱ -PBE"WFSBHF 19
DataDogͷμογϡϘʔυ 20
·ͣௐࠪ ˔ /FX3FMJD%BUB%PHΞϓϦέʔγϣϯϩάΛ֬ೝ ˓ %#ͷෛՙͦΜͳͰͳ͍ ˓ "1*αʔόʔͷ$16ෛՙ͕ߴ͔ͬͨ ˓ ίωΫγϣϯϓʔϧ͔ΒίωΫγϣϯΛऔಘ͢Δ͕ͪ࣌ؒଟ͔ͬͨ ˔
αʔόʔͷੑೳ͕͋·Γߴ͘ͳ͔ͬͨͷͰॲཧ͖͠Εͳ͔ͬͨͱ݁ ˓ εέʔϧΞοϓͱಉ࣌ʹɺ૿͢ 21
ࠓޙͲ͏͢Δ͔ ˔ ΩϟϯϖʔϯͳͲ͕͋Δͱ͖͋Β͔͡Ί࿈བྷͯ͠Β͏ ˔ ͕ͩɺࣄલʹڞ༗ͯ͠ΒͬͨϦΫΤετ૿ʹ͑ΒΕΔͷ͔ʁʁ ˔ ͦ͏ͩɺෛՙςετ͠Α͏ 22
ෛՙςετ ˔ϦΫΤετϩάΛ࠶ੜͯ͠ͷαʔόʔʹෛՙΛ͔͚Δ ˔ෛՙΛ͔͚ΔαʔόʔͷΛ૿ͯ͠ϦΫΤετ૿Λ࠶ݱ͢Δ ˔͖͍͠Λ୳͢ ˓ͲΕ͘Β͍ͷϦΫΤετͳΒීஈͲ͓ΓॲཧͰ͖Δͷ͔ ˓ෛՙ͕૿͑ͨͱ͖ʹͲͷϦιʔε͕࠷ॳʹݶքʹͳΔͷ͔ ˔ςετछྨߦͬͨ ˓%#ίωΫγϣϯͷͱ͖ʹͲΕ͚ͩॲཧͰ͖Δ͔ ˓%#ίωΫγϣϯͷͱ͖ʹͲΕ͚ͩॲཧͰ͖Δ͔ 23
ෛՙςετ GitHub - tsenart/vegeta: HTTP load testing tool and library
˔ બΜͩཧ༝ ˓ ϦΫΤετϩάΛ࠶ੜͰ͖Δʢ؆୯ʂʣ ˓ ͙͑͢ΔʢόΠφϦஔ͚ͩ͘ʂʣ ˓ $-*Ͱૢ࡞Ͱ͖ΔʢεΫϦϓτͰ੍ޚͰ͖Δʂʣ 24
ෛՙςετ ˔ ؒʹຊ൪αʔόʔͰςετ ˓ ࣮ࡍͷαʔόʔͰੑೳΛݟ͔ͨͬͨ ˔ ෛՙΛͩΜͩΜ૿͍ͯ͘͠ • ݁Ռ%BUB%PHͰޙ͔Β֬ೝ ˓
͍͢͝ศརͩͬͨ vegeta API vegeta vegeta … 25
ෛՙςετ 100 0 CPUར༻ 26
ෛՙςετ • ҆ఆͯ͠ॲཧͰ͖ΔϦΫΤετͷ্ݶΛΔͨΊͷςετ ◦ ஈ֊తʹෛՙΛ૿͢ ◦ Ϩεϙϯε͕ѱԽͨ͠Βऴྃ 100 0 CPUར༻
27
ෛՙςετ • DBίωΫγϣϯ1ͭͰ҆ఆͯ͠ॲཧͰ͖ΔϦΫΤετͷ্ݶΛΔͨΊͷςετ ◦ ஈ֊తʹෛՙΛ૿͢ ◦ Ϩεϙϯε͕ѱԽͨ͠Βऴྃ 100 0 CPUར༻
28
ෛՙςετͷͦͷޙ ˔ ίωΫγϣϯͰॲཧͰ͖ΔϦΫΤετ͕ग़ͨ ˔ ίωΫγϣϯͭ͋ͨΓͰॲཧͰ͖ΔϦΫΤετ͕ग़ͨ ˓ ίωΫγϣϯͷϦΫΤετΛॲཧͰ͖͍ͯͳ͍ ˔ %#·ͩ༨༟͕͋Γͦ͏ ˓
ͬͺΓ$16͕ϘτϧωοΫͬΆ͍ ˓ αʔόʔͷεέʔϧΞοϓ ˓ ແବͳίʔυ͕ͳ͍͔ௐࠪ 29
ͦͷޙͰͬͨ͜ͱ ˔ ෛՙςετͰܾΊ͖͍ͨ͠ʹԠͨ͡Ξϥʔτ ˔ ίʔυͷݟ͠ ˓ ϨεϙϯελΠϜ͕ʹ ˔ %#ͷ ˔
ෛՙςετճ ˓ தʹΦϯϥΠϯͰ࣮ࢪ ˓ εϧʔϓοτഒʹͳͬͯͨ ˔ ল ˓ ٸʹϦΫΤετ͕૿͑ͨܦݧ͕ॳΊͯͩͬͨ 30
ຊͷ༰ ˔ ϚωʔϑΥϫʔυͱΞάϦήʔγϣϯγεςϜͷհ ˔ ಥવͷෛՙ૿ͰγεςϜ͕ࢭ·Γ͔͚ͨ࣌ʹͨ͜͠ͱ ˔ ࢭ·Βͳ͍Α͏ʹ͢ΔͨΊʹͨ͜͠ͱ ˔ ·ͱΊ 31
·ͱΊ ˔ ΞϓϦέʔγϣϯͷੑೳΛ۩ମతͳͰѲ͢Δ ˓ ҆ఆՔಇ͢ΔͷͲͷ͘Β͍͔ ˓ ҆ఆՔಇ͠ͳ͘ͳΔϘτϧωοΫԿͳͷ͔ ˔ αʔϏεଆͷΠϕϯτΛѲ͓ͯ͘͠ʢίϛϡχέʔγϣϯʣ ˓
όοΫΤϯυಛʹ ˔ γεςϜঢ়ଶΛՄࢹԽ͓ͯ͘͠ͱେมศར 32
Thank you! 33