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
データパイプラインをなんとかした話 / Improving the Data Pipeline in IVRy
mirakui
1
350
Cookpad TechConf 2022 Keynote
mirakui
0
3.4k
ドライイーストを使わずにパンを焼けるか? 〜天然酵母のパン作りを支える技術〜
mirakui
0
3.2k
関東積みについて/How to build Kanto-stacking
mirakui
0
620
先折り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.3k
Cookpad Under a Microscope
mirakui
6
8.5k
Technical Successes and Failures in the History of Cookpad Development
mirakui
45
37k
Other Decks in Technology
See All in Technology
小学3年生夏休みの自由研究「夏休みに Copilot で遊んでみた」
taichinakamura
0
140
ガバメントクラウドのセキュリティ対策事例について
fujisawaryohei
0
520
生成AIをより賢く エンジニアのための RAG入門 - Oracle AI Jam Session #20
kutsushitaneko
4
210
Snowflake女子会#3 Snowpipeの良さを5分で語るよ
lana2548
0
220
AIのコンプラは何故しんどい?
shujisado
1
190
Amazon Kendra GenAI Index 登場でどう変わる? 評価から学ぶ最適なRAG構成
naoki_0531
0
100
20241214_WACATE2024冬_テスト設計技法をチョット俯瞰してみよう
kzsuzuki
3
440
ブラックフライデーで購入したPixel9で、Gemini Nanoを動かしてみた
marchin1989
1
510
開発生産性向上! 育成を「改善」と捉えるエンジニア育成戦略
shoota
1
230
10分で学ぶKubernetesコンテナセキュリティ/10min-k8s-container-sec
mochizuki875
3
320
5分でわかるDuckDB
chanyou0311
10
3.2k
re:Invent をおうちで楽しんでみた ~CloudWatch のオブザーバビリティ機能がスゴい!/ Enjoyed AWS re:Invent from Home and CloudWatch Observability Feature is Amazing!
yuj1osm
0
120
Featured
See All Featured
A better future with KSS
kneath
238
17k
Building an army of robots
kneath
302
44k
Building Better People: How to give real-time feedback that sticks.
wjessup
365
19k
Visualization
eitanlees
146
15k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
810
Making Projects Easy
brettharned
116
5.9k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
A Tale of Four Properties
chriscoyier
157
23k
Making the Leap to Tech Lead
cromwellryan
133
9k
Designing for humans not robots
tammielis
250
25k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.5k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
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