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
78
楽してデータ分析したい / data engineering with oss
takady
0
400
Other Decks in Technology
See All in Technology
マルチモーダルRAGやってみた
tanimon
0
100
AWS CDKでデータリストアの運用、どのように設計する?~Aurora・EFSの実践事例を紹介~/aws-cdk-data-restore-aurora-efs
mhrtech
4
710
AWS CodePipelineでコンテナアプリをデプロイした際に、古いイメージを自動で削除する
smt7174
1
130
コンテンツを支える 若手ゲームクリエイターの アートディレクションの事例紹介 / cagamefi-game
cyberagentdevelopers
PRO
1
140
独自ツール開発でスタジオ撮影をDX!「VLS(Virtual LED Studio)」 / dx-studio-vls
cyberagentdevelopers
PRO
1
200
Forget efficiency – Become more productive without the stress
ufried
0
170
Product Engineer Night #6プロダクトエンジニアを育む仕組み・施策
hacomono
PRO
1
500
ガチ勢によるPipeCD運用大全〜滑らかなCI/CDを添えて〜 / ai-pipecd-encyclopedia
cyberagentdevelopers
PRO
3
230
小規模に始めるデータメッシュとデータガバナンスの実践
kimujun
4
630
【若手エンジニア応援LT会】AWS Security Hubの活用に苦労した話
kazushi_ohata
0
240
AWS reInvent 2024 関西組 事前勉強会
shinyayamada
0
120
プロダクトチームへのSystem Risk Records導入・運用事例の紹介/Introduction and Case Studies on Implementing and Operating System Risk Records for Product Teams
taddy_919
1
210
Featured
See All Featured
Building Your Own Lightsaber
phodgson
102
6.1k
The Power of CSS Pseudo Elements
geoffreycrofte
72
5.3k
Six Lessons from altMBA
skipperchong
26
3.5k
Fontdeck: Realign not Redesign
paulrobertlloyd
81
5.2k
Building Adaptive Systems
keathley
38
2.2k
Designing the Hi-DPI Web
ddemaree
280
34k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
Docker and Python
trallard
40
3.1k
Navigating Team Friction
lara
183
14k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
504
140k
Agile that works and the tools we love
rasmusluckow
327
21k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
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