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
600
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
360
Cookpad summer internship 2019 - API
kenju
0
10k
Introduction to Design Patterns
kenju
0
66
GraphQL Asia 2019 "Re-architecture of a decade-old app with BFF/GraphQL"
kenju
0
8.8k
Introduction to TypeScript
kenju
0
670
Introduction to Programmatic Ad
kenju
0
220
Other Decks in Programming
See All in Programming
シェーダーで魅せるMapLibreの動的ラスタータイル
satoshi7190
1
480
Pinia Colada が実現するスマートな非同期処理
naokihaba
4
220
タクシーアプリ『GO』のリアルタイムデータ分析基盤における機械学習サービスの活用
mot_techtalk
4
1.4k
Streams APIとTCPフロー制御 / Web Streams API and TCP flow control
tasshi
2
350
最新TCAキャッチアップ
0si43
0
140
Generative AI Use Cases JP (略称:GenU)奮闘記
hideg
1
290
Contemporary Test Cases
maaretp
0
140
Snowflake x dbtで作るセキュアでアジャイルなデータ基盤
tsoshiro
2
520
.NET のための通信フレームワーク MagicOnion 入門 / Introduction to MagicOnion
mayuki
1
1.6k
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
1
100
watsonx.ai Dojo #4 生成AIを使ったアプリ開発、応用編
oniak3ibm
PRO
1
120
エンジニアとして関わる要件と仕様(公開用)
murabayashi
0
290
Featured
See All Featured
Fireside Chat
paigeccino
34
3k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
890
Building an army of robots
kneath
302
43k
Docker and Python
trallard
40
3.1k
Designing on Purpose - Digital PM Summit 2013
jponch
115
7k
Art, The Web, and Tiny UX
lynnandtonic
297
20k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Building Better People: How to give real-time feedback that sticks.
wjessup
364
19k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
KATA
mclloyd
29
14k
Teambox: Starting and Learning
jrom
133
8.8k
Embracing the Ebb and Flow
colly
84
4.5k
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