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
680
Introduction to Programmatic Ad
kenju
0
220
Other Decks in Programming
See All in Programming
Figma Dev Modeで変わる!Flutterの開発体験
watanave
0
150
.NET のための通信フレームワーク MagicOnion 入門 / Introduction to MagicOnion
mayuki
1
1.7k
Jakarta EE meets AI
ivargrimstad
0
240
EMになってからチームの成果を最大化するために取り組んだこと/ Maximize team performance as EM
nashiusagi
0
100
WebフロントエンドにおけるGraphQL(あるいはバックエンドのAPI)との向き合い方 / #241106_plk_frontend
izumin5210
4
1.4k
Streams APIとTCPフロー制御 / Web Streams API and TCP flow control
tasshi
2
350
Quine, Polyglot, 良いコード
qnighy
4
650
色々なIaCツールを実際に触って比較してみる
iriikeita
0
330
Enabling DevOps and Team Topologies Through Architecture: Architecting for Fast Flow
cer
PRO
0
340
Jakarta EE meets AI
ivargrimstad
0
150
Jakarta EE meets AI
ivargrimstad
0
620
ペアーズにおけるAmazon Bedrockを⽤いた障害対応⽀援 ⽣成AIツールの導⼊事例 @ 20241115配信AWSウェビナー登壇
fukubaka0825
6
2k
Featured
See All Featured
A Philosophy of Restraint
colly
203
16k
Documentation Writing (for coders)
carmenintech
65
4.4k
GraphQLとの向き合い方2022年版
quramy
43
13k
Building Applications with DynamoDB
mza
90
6.1k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
Adopting Sorbet at Scale
ufuk
73
9.1k
Scaling GitHub
holman
458
140k
Being A Developer After 40
akosma
87
590k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.8k
Building Better People: How to give real-time feedback that sticks.
wjessup
364
19k
Designing Experiences People Love
moore
138
23k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
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