Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Personalized Content Recommender System on Sp...
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
LINE Developers
March 25, 2019
Technology
2.2k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Personalized Content Recommender System on Spring
LINE Developers
March 25, 2019
More Decks by LINE Developers
See All by LINE Developers
LINEスタンプのSREing事例集:大きなスパイクアクセスを捌くためのSREing
line_developers
3
2.6k
Java 21 Overview
line_developers
6
1.4k
Code Review Challenge: An example of a solution
line_developers
1
1.7k
KARTEのAPIサーバ化
line_developers
1
650
著作権とは何か?〜初歩的概念から権利利用法、侵害要件まで
line_developers
5
2.4k
生成AIと著作権 〜生成AIによって生じる著作権関連の課題と対処
line_developers
3
2.5k
マイクロサービスにおけるBFFアーキテクチャでのモジュラモノリスの導入
line_developers
9
4.1k
A/B Testing at LINE NEWS
line_developers
3
1.2k
LINEのサポートバージョンの考え方
line_developers
2
1.6k
Other Decks in Technology
See All in Technology
Claude Code本って、 読む必要あるの?
oikon48
2
430
TinyGo 開発サイクルを高速化する:Go で作るエミュレータ入門
zozotech
PRO
1
680
多層防御と最⼩権限で実現する、安全なAIエージェント設計パターン
lycorptech_jp
PRO
1
280
Podは生きているのにGoだけが落ちる:GOGCとGOMEMLIMITで追うInvisible OOM Killの謎
tkc66buzz
1
680
俺の仕事は AIに奪われないし、たぶんその BIも要らない
hikaruri
0
280
薬剤師(ドメインエキスパート)と一緒に育てる薬局向けAIアシスタント
kakehashi
PRO
2
160
20260906 「AWS運用入門」著者が教える、運用業務への生成AI活用入門
masaruogura
0
260
Slack上でインフラをトラブルシュートする! Agentic Platform Engineeringの第一歩
teru0x1
4
1.6k
[2026-09-11]SREは誰のもの?運用エンジニアが始める 「SRE領域への越境」とチームの進化の軌跡 〜Road to NEXT CRE
tosite
0
170
2026_devsumi_ozono.pdf
o3
3
450
事業課題から技術的負債に向き合う
sansantech
PRO
2
530
Microsoft 365 Copilot chat -tekoälypalvelun tietosuojaongelmat
hponka
0
830
Featured
See All Featured
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.9k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
510
Navigating Weather and Climate Data
rabernat
0
520
Java REST API Framework Comparison - PWX 2021
mraible
34
9.7k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
63
46k
A designer walks into a library…
pauljervisheath
211
25k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
57k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.1k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
660
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
Transcript
Personalized Content Recommender System on Spring
About me @hackmylife • ຊ໊ ᬒ थ ௨শ നถ •
։ൃ̐ηϯλʔ > AP3 team • Senior server side engineer • livedoorχϡʔε, LINEΪϑτ, LINE BLOG • LINE Ads Platform • Smart Channel • Spring fest 2018 fall
Smart Channel
• Overview • Architecture • Team Agenda
Overview
Concept Contents Contents
UX
• User͕͍ͬͯΔɺ͋Δ͍ڧ͍རӹͷ͋ΔServiceͷใ • ServiceͰ֤UserʹPersonalizeͯ͠࡞ΒΕͨͷ • ࣄલTest৴Λͯ͠ҰఆͷධՁΛ͑ͳ͚ΕͳΒͳ͍(ޙड़) Contents
• Userʹର͢ΔRecommendΛ֤Service͔ΒूΊΔ • ूΊͨ Contents ΛҰ࣌తʹอଘ͓ͯ͘͠ • RequestΛड͚ͨΒContentsΛRankingͯ͠n݅બΜͰ৴͢Δ ͜ͷαʔϏεͷಛ
Figures MAU 79M RPS 250k Servers 200+ * JP͚ͩͷ
Architecture
None
Java + Spring
• Redis • MySQL • Kafka • Spring boot 2
• lettuce5 • MyBatis + kotlin • Caffeine • fastutil, guava Spec
Application 86 pm servers 40 vm servers MySQL 3 vm
servers Redis 100+ vm instance (Redis cluster) Kafka In-house common (Kafka cluster) Log storage In-house common (Hadoop) Servers
Importer CRS Engine Event Tracker Joiner Learning worker 5ͭͷComponent
CRS Engine Flow Event Tracker Joiner Learning worker Importer LINE
App Contents Contents Imp/Click Log Log Parameter
CRS Engine 1. Importer Event Tracker Joiner Learning worker Importer
LINE App Contents Contents Imp/Click Log Log Parameter
None
• Mapping provider͔Βɺrecommend item ͷID͚ͩΒ͏ • item͕ͲΜͳσʔλΛ͍࣋ͬͯΔ͔͍ ߹ΘͤΔ • Redisʹmapping
ͱ contentsΛstore͢Δ Importer user_id1 \t item_id1, item_id2, item_id3 user_id2 \t item_id3, item_id4 user_id3 \t item_id1, item_id2, item_id6 { "items": [ { "originalId": "12345678", "title": “ࣗͷೳྗΛݟۃΊͯ", "description": "ແཧͳεέδϡʔϧͰମௐΛ่ͯ͠͠·͏ΑΓɺ ૉʹपΓʹཔΓ·͠ΐ͏ɻࠓࣗʹݫͯ͘͠͠͠·͍͕ͪɻ ࣗͷೳྗΛ͑ΔͱࢥͬͨΒঢ়گΛͯ͠ڠྗͯ͠Βͬͯ͘ ͍ͩ͞ɻ", "linkURL": “line://ch/1391620050/z/fortune/detail/2/20181011", "iconURL": “http://example.com/path/to/image1.png" }, ……. ] }
• ֤ServiceͰRecommendΛ࡞ͬͯΒ͏ • ྑ͍RecommendʹڧྗͳDomain͕ࣝඞཁ • ServiceʹΑͬͯࡉ͔͍දࣔͷͨΊͷ͕݅͋Δ Recommend
• Recommendation dataͭ͘Δͷ ML engineer • Master data ཧͯ͠Δͷ Service
side engineer • ୲෦ॺ͕ҧ͏ʢ߹ʹΑͬͯࠃҧ͏ʣ • RecommendΛ࡞ͬͨ࣌ͱ͕࣌ࠩ͋Δ Կނ2ճʹ͚ͯσʔλΛऔΔ͔
• Specͱʹ͔͘ΨνΨνʹݻΊ͓ͯ͘ • Documment͔ͬ͠Γἧ͑ͯӳޠͰॻ͍͓ͯ͘ • ServiceͷࢥతΛͪΌΜͱ͑Δ • جຊతʹࣄલTestΛͯ͠ΫϦΞ͠ͳ͍ͱ͍͚ͳ͍ ؾΛ͚͍ͭͯΔ͜ͱ
• CTRxCTRʹΑΔධՁ • ΞϯέʔτͳͲͷఆੑతධՁ • ্هޓ͍ʹڧ͍૬ؔؔ༗Γ Preliminary test
• RecommendServiceଆͰ࡞ͬͯΒ͏ • Recommend id/dataͷऔಘΛ͍ͯ͠Δ • औಘͨ͠Contentsredisʹશ෦ೖΕΔ • Service࿈ܞલʹ͍ͭ͘ͷνΣοΫ͕͋Δ Importer
·ͱΊ
CRS Engine 2. CRS Engine Event Tracker Joiner Learning worker
Importer LINE App Contents Contents Imp/Click Log Log Parameter
None
• UserຖʹRecommend contentsऔಘ • Frequency cap / mute / opt-outͳͲͰfiltering
• Recommend itemΛRanking্͔ͯ͠Βn݅ฦ͢ • Contextual bandit algorithmsΛ࠾༻ CRS Engine
• Reactive API • RedisAdvancedClusterReactiveCommands • Γ͕ Mono / Flux
• ݸਓతʹ͘͢͝εοΩϦ͔͚͖ͯ Lettuce5
• Reactive Streamsͷpublisher࣮ • Mono࠷େ1ݸͷitemΛѻ͏ • FluxෳͷitemΛѻ͏ Mono/Flux
Mono/Fluxͷྫ targetingRedis.mget(keys) // ͜͜Flux͕ؼͬͯ͘Δ .filter(KeyValue::hasValue) .map(keyValue -> Maps.immutableEntry(extractTargetingType(keyValue.getKey()), keyValue.getValue())) .collectMap(Map.Entry::getKey,
Map.Entry::getValue); // ΓɹMono<Map<String, List<String>>> Key: user_id:news Val: ["65819383620a","48d2872c86c6","293d0a33f938","c43cd18c98f4"] Key: user_id:weather Val: [“1"] -> ͜ΕΛnews, weatherΛkeyͱͨ͠Mapͱ͔ʹͯ͠ฦ͍ͨ͠ ࣮ࡍʹॲཧ͞ΕΔͷsubscribeͨ࣌͠
• Flux͔Βstreaming apiతͳॲཧΛεϜʔζʹ͔͚Δ • ଈॲཧͰͳ͘ॲཧΛޙͰߦ͑Δ • Mono.zip()ͳͲΛͬͯฒྻॲཧͰ͖Δ • ͨͩɺ·ͩͦ͜·Ͱ͍ͬͯͳ͍ Mono/FluxͷϝϦοτ
subtitle Bandit algorithms • SlotͷrewardΛ࠷େԽ͢Δ • ࣄલڞ༗ใ͕ແ͍߹͋Δ • ϥϯυຖʹͲͷarmΛબͿ͔ܾఆ͢Δ •
ϙΠϯτ୳ࡧͱ׆༻Λ͍͚Δ͜ͱ
• ࠷ॳdata͕Γͳ͍ͷͰɺͱΓ͋͑ͣճͯ͠ΈΔʢ୳ࡧʣ • ͋Δఔճ͢ͱ༏ྼ͕ղͬͯ͘Δ • Ұ൪ظ͞ΕΔreward͕ྑ͍ͱ͜ΖΛճ͢ʢ׆༻ʣ • ͬͱใु͕ྑ͍Ϛγϯ͕͋Δ͔୳͢ʢ୳ࡧʣ ୳ࡧͱ׆༻
• RewardͷఆٛUserͷreaction (CTRͱ͔xCTRͱ͔) • UserҰਓҰਓʹarmΛ͚͍͕ͨɺऩଋͣ͠Β͘ͳΔ • ͳͷͰɺ͏গ͠େཻ͖͍Ͱֶश͍ͯ͠Δ • ਫ਼Λ্͛ΔͨΊʹɺ͍͔ͭ͘ใʢ=ContextʣΛ༩͍͑ͯΔ Contextual
bandit on CRS engine
User side • Gender • Age • Interests Contents side
2-side features • Time • Id • Score
• ঁੑ > உੑ • ए͍ੈͷํ͕ؾʹ͢ΔͷͰʁ • உੑͦΜͳʹݟͳ͍ʁ User side
- ͍ Age-range x Gender
• Ͳ͏ͤΈΔͳΒேͩΑͶ • ྑ͍݁Ռͩͱclick͍͢͠ͷͰ • ѱ͍݁Ռݟͨ͘ͳ͍ʁ Contents side - ͍
Age-range x Gender x Hour x Score
LinUCB Bayesian linear regression Bayesian factorization machines Supported Algorithms Bayesian
neural factorization machines
• RedisΛ৭ʑࢀর͍ͯͯ͠Δ • Contextual bandit algorithms ͷRankerͱͯ͠n݅બͿ • BanditͷContext৭ʑ͍ͯ͠Δ CRS
engine ·ͱΊ
CRS Engine 3. Event Tracker Event Tracker Joiner Learning worker
Importer LINE App Contents Contents Imp/Click Log Log Parameter
None
• imp/click/muteͳͲͷeventΛड͚Δ • Ұ୴Kafkaʹproduce͢Δ͚ͩ • consume͢Δcomponent͚ͯͯΔ • KafkaΛ͏ϝϦοτΛ1൪ڗडͰ͖Δ Event tracker
• ߴ͍scalabilityͱavailability • Persistent data • Pub-Subܕ (kafkaͷ༻ޠͱͯ͠produce / consume)
• ෳconsumer͔ΒಡΊΔ Kafka
• eventΛอଘ͢Δॲཧͱɺ࣮ࡍʹԿ ͔͢ΔॲཧΛ͚ΒΕΔ • ผͷconsumer͔ΒಡΊΔ • ো࣌ʹӨڹΛ࠷খݶʹͰ͖Δɺ ಛఆ͘͢͠ͳΔ KafkaͷϝϦοτ
• Spring bootͱ૬ੑ͕ͱͯྑ͍ • @BeanͰKafka-clientΛཧ͢Δͱੜ/ഁغ·Ͱ໘ݟͯ͘ΕΔ • Kafka-streamsͱΈ߹ΘͤΔ͜ͱͰίʔυॻ͘ྔ͕ͱͯগͳ͍ • Spring-kafka͋Δ͚ͲެࣜKafka-client͕Φεεϝ Kafka
on spring
@Configuration @RequiredArgsConstructor @EnableConfigurationProperties({ KafkaStreamsProperties.class, KafkaTopicProperties.class }) public class KafkaStreamsConfiguration {
@Bean public KafkaStreams muteEventStream( KafkaStreamsProperties streamsProperties, KafkaTopicProperties topicProperties ) { final StreamsBuilder builder = new StreamsBuilder(); builder.stream(topicProperties.getMuteEvent(), Consumed.with(new StringSerde(), new StringSerde())) .foreach((key, value) -> { try { // Կ͔ॲཧ } catch (Exception e) { // ྫ֎ॲཧ } }); KafkaStreams streams = new KafkaStreams(builder.build(), streamsProperties.getMuteEventStream()); streams.setUncaughtExceptionHandler((thread, e) -> { log.error("Uncaught exception in StreamThread.", e); }); streams.start(); return streams; } }
kafka: servers: server1, server2, server3 metrics-reporter: com.example.awesome.kafka.metrics.PrometheusMetricsReporter topic: mute-event: awesome-mute-event-v1
stream: mute-event-stream: "bootstrap.servers": ${kafka.servers} "application.id": crs-mute-event "state.dir": /path/to/kafka-streams "num.stream.threads": 6 "replication.factor": 3 "metric.reporters": ${kafka.metrics-reporter} consumer: "max.poll.records": 100 "auto.offset.reset": earliest @ConfigurationProperties(prefix = "kafka.stream") public class KafkaStreamsProperties { @NotNull @Valid private Properties muteEventStream; }
• LINEΞϓϦ͔ΒͷEventΛड͚औΔॲཧ • KafkaΛڬΉ͜ͱͰɺߴ/োੑΛ࣮ݱͯ͠Δ • ݸਓతʹKafkaҰԡ͠Ͱ͢ Event Tracker ·ͱΊ
CRS Engine 4. Joiner Event Tracker Joiner Learning worker Importer
LINE App Contents Contents Imp/Click Log Log Parameter
None
• ϢʔβʔͷContentsʹର͢ΔԠ͕Γ͍ͨ • imp͞Εͨcontents͕click͞Ε͔ͨɺmute͞Ε͔ͨ • impͱclick/muteΛjoin͍ͨ͠ Γ͍ͨ͜ͱ
• imp͕ಧ͍ͨஈ֊Ͱclickmuteະདྷͷࣄ • click͕དྷͨ࣌Ͱimpॲཧ͞Εͯ͠·͍ͬͯΔ • impΛ͋ΔఔԆͤͯ͞ॲཧ͍ͨ͠ Ͳ͏͢Εྑ͍͔
• impͷconsumeΛ10minΒͤΔ • clickmuteͦͷ··Redisʹ • 10minޙimpΛॲཧ͢Δͱ͖ʹredisΛࢀর Ԇconsumer https://www.slideshare.net/linecorp/line-ads-platformkafka-126180436
• MLͷڭࢣσʔλͷूܭॲཧ • KafkaΛԠ༻ͨ͠ԆConsumerॲཧ Joiner ·ͱΊ
CRS Engine 5. Learning worker Event Tracker Joiner Learning worker
Importer LINE App Contents Contents Imp/Click Log Log Parameter
None
• engine͕rankerɺ͜͜trainerଆ • σʔλྔ͕ଟ͍ͷͰฒྻԽ͍ͨ͠ • ޮԽͷͨΊ·ͱΊͯॲཧ͍ͨ͠ • ಉ͡armͷσʔλಉ͡αʔόʔͰॲཧ Learning worker
• BanditͷTrainerPython • NginxͰ Consistent hashing • User trafficΛड͚ΔRankerjava Learning
worker
• NumPy/Numba͕͍͔ͨͬͨ • BanditΛ։ൃͯ͠Δͷdatalabs -> ML part • Ranker҆ఆੑΛॏࢹ͍ͨ͠ͷͰJavaͰؤுͬͯॻ͘ •
Python <-> JavaͷΠϯλʔϑΣʔεprotobufͰఆٛ Why Python
• Bandit algorithmsͷTrainer • ඇಉظ/ޮతʹֶश͢ΔͨΊʹ͍Ζ͍Ζͯ͠Δ • Java <-> PythonͰparameterΛड͚͠ •
͠ํֶशͷํͰ͍͔ͭ͘Λ͍ͯ͠Δ Learning worker·ͱΊ
Team
subtitle Developers • Server side engineer 5 ਓ • ML
team֤Service developerͱίϥϘϨʔγϣϯ • GlobalͷϝϯόʔͱͷΓऔΓසൟʹ͋Δ • ·ͩ·ͩ໘ന͍Spec͋ΔͷͰ͍͖͍ͬͯͨ
THANK YOU