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
82
楽してデータ分析したい / data engineering with oss
takady
0
400
Other Decks in Technology
See All in Technology
[CV勉強会@関東 ECCV2024 読み会] オンラインマッピング x トラッキング MapTracker: Tracking with Strided Memory Fusion for Consistent Vector HD Mapping (Chen+, ECCV24)
abemii
0
220
Lexical Analysis
shigashiyama
1
150
Why does continuous profiling matter to developers? #appdevelopercon
salaboy
0
190
AWS Media Services 最新サービスアップデート 2024
eijikominami
0
200
Terraform CI/CD パイプラインにおける AWS CodeCommit の代替手段
hiyanger
1
240
Taming you application's environments
salaboy
0
190
Making your applications cross-environment - OSCG 2024 NA
salaboy
0
190
AGIについてChatGPTに聞いてみた
blueb
0
130
SREによる隣接領域への越境とその先の信頼性
shonansurvivors
2
520
B2B SaaSから見た最近のC#/.NETの進化
sansantech
PRO
0
770
いざ、BSC討伐の旅
nikinusu
2
780
透過型SMTPプロキシによる送信メールの可観測性向上: Update Edition / Improved observability of outgoing emails with transparent smtp proxy: Update edition
linyows
2
210
Featured
See All Featured
Why Our Code Smells
bkeepers
PRO
334
57k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
Thoughts on Productivity
jonyablonski
67
4.3k
Building an army of robots
kneath
302
43k
A better future with KSS
kneath
238
17k
Docker and Python
trallard
40
3.1k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
410
Visualization
eitanlees
145
15k
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