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
0
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
190
Kafka on Kubernetes with Strimzi
kenju
1
130
AWS DynamoDB Accelerator (DAX) 101
kenju
3
6.8k
Moden browser introduction
kenju
1
350
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
210
Other Decks in Programming
See All in Programming
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
350
現場で役立つモデリング 超入門
masuda220
PRO
13
2.9k
詳細解説! ArrayListの仕組みと実装
yujisoftware
0
480
qmuntal/stateless のススメ
sgash708
0
120
Streams APIとTCPフロー制御 / Web Streams API and TCP flow control
tasshi
1
290
Jakarta Concurrencyによる並行処理プログラミングの始め方 (JJUG CCC 2024 Fall)
tnagao7
1
230
CSC509 Lecture 09
javiergs
PRO
0
110
Vitest Browser Mode への期待 / Vitest Browser Mode
odanado
PRO
2
1.7k
Progressive Web Apps für Desktop und Mobile mit Angular (Hands-on)
christianliebel
PRO
0
110
推し活の ハイトラフィックに立ち向かう Railsとアーキテクチャ - Kaigi on Rails 2024
falcon8823
6
2.2k
[PyCon Korea 2024 Keynote] 커뮤니티와 파이썬, 그리고 우리
beomi
0
110
OpenTelemetryでRailsのパフォーマンス分析を始めてみよう(KoR2024)
ymtdzzz
4
1.6k
Featured
See All Featured
Facilitating Awesome Meetings
lara
49
6k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2.1k
BBQ
matthewcrist
85
9.3k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
364
22k
Typedesign – Prime Four
hannesfritz
39
2.4k
A better future with KSS
kneath
238
17k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
664
120k
How to Think Like a Performance Engineer
csswizardry
19
1.1k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
7.9k
Adopting Sorbet at Scale
ufuk
73
9k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.2k
How to Ace a Technical Interview
jacobian
275
23k
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