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
Developer Productivity in Cookpad
Search
Issei Naruta
June 03, 2015
Technology
174
42k
Developer Productivity in Cookpad
クックパッドはなぜ開発しやすいのか
At AWS Summit Tokyo 2015 Developer Conference
2015/06/03
Issei Naruta
June 03, 2015
Tweet
Share
More Decks by Issei Naruta
See All by Issei Naruta
Cookpad TechConf 2022 Keynote
mirakui
0
3.4k
ドライイーストを使わずにパンを焼けるか? 〜天然酵母のパン作りを支える技術〜
mirakui
0
3.2k
関東積みについて/How to build Kanto-stacking
mirakui
0
600
先折りGTRについて/How to build left-GTR transitions
mirakui
3
1k
サービス開発速度に着目したソフトウェアアーキテクチャ/Software architecture for effective service development at Cookpad
mirakui
5
6.9k
Beyond the Boundaries
mirakui
1
1.2k
Cookpad Under a Microscope
mirakui
6
8.5k
Technical Successes and Failures in the History of Cookpad Development
mirakui
45
37k
How We Gain "Mobile First" Using WebP with ImageMagick
mirakui
10
13k
Other Decks in Technology
See All in Technology
アジャイルチームがらしさを発揮するための目標づくり / Making the goal and enabling the team
kakehashi
3
110
ISUCONに強くなるかもしれない日々の過ごしかた/Findy ISUCON 2024-11-14
fujiwara3
8
870
Lambda10周年!Lambdaは何をもたらしたか
smt7174
2
110
Introduction to Works of ML Engineer in LY Corporation
lycorp_recruit_jp
0
140
TanStack Routerに移行するのかい しないのかい、どっちなんだい! / Are you going to migrate to TanStack Router or not? Which one is it?
kaminashi
0
600
強いチームと開発生産性
onk
PRO
35
11k
OCI 運用監視サービス 概要
oracle4engineer
PRO
0
4.8k
生成AIが変えるデータ分析の全体像
ishikawa_satoru
0
170
Shopifyアプリ開発における Shopifyの機能活用
sonatard
4
250
いざ、BSC討伐の旅
nikinusu
2
780
オープンソースAIとは何か? --「オープンソースAIの定義 v1.0」詳細解説
shujisado
9
1.1k
データプロダクトの定義からはじめる、データコントラクト駆動なデータ基盤
chanyou0311
2
330
Featured
See All Featured
Optimising Largest Contentful Paint
csswizardry
33
2.9k
Imperfection Machines: The Place of Print at Facebook
scottboms
265
13k
BBQ
matthewcrist
85
9.3k
Practical Orchestrator
shlominoach
186
10k
Agile that works and the tools we love
rasmusluckow
327
21k
Building Better People: How to give real-time feedback that sticks.
wjessup
364
19k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Speed Design
sergeychernyshev
25
620
Testing 201, or: Great Expectations
jmmastey
38
7.1k
Visualization
eitanlees
145
15k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Thoughts on Productivity
jonyablonski
67
4.3k
Transcript
ΫοΫύουͳͥ ։ൃ͍͢͠ͷ͔ ΫοΫύουגࣜձࣾాҰੜ "844VNNJU5PLZP
ాҰੜ ͳΔͨ ͍͍ͬͤ !NJSBLVJ ΫοΫύουגࣜձࣾ ΠϯϑϥετϥΫνϟʔ෦
ΫοΫύουʹ͍ͭͯ
.6#NP .14VTFST .DPPLJOHSFDJQFT ˞݄ݱࡏ !" # !
'VMM"84 20113݄ ౦ژϦʔδϣϯΦʔϓϯ 20118݄ DC͔ΒAWSҠߦ ✈
&$JOTUBODFT BUQFBL SFRTFD BUQFBL $
0QT %FWFMPQFST %FQMPZTEBZ ⚒ #
IUUQTTQFBLFSEFDLDPNB@NBUTVEBUIFSFDJQFGPSUIFXPSMETMBSHFTUSBJMTNPOPMJUI ΫοΫύουੈքҰڊେͳ ϞϊϦγοΫ3BJMTΞϓϦέʔγϣϯʢ͔͠Ε·ͤΜʣ
None
ʮ։ൃ͍͢͠ʯͱԿ͔
% ʮ։ൃ͠ʹ͍͘ʯঢ়ଶͷྫ ٕज़తͳʹΑͬͯΠϊϕʔγϣϯ્͕͞Ε͍ͯΔঢ়ଶ େྔͷϨΨγʔίʔυɺٕज़తෛ࠴ ςετ͋Δ͚Ͳৗʹ͍͔ͭ͘ Fail ͍ͯͯ͠ɺ ์ஔ͞Ε͍ͯΔ σϓϩΠ͕ଐਓతͰɺ͕͔͔࣌ؒΓ͗ͨ͢Γɺ ͨ·ʹࣦഊͨ͠Γ͢Δ
։ൃ͠ʹͯ͘͘Կ͕ѱ͍ʁ ݱָ͕Λ͍ͨ͠ ૉૣ͘ՁΛఏڙ͍ͨ͠
⚒ ։ൃ σϓϩΠ ςετ
։ൃ ⚒
None
None
αʔϏε։ൃͱԿͳͷ͔ ࡞͍ͬͯΔͷʮػೳʯͰͳ͘ʮαʔϏεʯʮϢʔβମݧʯ μϛʔσʔλͰͳ͘ຊ൪ͷσʔλΛͬͯ։ൃ͢Δ͖ &
ຊ൪ͱಉظͨ͠%#Ͱ։ൃ͢ΔϝϦοτ • Ϣʔβʔͱಉͷମݧ • ༧ظͤ͵σʔλʹΑΔόάʹؾ͖͍ͮ͢ • ॏ͍ΫΤϦʹؾ͖͍ͮ͢
'# ຊ൪%# ։ൃ%# ։ൃऀ .Z42- .Z42- NZTRMEVNQ ( # ։ൃऀͷ୭͔͕ؾ͕͍ͨ࣌ʹ
ຊ൪μϯϓσʔλ͔Β։ൃ DB Λߋ৽ ʢʹ1͘Β͍ʣ d
खಈߋ৽ํࣜͷ ݱߦͷσʔλͷΈͰൃੜ͢ΔΑ͏ͳΤϥʔʹؾ͖ͮʹ͍͘ ৽ணίϯςϯπʹؔ࿈ͨ͠ಈ࡞֬ೝ͕͠ʹ͍͘ ϢʔβͷମݧͱҟͳΔ
' ' ' # # # ຊ൪%# ։ൃ%# NBTUFS TMBWF
SFBE X SJUF ։ൃऀ .Z42- .Z42- ݱࡏ ։ൃऀৗʹຊ൪ͷ࠷৽σʔλ͕ೖͬͨDBͰ։ൃ
Ͳ͏Δͷ͔ ݒ೦ slave ʹॻ͖ࠐΜͩΒΩʔিಥͰ ϨϓϦέʔγϣϯΤϥʔʹͳΔͷͰʁ id ͕ຊ൪ͱͣΕͯ݁ہ͑ͳ͍σʔλʹͳΔͷͰʁ
JE OBNF ΧϨʔ ͔Β͋͛ ͡Ό͕ JE OBNF
ΧϨʔ ͔Β͋͛ ͡Ό͕ ͦ '# ຊ൪%# ։ൃ%# */4&35 ϨϓϦέʔγϣϯ ϥʔϝϯ ௨ৗɺslave ʹॻ͖ࠐΜͰ͠·͏ͱ AUTO_INCREMENT ͍ͯ͠Δ id ͕িಥ͢Δ
JE OBNF ΧϨʔ ͔Β͋͛ ͡Ό͕ JE OBNF
ΧϨʔ ͔Β͋͛ ͡Ό͕ ͦ ͏ͲΜ ੜᇙম͖ '# ຊ൪%# ։ൃ%# */4&35 ϨϓϦέʔγϣϯ AUTO_INCREMENT ʹڊେͳΦϑηοτΛઃఆ͢Δ͜ͱͰ ຊ൪ͱিಥ͠ʹ͘͘͢Δ ϥʔϝϯ
JE OBNF ΧϨʔ ͔Β͋͛ ͡Ό͕ JE OBNF
ΧϨʔ ͔Β͋͛ ͡Ό͕ ͦ ͏ͲΜ ੜᇙম͖ ຊ൪%# ։ൃ%# εςʔτϝϯτϕʔε ϨϓϦέʔγϣϯ ࠷৽ͷ݅Λʮমʯʹมߋ UPDATE recipes SET name=‘ম’ ORDER BY id DESC LIMIT 1 ম ম εςʔτϝϯτϕʔεϨϓϦέʔγϣϯͰ ։ൃ DB ͷσʔλ͕յΕ͍͢
JE OBNF ΧϨʔ ͔Β͋͛ ͡Ό͕ JE OBNF
ΧϨʔ ͔Β͋͛ ͡Ό͕ ͦ ͏ͲΜ ੜᇙম͖ ຊ൪%# ։ൃ%# ߦϕʔε ϨϓϦέʔγϣϯ ࠷৽ͷ݅Λʮমʯʹมߋ UPDATE recipes SET name=‘ম’ ORDER BY id DESC LIMIT 1 ম ম ߦϕʔεϨϓϦέʔγϣϯʹ͢Δ͜ͱͰ ։ൃ DB ͷσʔλ͕յΕʹ͘ͳΔ
ຊ൪%# ։ൃ%# ߦϕʔε ϨϓϦέʔγϣϯ εςʔτϝϯτϕʔε ϨϓϦέʔγϣϯ CJOMPH ม༻%# ߦϕʔεϨϓϦέʔγϣϯͰɺ όΠφϦϩάసૹྔ͕ڊେʹͳΓɺຊ൪ʹෛՙ͕͔͔ΔͨΊ
࣮ࡍʹதؒ DB Λ༻ҙ͠όΠφϦϩάΛม͍ͯ͠Δ
ϨϓϦέʔγϣϯఀࢭରࡦඞཁ ෆ߹ى͖ʹ͘͘Ͱ͖Δ͕ɺܾͯ͠ᘳͰͳ͍ͷͰ ϨϓϦ͕ΤϥʔͰࢭ·Δ͜ͱ͋Δ slave_skip_errors = ON Λઃఆͭͭ͠ɺ ఀࢭͨ͠Β skip ͯ͠࠶։͢ΔࢹεΫϦϓτΛӡ༻
ʢslave_skip_errors͚ͩͰ skip ͞Εͳ͍Τϥʔ͕͋ΔͨΊ…ʣ
' ' ' # # # ຊ൪%# ։ൃ%# NBTUFS TMBWF
SFBE X SJUF ։ൃऀ .Z42- .Z42- ։ൃऀৗʹຊ൪ͷ࠷৽σʔλ͕ೖͬͨDBͰ։ൃ
ຊ൪ڥͰ։ൃ͢Δ w
&BUZPVSPXOEPHGPPE ࣗͨͪͷαʔϏε͕ࣗͨͪϢʔβʹͳΔ͖ ♥
ඇϩάΠϯ ελοϑϢʔβ ͱͯ͠ϩάΠϯ ελοϑ͕ϩάΠϯ͢Δͱɺ ։ൃதͷϕʔλػೳ͕͍ͭ͘༗ޮʹͳΔ
ϕʔλػೳ ϦϦʔεൣғΛࢦఆͯ͠ެ։ ެ։ൣғͷྫ ελοϑͷΈʹެ։ ςετࢀՃϢʔβʹͷΈެ։ શମͷ10%ͷϢʔβʹެ։
αʔϏεͷՁΘͳ͍ͱ͔Βͳ͍ ͦͷՁͷԾઆਖ਼͔ͬͨ͠ͷ͔ʁ ຊ൪ʹϦϦʔε͠ͳ͍ͱɺϢʔβʹͬͯΒ͏͜ͱ͕Ͱ͖ͳ͍ ຊ൪ʹϦϦʔε͢Δʹຊ൪ͷ࣭ͷ ίʔυʢύϑΥʔϚϯεʣʹ্͛ͳ͚ΕͳΒͳ͍ʁ ˠඞཁͷͳ͍ػೳΛ࡞Γ͜ΜͰ͠·͏Մೳੑ͕͋Δ
ૣࣦ͘ഊΛ͢Δ ίʔυͷ࡞ΓࠐΈʹ࣌ؒΛ͔͚ΔΑΓɺ ૉૣ͘ެ։ͯ͠ԾઆΛݕূ͢ΔͨΊʹ࣌ؒΛ͏͖ *
$IBOLP ຊ൪ڥͰͷτϥΠˍΤϥʔΛࢧԉ͢Δ Rails ༻ gem Unit ͱ͍͏୯ҐͰطଘίʔυͷύονΛهड़ ࣭ͷ͍ίʔυΛຊ൪ʹ҆શʹग़ͤΔ IUUQTHJUIVCDPNDPPLQBEDIBOLP +
" # طଘͷίʔυ A ΛɺελοϑϢʔβͷΈʹରͯ͠ ϕʔλ൛ͷίʔυ B ʹஔ͖͍͑ͨ ͨͩ͠ɺB ݥతͳ࣮ͳͷͰɺྫ֎͕ൃੜ͢Δ͔͠Εͳ͍
طଘͷ$POUSPMMFSͷίʔυ ϕʔλ൛ͷίʔυ
ελοϑͳΒ# #Ͱྫ֎͕ى͖ͨΒ" ελοϑҎ֎ͳΒ" ϑϥάͰذ͍ͤͯ͘͞ͱίʔυ͕ԚΕ͍ͯ͘
ϕʔλػೳͷ6OJU طଘͷ$POUSPMMFSͷίʔυ " # Chanko ͰɺUnit ͱ͍͏ϑΝΠϧʹϕʔλػೳͷϩδοΫΛهड़͢Δ invoke ݅Λຬͨͨ͠߹ʹɺطଘϩδοΫ (A)
ͷΘΓʹ Unit (B) ͕࣮ߦ͞ΕΔ B ͕ྫ֎Λىͨ͜͠߹ɺݩͷ A ͕࣮ߦ͞ΕΔͨΊɺϢʔβʹΤϥʔ͕ฦΒͳ͍ JOWPLF݅
ແࣄʹՁ͕ೝΊΒΕͨΒ ຊ൪ͷ࣭ͷίʔυʹ্͛Δ طଘίʔυΛॻ͖͑ɺUnit ϑΝΠϧΛফ͢ ʢ௨শ Un-chankoʣ
$IBOLPͷӡ༻ঢ়گ 2011: Chanko ϦϦʔε + ಋೖ 2015: 200+ Chanko Units
• εςʔδϯά༻ͷαʔόଘࡏ͢Δ͕ɺར༻ස͍ • ։ൃதͷͷΛຊ൪ʹग़͢จԽ͕Ͱ͖͍ͯΔ
ςετ
ΫοΫύουͱ34QFD 1800+ files 21000+ examples (test cases) 7 min ,
5FTUTNFMMT ࣮ߦ͕͍࣌ؒ յΕ͍͢ʢίʔυͷมߋʹऑ͍ʣ Fail ͍͢͠ ࣮ߦڥͷґଘ -
3334QFD
. 3334QFD ͯ͘ɾ҆ͯ͘ɾ҆ఆͨ͠$* ෳͷ Spot Instance Λͬͯ RSpec Λฒྻ࣮ߦ ڧྗͳϑΥʔϧττϨϥϯε
IUUQTHJUIVCDPNDPPLQBESSSTQFD +
// / / TMBWF TMBWF XPSLFS XPSLFS XPSLFS ʜ /
ʜ ʜ ʜ / / / / NBTUFS ////ʜ
$*XPSLFSͷભҠ ۀ࣌ؒ֎ΛݮΒͯ͠ ίετݮ
&$4QPU*OTUBODF ͳΔ͘ϋΠεϖοΫͳΠϯελϯεΛ͍͍͕ͨߴՁ →Spot Instance ͷར༻ 0
&$4QPU*OTUBODF ʮ1࣌ؒ͋ͨΓͷ࠷େೖࡳՁ֨ʯΛࢦఆͯ͠ىಈ͢Δ ࢦఆͨ͠ʮ࠷େೖࡳՁ֨ʯΑΓ૬Ձ͕͚֨҆Εىಈ ىಈதʹ૬Ձ͕֨ʮ࠷େೖࡳՁ֨ʯΛ্ճͬͨ߹ɺ Πϯελϯεγϟοτμϯ͞ΕΔ ૬Ձ֨ OnDemand Ձ֨ΑΓߴ͘ͳΔ͜ͱ͋Δ ૬Ձ֨ AZ
͝ͱʹΑͬͯҟͳΔ
౦ژϦʔδϣϯͷͱ͋Δ";ʹ͓͚Δ 4QPU1SJDF DYMBSHF 0OEFNBOE I 3*ZBMMVQGSPOU I
DYMBSHF DYMBSHF DYMBSHF ˺ ˺ DYMBSHF DYMBSHF DYMBSHF ˺ ˺
Ұ൪ίετύϑΥʔϚϯε͕͍͍ ΠϯελϯεΛࣗಈతʹબ
ϑΥʔϧττϨϥϯε ͍͔ʹͯ͠GBJM͠ʹ͍͘$*ʹ͢Δ͔ ·Εʹࣦഊ͢ΔFYBNQMFʹରͯ͠ɿ ۭ͍͍ͯΔ worker Ͱࣗಈతʹ࠶࣮ߦ ҰͰ success ͢Ε success
ͱͯ͠ѻ͏ 4QPU*OTUBODFͷࣗಈγϟοτμϯʹରͯ͠ɿ ଞͷ worker Ͱࣗಈతʹ࠶࣮ߦ ผλΠϓͷΠϯελϯεΛىಈ͠࠶࣮ߦ
ׂΕ૭ཧ ݐͷ૭ׂ͕Ε͍ͯΔ֗ɺ࣏͕҆ѱԽ͢Δ ܰඍͳ൜ࡑΛపఈతʹऔΓక·Δ͜ͱͰ ڟѱ൜ࡑΛࢭͰ͖Δͱ͢Δڥ൜ࡑ্ֶͷཧ IUUQKBXJLJQFEJBPSHXJLJׂΕ૭ཧ -
$*͕ʮׂΕ૭ʯʹͳΒͳ͍Α͏ʹ ܰඍͳ͏ͪʹൃݟ͠ɺରॲ͢Δ • Ϗϧυ͕࣌ؒ͘ͳΔ • ͚ͯ͜Δςετͷ์ஔ • pending ঢ়ଶͳςετͷ์ஔ 1
௨ Fail ͨ͠ example ࡞ऀΛ blame ͯ͠νϟοτͰ௨ Fail ͬ͠ͺͳ͠ʹͤ͞ͳ͍
·Εʹ'BJM͢ΔςετΛݟ͚ͭΔ lBMMOJHIU$*z ۀ࣌ؒ֎ʹͣͬͱճ͠ଓ͚Δ CI success ͕͍ͱԿ͔͕͓͔͍͠
ඪ Ҏ Ҏ্͔͔ͬͨΒ௨ $*ͷϏϧυ࣌ؒΛࢹ
QFOEJOHʹͤͬ͞ͺͳ͠ͷςετͷ࡞ऀʹࣗಈ௨ IUUQTHJUIVCDPNDPPLQBEQFOEBYFT +
$*ӡ༻ͷ·ͱΊ • ༏Εͨ CI γεςϜΛ࡞Δ͜ͱΑΓɺ Ͳ͏ӡ༻͢Δ͔͕ॏཁ • Ϗϧυ࣌ؒɾ௨աɾίετͳͲͷ ࢦඪΛఆٛͯ͠ࢹ͠ɺ վળ͍ͯ͘͠
• ׂΕ૭ʹ͠ͳ͍ 2
σϓϩΠ
+ TVDDFTT -(5. QVMMSFRVFTU NFOUJPO EFQMPZ &$ (JU)VC &OUFSQSJTF #
EFWFMPQFS # SFWJFXFS $* +FOLJOT NFSHF
σϓϩΠϧʔϧʢҰ෦ʣ • CI Λύεͨ͠ϦϏδϣϯͷΈσϓϩΠͯ͠Α͍ • σϓϩΠίʔυΛ push ͨ͠։ൃऀ͕ࣗߦ͏ • Ӧۀ࣌ؒͷΈσϓϩΠՄೳ
• σϓϩΠޙ։ൃऀ͕ಈ࡞֬ೝ͠ɺ ෆ۩߹Λݟ͚ͭͨΒ͙͢ʹϩʔϧόοΫ͢Δ
σϓϩΠʹॏཁͳ͜ͱ • ଐਓతͰͳ͍͜ͱ • ਖ਼֬Ͱ͋Δ͜ͱ • ϩʔϧόοΫͰ͖Δ͜ͱ • ेʹ͍͜ͱ 3
ۙिؒͷσϓϩΠʹ͔͔ͬͨ࣌ؒ ฏۉඵ IPTUT
$BQJTUSBOP࣌ʢʙʣ capistrano2 + rsync_with_remote_cache
$BQJTUSBOPσϓϩΠͱ 1͔Βશʹ ssh + rsync σϓϩΠରϗετ͕૿͑Δͱ͘ͳ͍ͬͯ͘
σϓϩΠରϗετશʹTTI STZOD ˠσϓϩΠͷϘτϧωοΫʹ $BQJTUSBOP # / / / / /
/ / STZOD
.BNJZB
.BNJZB ϋΠεέʔϥϒϧͳߴσϓϩΠγεςϜ σϓϩΠରϗετΛ serf ͰΫϥελϦϯά Amazon S3 ܦ༝Ͱ Capistrano ޓͷσΟϨΫτϦߏ
IUUQTHJUIVCDPNTPSBINBNJZB +
/ $* UBSCBMM 4 $*͕௨ͬͨϦϏδϣϯͷίʔυ UBSCBMMͱͯ͠4ʹૹΒΕΔ
/ / / / / / / / $*͕௨ͬͨϦϏδϣϯͷUBSCBMM શ͕ৗʹࣗಈͰQVMM͍ͯ͠Δ
ʢ͜ͷ࣌Ͱ·ͩຊ൪ͷίʔυΓସΘ͍ͬͯͳ͍ʣ /
σϓϩΠͷࢦྩ4FSGΠϕϯτͱͯ͠(PTTJQϓϩτίϧͰ # !IVCPUEFQMPZQSPEVDUJPO
શͷϦϏδϣϯ͕ΓସΘΔ ʢϑΝΠϧ͋Β͔͡Ί͍ྃͯ͠ΔͨΊɺߴʹྃ͢Δʣ / / / / / / / /
/ / / / / / / / #
.BNJZBͷεέʔϥϏϦςΟ Mamiya σϓϩΠରϗετ૿Ճʹରͯ͠εέʔϥϒϧ ϗετ͕૿Ճͯ͠ʢ΄ͱΜͲʣ͘ͳΒͳ͍ ϑΝΠϧͷɿ S3 ͷεέʔϥϏϦςΟΛར༻ શͷϦϏδϣϯΓସ͑ࢦྩɿ Serf ΠϕϯτΛར༻
.BNJZBʹΑΔσϓϩΠ࣌ؒॖޮՌ ˠඵ DBQJTUSBOP NBNJZB DBQJTUSBOP NBNJZB
͓ΘΓʹ
⚒ ։ൃ σϓϩΠ ςετ
։ൃͷ͢͠͞Λอͭ ׂΕ૭Λ࡞Βͳ͍ͨΊʹɺऀͱࢦඪ͕ඞཁ 4
ʮ։ൃ͢͠͞ʯͷՁ • ։ൃ͔ΒσϓϩΠ·ͰͷαΠΫϧ͕ेʹ͚Εɺ ʮຊ൪ڥΛͬͨ։ൃʯ͕࣮ݱͰ͖Δ →Ϣʔβͱಉ͡ମݧͷதͰ։ൃ͢Δ • ։ൃ͢͠͞ʹࢿ͢ΔՁेʹ͋Δ • ݁Ռͱͯ͠։ൃ৫αʔϏε݈શͳঢ়ଶΛอͯΔ 'JO