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
Cookpad の広告配信を支えるアーキテクチャ
Search
Ken Wagatsuma
October 03, 2018
Programming
1
610
Cookpad の広告配信を支えるアーキテクチャ
presented at
https://lob.connpass.com/event/100491/
Ken Wagatsuma
October 03, 2018
Tweet
Share
More Decks by Ken Wagatsuma
See All by Ken Wagatsuma
Pregel Graph Compute Engines - Supersteps Exampls
kenju
1
200
Kafka on Kubernetes with Strimzi
kenju
1
140
AWS DynamoDB Accelerator (DAX) 101
kenju
3
6.9k
Moden browser introduction
kenju
1
370
Cookpad summer internship 2019 - API
kenju
0
10k
Introduction to Design Patterns
kenju
0
69
GraphQL Asia 2019 "Re-architecture of a decade-old app with BFF/GraphQL"
kenju
0
8.8k
Introduction to TypeScript
kenju
0
690
Introduction to Programmatic Ad
kenju
0
230
Other Decks in Programming
See All in Programming
混沌とした例外処理とエラー監視に秩序をもたらす
morihirok
13
2.3k
PHPUnitしか使ってこなかった 一般PHPerがPestに乗り換えた実録
mashirou1234
0
420
DMMオンラインサロンアプリのSwift化
hayatan
0
190
毎日13時間もかかるバッチ処理をたった3日で60%短縮するためにやったこと
sho_ssk_
1
550
ISUCON14感想戦で85万点まで頑張ってみた
ponyo877
1
590
20241217 競争力強化とビジネス価値創出への挑戦:モノタロウのシステムモダナイズ、開発組織の進化と今後の展望
monotaro
PRO
0
290
PHPカンファレンス 2024|共創を加速するための若手の技術挑戦
weddingpark
0
140
ecspresso, ecschedule, lambroll を PipeCDプラグインとして動かしてみた (プロトタイプ) / Running ecspresso, ecschedule, and lambroll as PipeCD Plugins (prototype)
tkikuc
2
1.9k
テストコード書いてみませんか?
onopon
2
340
ある日突然あなたが管理しているサーバーにDDoSが来たらどうなるでしょう?知ってるようで何も知らなかったDDoS攻撃と対策 #phpcon.2024
akase244
2
7.7k
2025.01.17_Sansan × DMM.swift
riofujimon
2
560
KMP와 kotlinx.rpc로 서버와 클라이언트 동기화
kwakeuijin
0
300
Featured
See All Featured
Building Flexible Design Systems
yeseniaperezcruz
328
38k
Writing Fast Ruby
sferik
628
61k
Intergalactic Javascript Robots from Outer Space
tanoku
270
27k
Side Projects
sachag
452
42k
Rails Girls Zürich Keynote
gr2m
94
13k
How to train your dragon (web standard)
notwaldorf
89
5.8k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
For a Future-Friendly Web
brad_frost
176
9.5k
How to Ace a Technical Interview
jacobian
276
23k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
160
15k
Transcript
$PPLQBEͷࠂ৴Λ ࢧ͑ΔΞʔΩςΫνϟ $PPLQBE*OD զ࠺ݠथʢ,FOKV8BHBUTVNBʣ
8IP Kenju Wagatsuma - Serverside Engineer - Ruby, Go, AWS
- Recruit HD -> Bit Journey -> Cookpad - github.com/kenju - twitter.com/itiskj - itiskj.hatenablog.com
"SDIJUFDUVSF
4FSWJDFT • ad4 • admin site • ads • ads
delivery server • log architecture • Offline … fluentd/S3/Redshift • Realtime … Kinesis Streams/DynamoDB/Lambda
0WFSBMM"SDIJUFDUVSF BE BET CBUDI ! DBDIF .Z42- .Z42- 4%,
-PH"SDIJUFDUVSF
%PNBJO.PEFMT
0QFSBUJPO $BNQBJHO Ωϟϯϖʔϯɺ৴ͷ୯Ґ $BNQBJHO1FSJPE Ωϟϯϖʔϯͷ৴ظؒ #PPLJOH $BNQBJHOͱ1SPEVDUͷؔ࿈ςʔϒϧ 1SPEVDU ৴ରͷࠂ 1MBDFNFOU
ෳͷ1SPEVDUͷू߹ମ $SFBUJWF ΫϦΤΠςΟϒɺը૾λά $MJFOU डઌͷΫϥΠΞϯτ
0QFSBUJPO$BNQBJHO
0QFSBUJPO$SFBUJWFT
0QFSBUJPO $BNQBJHO 1FSJPE #PPLJOH 1MBDFNFOU $MJFOU $BNQBJHO 1SPEVDU 0SHBOJ[BUJPO $SFBUJWF
0SEFS
%FMJWFSZ %FMJWFSZ1MBO Ωϟϯϖʔϯ͝ͱͷྲྀྔΛهड़ͨ͠৴ܭը %FMJWFSZ1BZMPBE ৴͢Δ+40/1BZMPBET (PBM#VEHFUFE $1$࠷దԽܕ (PBM1FSDFOUBHF ৴ൺϕʔε (PBM*NQSFTTJPO
ඪ*NQSFTTJPOೖߘܕ (PBM$MJDL ඪ$MJDLೖߘܕ (PBM3FNOBOU ༨ࡏݿ৴ܕ
%FMJWFSZ%FMJWFSZ1MBO { "version": 1, "site_id": 3, "product_id": 537, "product_capacity": 1,
"campaigns": [ { "id": 18585, "goal_type": "percentage", "creatives": [ { "id": 60057, "formats": [ "category_hijack_spw_with_image" ], "targets": [ { "keywords": [ "͘Ζ·Ί", "ΫϩϚϝ" ] } ] } ], "rate_numerator": 10000, "rate_denominator": 10000 },
%FMJWFSZ%FMJWFSZ1BZMPBE [ { "key": "cookpad-android-search-master", "creatives": [ [ { "id":
111, "template": "image", "click_url": "https://...", "media": { "mime_type": "image/jpeg", "original": "https://example.com/d6663ab44a0c48a1996debc690893493.jpg?1510564210", "width": 300, "height": 250 } } ] ] }
5BSHFUJOH $SFBUJWF ʢ࠶ܝʣ $SFBUJWF5BSHFU λʔήςΟϯάϧʔϧΛද͢நϞσϧ "SFB3VMF ΤϦΞผλʔήςΟϯά "VEJFODF3VMF ηάϝϯτผλʔήςΟϯά ,FZXPSE3VMF
ݕࡧΩʔϫʔυผλʔήςΟϯά 3FDJQF3VMF ϨγϐผλʔήςΟϯά 4DIFEVMF3VMF ༵ɾ࣌ؒଳผλʔήςΟϯά
5BSHFUJOH $SFBUJWF $SFBUJWF 5BSHFU ,FZXPSE 3VMF 3FDJQF 3VMF 4DIFEVMF 3VMF
"SFB 3VMF "VEJFODF 3VMF
+BWB4DSJQU4%, EJTQMBZKT
EJTQMBZKT'FBUVSFT • Request to the ads delivery server • Parse
response & build creative tags • Header Bidding wrapper • Logging for viewable impressions
EJTQMBZKT-JCSBSJFT • webpack for building • babel for compile •
eslint for static analysis • eslint-plugin-compat (<- one of maintainers #) • karma / jasmine • pupetter as an emulator • istanbul for coverage
EJTQMBZKT3FRVFTU3FTQPOTF $ curl --globoff ‘https://example-ads.com/display?slots[pc-top-panel-main][capacity]=1' | jq . { "slots":
[ { "key": "pc-top-panel-main", "creatives": [ [ { "id": 62596, "template": "image", "media": { "mime_type": "image/jpeg", "original": "https://img5-ak.cpcdn.com/ad4/19584ec3bf844581a0cfd1917cd785d8.jpg?1535448767", "width": 300, "height": 600, "center_crop": false } } ]
3FTQPOTFKT EJTQMBZKTBSDIJUFDUVSF $SFBUJWFKT 4MPUKT 3FRVFTUKT 1BZMPBEKT )FBEFS#JEEJOH )FBEFS#JEEJOH 8SBQQFSKT -PHHJOH
-PHHFSKT -PH3FDPSEKT -PHHFS$MJFOUKT
EJTQMBZKT)FBEFS#JEEJOH
IUUQTUFDIMJGFDPPLQBEDPNFOUSZ .PSF%FUBJMT
WT-FHBDZ
ϨΨγʔΞʔΩςΫνϟ wϝϯόʔ͕େ͖͘มΘΓҾ͖ܧ͗ࠔ w ݱঢ়ͷίʔυͱHJUCMBNFHJUMPH w ࣾʹԿਓ͔࣌ͷϝϯόʔ͕͍Δ͜ͱ·ͩٹ͍ wزଟͷ7FSTJPOJOH w ೖߘϩδοΫɺ৴ϩδοΫɺλʔήςΟϯάϩδοΫɺ 4%,7FSTJPOͯ͢ಠཱͯ͠ੈଘࡏ͢Δ
wػೳ։ൃ༏ઌɺϦΞʔΩςΫνϟઐෆࡏ w ϧʔϧͰಓʹย͚͍ͯͬͨ
ϨΨγʔͱͷઓ͍ํ wlௐࠪతϦϑΝΫλϦϯάzʹΑΔʮཧղʯ w ʰϨΨγʔιϑτΣΞվળΨΠυʱ wςετʹΑΔʮ࣭ʯͷݟ͑ΔԽ w ʰ৫ʹςετΛॻ͘จԽΛ͔ࠜͤΔઓུͱઓज़ʱ CZ!U@XBEB͞Μ wϦϑΝΫλϦϯάͷʮٕज़ʯΛʹ͚ͭΔ w
ʢ࣍ܝʣ
ϦϑΝΫλϦϯάͷʮٕज़ʯͱ ۜͷؙͳ͍ɺಓͳٕज़ͷੵΈॏͶ w3FBEBCJMJUZ w ʰ5IF"SUPG3FBEBCMF$PEFʱ wσβΠϯύλʔϯ w ʰ(BNF1SPHSBNNJOH1BUUFSOTʱ wΦϒδΣΫτࢦઃܭ w
ʰΦϒδΣΫτࢦઃܭ࣮ફΨΠυʱ w FUD
ϦϑΝΫλϦϯάͷʮελϯεʯ wطଘͷίʔυϕʔεͷʮଚܟʯ w ࠓͷձࣾͷച্Λ࡞ͬͨڝ૪ྗͷݯઘ wʮ͋Δ͖࢟ʯ͔Βߟ͑Δ w அࡐྉʜࠓٻΊΒΕΔ༷ɺϝϯόʔͷٕज़ϨϕϧɺӨڹ ൣғͱϦεΫ wతͱखஈΛࠞಉ͠ͳ͍ w
αʔϏεͷΛՃͤ͞ɺ࣭ΛߴΊΔͨΊ w ಈతݴޠܕ੩తղੳ$*ʜશͯखஈ
ਖ਼͍͠ίετஅΛ͢Δ खͨΓ࣍ୈʹ͞ͳ͍ɻ lࠓԿ͠ͳ͍͜ͱͷɺ কདྷతͳίετͲΕ͚ͩ ͩΖ͏ʁz ʰΦϒδΣΫτࢦઃܭ ࣮ફΨΠυʱQ
$IBMMFOHFT
ٕज़తνϟϨϯδ wνʔϜͷεϩʔΨϯͰ͋Δ wٕज़తνϟϨϯδΛ௨ͨ͡Ռˍ wٕज़తνϟϨϯδΛ͠ͳ͍ͱރΕͯ͠·͏ wΩϟϦΞҎલʹਫ਼ਆӴੜ্ඞཁ w؆୯ʹͰ͖ΔͷzνϟϨϯδzͰͳ͍ wࣗͷݶքΛ্͛ΔӦΈ
ԿΛʮνϟϨϯδʯ͢Δ͔ ʮ৽͍ٕ͠ज़ʯ͚͕ͩνϟϨϯδͰͳ͍ w ࣅͨΑ͏ͳϑϨʔϜϫʔΫΛͬͨ͜ͱ͕͋Εɺֶͼ ࣮গͳ͍ʢ͔͠Εͳ͍ʣ w ߴ࣭Λ࣮ݱ͢ΔͨΊͷϦΞʔΩςΫνϟɺίεύͷྑ͍ ςετɺγϡϛϨʔγϣϯ౷߹ςετͷΈɺϩάʹ ΑΔՄࢹԽɺೲظతͳνϟϨϯδ
ຖͷྉཧΛָ͠Έʹ͢Δ 5IBOLZPV