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
isucon5 予選をどう惨敗したか / isucon5 qualifier
Search
Yuichi Takada
October 06, 2015
Technology
1
870
isucon5 予選をどう惨敗したか / isucon5 qualifier
2015/10/06(火) 19:00
ISUCON5予選報告会 in GCPUG Tokyo
http://eventdots.jp/event/569858
Yuichi Takada
October 06, 2015
Tweet
Share
More Decks by Yuichi Takada
See All by Yuichi Takada
取引ドメインでの取り組み / mercari transaction domain
takady
0
85
楽してデータ分析したい / data engineering with oss
takady
0
400
Other Decks in Technology
See All in Technology
Amazon Kendra GenAI Index 登場でどう変わる? 評価から学ぶ最適なRAG構成
naoki_0531
0
100
レンジャーシステムズ | 会社紹介(採用ピッチ)
rssytems
0
150
大幅アップデートされたRagas v0.2をキャッチアップ
os1ma
2
520
Storage Browser for Amazon S3
miu_crescent
1
140
株式会社ログラス − エンジニア向け会社説明資料 / Loglass Comapany Deck for Engineer
loglass2019
3
31k
どちらを使う?GitHub or Azure DevOps Ver. 24H2
kkamegawa
0
700
ブラックフライデーで購入したPixel9で、Gemini Nanoを動かしてみた
marchin1989
1
520
AWS re:Invent 2024で発表された コードを書く開発者向け機能について
maruto
0
190
re:Invent 2024 Innovation Talks(NET201)で語られた大切なこと
shotashiratori
0
300
20241214_WACATE2024冬_テスト設計技法をチョット俯瞰してみよう
kzsuzuki
3
440
[Ruby] Develop a Morse Code Learning Gem & Beep from Strings
oguressive
1
150
ハイテク休憩
sat
PRO
2
140
Featured
See All Featured
Six Lessons from altMBA
skipperchong
27
3.5k
Music & Morning Musume
bryan
46
6.2k
Embracing the Ebb and Flow
colly
84
4.5k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
Speed Design
sergeychernyshev
25
670
Fashionably flexible responsive web design (full day workshop)
malarkey
405
66k
Fireside Chat
paigeccino
34
3.1k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
Making Projects Easy
brettharned
116
5.9k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
2
170
Mobile First: as difficult as doing things right
swwweet
222
9k
Transcript
isucon5 ༧બΛͲ͏ࢂഊ͔ͨ͠ takady https://flic.kr/p/5mHpwt
ࣗݾհ • ߴా༞Ұ • Sansan גࣜձࣾ (2015/05~) • αʔόαΠυΤϯδχΞ (ruby)
• twitter: takady7 • github: takady https://flic.kr/p/5mHpwt
isucon 5 ༧બʂ https://flic.kr/p/5mHpwt
νʔϜϝϯόʔ https://flic.kr/p/5mHpwt • @tatsuyaoiw • @muratayusuke
ͷே https://flic.kr/p/x1Zg9g
https://flic.kr/p/x1Zg9g
ϙʔλϧαΠτʹϩάΠϯ https://flic.kr/p/x1Zg9g
https://flic.kr/p/x1Zg9g
ʮNode.js ͷ࣮ͳ͘ͳΓ·ͨ͠ɻʯ https://flic.kr/p/x1Zg9g
https://flic.kr/p/x1Zg9g
(ν ruby ͳͷͰηʔϑ) https://flic.kr/p/x1Zg9g
։͕࢝1࣌ؒΕͨ͜ͱͰ • ू·͔ͬͯΒ1࣌ؒͷ༨༟Λ࣋ͯͨ • ࠷ॳͷ࡞ۀɺ୭͕ԿΔ͔Λ֬ೝͨ͠ • git init • dstat
• kataribe • slow-query • stackprof https://flic.kr/p/x1Zg9g
11:00 ༧બ։࢝ https://flic.kr/p/kwpHnK
https://flic.kr/p/kwpHnK
/etc/my.cnf ͕ಡΈࠐΊͳ͍ • slow-query log ͕ઃఆͰ͖ͳ͍ • /etc/mysql/conf.d/my.cnf Λ࡞ͯ͠ઃఆͨ͠ https://flic.kr/p/kwpHnK
/etc/my.cnf ͕ಡΈࠐΊͳ͍ • ݪҼ AppArmor Ͱͨ͠ https://flic.kr/p/kwpHnK
࠷ॳͷϕϯνϚʔΫΛճͯ͠ • ॳظείΞ: 200 • slow query ݟͯ index Λషͬͨ
• nginx - unicorn ͷ unix ιέοτଓ • nginx Ͱͷ੩తίϯςϯπͷ৴ • unicorn ͷ worker 1 -> 8 ʹ૿ͨ͠ https://flic.kr/p/kwpHnK
200 -> 2000 (4Ґ) https://flic.kr/p/kwpHnK
redis Խ https://flic.kr/p/edctkJ
mysql ͔Β redis • footprints (͋ͱ) ςʔϒϧͷσʔλ • key
= “#{ΧϨϯτϢʔβ}:#{๚Ϣʔβ}” • value = ๚࣌ؒ https://flic.kr/p/edctkJ
2000 -> 7000 (3Ґ) https://flic.kr/p/edctkJ
ܾউߦ͚Δʁʂ https://flic.kr/p/edctkJ
ࡉ͔͍मਖ਼ͰΛՔ͙ https://flic.kr/p/7Guxgu
ࡉ͔͍मਖ਼ͰΛՔ͙ • entries_of_friends ͷΫΤϦΛ मਖ਼ • ͦͷଞΖΖ https://flic.kr/p/7Guxgu
7000 -> 10000 (10Ґ͘Β͍) https://flic.kr/p/7Guxgu
࠶ىಈςετ https://flic.kr/p/7Guxgu
Πϯελϯεͷ࠶ىಈ • ࠶ىಈͯ͠ਖ਼͘͠ΞϓϦέʔγϣϯ͕ىಈͯ͠ɺ ϕϯνϚʔΫΛࡹ͚Δ͜ͱΛ֬ೝ͢ΔͨΊ • web app systemd Ͱىಈ
https://flic.kr/p/7Guxgu
10000 -> 8700 (ݍ֎) https://flic.kr/p/7Guxgu
ͳͥείΞ͕Լ͕ͬͨͷ͔ • ͓ͦΒ͘Ωϟογϡ͕ΫϦΞ͞Εͨ͜ͱͰɺ ͬͯͨσʔλ͕Ϧηοτ͞Εͨ • ΩϟογϡΛԹΊΔͨΊͷεΫϦϓτΛΊ Α͔͔ͬͨ͠Εͳ͍ https://flic.kr/p/7Guxgu
ࡉ͔͍मਖ਼ͰΛՔ͙ ʢएׯർΕ͖ͯͯͨʣ https://flic.kr/p/7Guxgu
ࡉ͔͍मਖ਼ͰΛՔ͙ • app - mysql ͷ unix ιέοτଓ • session
store Λ Redis ʹม͑Δ https://flic.kr/p/7Guxgu
8700 -> 9700 (ݍ֎) https://flic.kr/p/7Guxgu
ٯసΛૂ͏ https://flic.kr/p/bhXKeg
Γ1࣌ؒ • 10ҐҎʹೖͬͯͳ͔ͬͨ • εΩʔϚมߋʹखΛग़ͯ͠ͳ͔ͬͨ • join Λͳͨ͘͢Ίͷඇਖ਼نԽ • comments
ςʔϒϧʹ entry_user_id ΛՃ • Γ30ҐͰ࣮ྃͯ͠ϕϯνϚʔΫΛ·Θͨ͠ https://flic.kr/p/bhXKeg
9700 -> 250 https://flic.kr/p/bhXKeg
খֶੜΈ͍ͨͳείΞʹ https://flic.kr/p/bhXKeg
ͳͥείΞ͕Լ͕ͬͨͷ͔ • ϕϯνϚʔΧʔ fail ͯ͠ͳ͔ͬͨ • Ճͨ͠ΧϥϜʹॳظσʔλΛೖΕͯ͋͛Δ ඞཁ͕͋ͬͨ • Γ࣌ؒ͋ͱ10͘Β͍ͩͬͨͷͰ
revert https://flic.kr/p/bhXKeg
·ͱΊ • ָ͔ͬͨ͠ʂ • ΧʔωϧɺωοτϫʔΫɺDB ษڧʹͳͬͨ • GCE ॳΊ͚ͯͩͬͨͲɺ͍͔ͬͨ͢ •
ෳਓ͕ಉ͡αʔόͰίʔυमਖ਼͢Δͷμϝ • དྷ͋Ε ·ͨνϟϨϯδ͍ͨ͠ https://flic.kr/p/5mHpwt