SlideShare a Scribd company logo
1 of 29
Download to read offline
Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved.
2019年9⽉4⽇
ヤフー株式会社 ⽯⽥ 遊也
Apache Pulsar Meetup Japan #3
Apache Pulsar で実現する
⼤規模広告検索システム
Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved.
アジェンダ
2
• ⾃⼰紹介
• 広告検索システムの概要
• 広告検索システムにおけるPulsarの活⽤
• Pulsarの3つのポイント
• 細かい話
• まとめ
Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved.
3
⾃⼰紹介
• ⽯⽥遊也
• 2017年4⽉〜
ヤフー株式会社
• 広告検索システムの開発運⽤
• 海辺や森の中で暮らしたい
Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved.
広告検索とは︖
4
ユーザと相性の良い広告を配信
• ユーザの情報がクエリで、広告が検索
結果となるイメージ
!広告主
①広告情報を⼊稿
③検索結果(広告)
"
📱②クエリ(ユーザ情報)
ユーザ
Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved.
広告検索システムの概要
5
広告検索の問題設定についての詳細
• 広告配信のための⾼速疎ベクトル検索エ
ンジンの開発@WebDBフォーラム2015
• https://www.slideshare.net/tec
hblogyahoo/webdb2015-
webdbf2015
Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved.
広告検索システムとPulsar
6
1秒あたり平均
約130,000通
のメッセージを処理するなど活躍中
Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved.
広告検索システムの概要図
7
リージョンA
リージョンB
$広告主
%AIモデル
配信制御
&
+
Feeder
DB/API
検索エンジン
"
💁
📱
💻
API
検索エンジン
Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved.
広告検索システムの概要図
8
リージョンA
リージョンB
$広告主
%AIモデル
配信制御
&
+
Feeder
DB/API
検索エンジン
"
💁
📱
💻
API
検索エンジン
API
• 検索⽤データの受け⼝
• レスポンス速度が障害とならないよう、素早い応答が必須
• Web APIとFeederを別コンポーネントに分けて⾮同期処理
• DBにデータを書き、PulsarにProduceする
👉
Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved.
広告検索システムの概要図
9
リージョンA
リージョンB
$広告主
%AIモデル
配信制御
&
+
Feeder
DB/API
検索エンジン
"
💁
📱
💻
API
検索エンジン
Feeder
• 1通知につき1回、検索⽤データ変換ロジックを実⾏
• パーティションドトピック + Failover
• 冗⻑性確保のため、パーティション数+αのConsumerを⽤意
👈
Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved.
広告検索システムの概要図
10
リージョンA
リージョンB
$広告主
%AIモデル
配信制御
&
+
Feeder
DB/API
検索エンジン
"
💁
📱
💻
API
検索エンジン
検索エンジン
• Feederで作った検索⽤データをindexに反映
• 3000台規模の検索エンジンのデータソースは
Pulsarに⼀本化
• 外部DBへのクエリ発⾏無し
• スケーラビリティはPulsarの性能に依存
• 本番運⽤以降事故なし
• ジオレプリケーションも活⽤
👉
👉
Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved.
なぜこのシステムにしたか︖
11
(⾃前の)検索エンジンならではの苦悩
Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved.
検索エンジンの課題1
12
検索速度/負荷分散のための⼗分なマシン数
• 全リージョン合計で3000台に更新データ
を送信
• 外部DBへのアクセスも負荷的に厳しい
• 更新頻度を上げるのに問題が出る
• AIの活⽤頻度⤴ ⤴
Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved.
検索エンジンの課題2
13
リソースは検索のみに使⽤したい
• 更新頻度が増えるに連れ負荷が増える
• 重複する更新⽤の処理はまとめたい
• リソース増
⇒アラート対応の確率増
Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved.
検索エンジンの課題3
14
検索インデックスの管理が煩雑
• テーブル定義変更で ALTER TABLE
みたいにはいかない
• 新規クラスタの追加でインデックスの
再構築が必要
Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved.
検索エンジンの課題
15
これらの課題をPulsarで解決
Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved.
課題1をPulsarで解決
16
検索速度/負荷分散のための⼗分なマシン数
⇒ Exclusive Subscriptionとジオレプリケーション
で解決
• 1Subscriptionあたり1Consumerに限定できる
• データの圧縮もPulsarで
• LZ4, ZLIB, SNAPPY, ZSTD
• メッセージスキーマ
Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved.
課題2をPulsarで解決
17
リソースは検索のみに使⽤したい
⇒ PulsarのFailover Subscriptonでメッセージの順
序保証がされた前処理クラスタ(Feeder)を作成
• 各Consumerは同じSubscription
• 検索エンジン内の更新処理をできる限りFeederへ
• 1通知への操作がユニーク(重複なし)なため、DB
へのデータ取得の負荷が上がりにくい
Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved.
課題3をPulsarで解決
18
検索インデックスの管理が煩雑
⇒ Pulsarのreset-cursorコマンドでConsumerの
カーソルを過去の時間に巻き戻せるので、indexの再
作成が容易
• 定期的に全index情報をFeederが更新
• 検索エンジンのdeploy→巻き戻しで完成
• Dispatch Throttling機能で流量制御も可能
Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved.
これらのシステムを構築して思うこと
19
ノウハウを抽象化すると、Pulsarは以下
の3つのケースで使うべき
Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved.
3つのキーワード
20
⾮同期
⼀対多の通信
データストア
Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved.
⾮同期
21
Producer(書き込み側)
• Pulsarに書き込めばOKなのでロジック待ちがなく
⾼速
Consumer(読み込み側)
• ⼤量のリクエストで性能劣化するようなことがない
• Backlog数のチェックは必須
Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved.
⾮同期
22
• 同期処理より複雑さは増す ⚠
• リアルタイム性が利益に直結するケー
スには向いていない ⚠
• 広告のReal-Time Bidding
• 証券取引
Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved.
⼀対多の通信
23
中間の処理などの、ユニークな処理ならできるかぎり集約
• メッセージの処理順序を問わない処理
• Subscription: Shared (最速)
• メッセージの処理順序が厳密な処理
• Subscription: Failover, Key_shared
最終の処理など、複数台にコピーを反映するならExclusiveを選択
• ブロードキャストのような⼀対多の通信
• Subscription: Exclusive (+ ジオレプリケーション)
Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved.
データストア
24
Cursorをreset(巻き戻し)できる
• 下流のDBの再構築
• 性能調査、負荷試験
• Topic Compactionと併⽤すると⾼速
• > Allows for faster "rewind" through topic logs
https://pulsar.apache.org/docs/en/concepts-
topic-compaction/
Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved.
細かい話
25
その他細かい話
• 通知と実データは分けると吉
• マルチテナント
Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved.
通知と実データは分けると吉
26
メッセージ⾃体にはデータを含めず、メ
タデータ(primary keyなど)のみを送
り、データは別DB/APIで渡すパターン
Producer Consumer
③
④
②
①
DB/API
Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved.
通知と実データは分けると吉
27
• Consumer視点でデータ不整合が起きない
• 巻き戻しても古い実データが来ない
• Microservicesな外部APIの活⽤
• Pulsarの重複排除機能使⽤可能
Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved.
マルチテナント
28
ヤフー社内にPulsarのCommitter含む管理
チームが存在
• ⼀部テナントを間借りして利⽤
• 運⽤はプロにまかせる(超⼤事)
• 我々にもKafkaを⾃前運⽤していた時
期があったが…
Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved.
まとめ
29
• Pulsarは3000台規模の
Consumer/Subscriptionにも対応
• ⾮同期、⼀対多の通信、データストア
のユースケースで使うと良い
• 通知と実データは分けると吉

More Related Content

Recently uploaded

Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)Hiroshi Tomioka
 
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。iPride Co., Ltd.
 
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアルLoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアルCRI Japan, Inc.
 
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
LoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイスLoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイス
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイスCRI Japan, Inc.
 
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...Toru Tamaki
 
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)NTT DATA Technology & Innovation
 
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video UnderstandingToru Tamaki
 
新人研修 後半 2024/04/26の勉強会で発表されたものです。
新人研修 後半        2024/04/26の勉強会で発表されたものです。新人研修 後半        2024/04/26の勉強会で発表されたものです。
新人研修 後半 2024/04/26の勉強会で発表されたものです。iPride Co., Ltd.
 
業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)
業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)
業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)Hiroshi Tomioka
 
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Gamesatsushi061452
 
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。iPride Co., Ltd.
 

Recently uploaded (11)

Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
 
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
 
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアルLoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
 
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
LoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイスLoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイス
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
 
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
 
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
 
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
 
新人研修 後半 2024/04/26の勉強会で発表されたものです。
新人研修 後半        2024/04/26の勉強会で発表されたものです。新人研修 後半        2024/04/26の勉強会で発表されたものです。
新人研修 後半 2024/04/26の勉強会で発表されたものです。
 
業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)
業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)
業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)
 
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
 
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
 

Featured

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Featured (20)

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 

Apache Pulsar で実現する大規模広告検索システム @PulsarMeetupJapan_20190905

  • 1. Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved. 2019年9⽉4⽇ ヤフー株式会社 ⽯⽥ 遊也 Apache Pulsar Meetup Japan #3 Apache Pulsar で実現する ⼤規模広告検索システム
  • 2. Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved. アジェンダ 2 • ⾃⼰紹介 • 広告検索システムの概要 • 広告検索システムにおけるPulsarの活⽤ • Pulsarの3つのポイント • 細かい話 • まとめ
  • 3. Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved. 3 ⾃⼰紹介 • ⽯⽥遊也 • 2017年4⽉〜 ヤフー株式会社 • 広告検索システムの開発運⽤ • 海辺や森の中で暮らしたい
  • 4. Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved. 広告検索とは︖ 4 ユーザと相性の良い広告を配信 • ユーザの情報がクエリで、広告が検索 結果となるイメージ !広告主 ①広告情報を⼊稿 ③検索結果(広告) " 📱②クエリ(ユーザ情報) ユーザ
  • 5. Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved. 広告検索システムの概要 5 広告検索の問題設定についての詳細 • 広告配信のための⾼速疎ベクトル検索エ ンジンの開発@WebDBフォーラム2015 • https://www.slideshare.net/tec hblogyahoo/webdb2015- webdbf2015
  • 6. Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved. 広告検索システムとPulsar 6 1秒あたり平均 約130,000通 のメッセージを処理するなど活躍中
  • 7. Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved. 広告検索システムの概要図 7 リージョンA リージョンB $広告主 %AIモデル 配信制御 & + Feeder DB/API 検索エンジン " 💁 📱 💻 API 検索エンジン
  • 8. Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved. 広告検索システムの概要図 8 リージョンA リージョンB $広告主 %AIモデル 配信制御 & + Feeder DB/API 検索エンジン " 💁 📱 💻 API 検索エンジン API • 検索⽤データの受け⼝ • レスポンス速度が障害とならないよう、素早い応答が必須 • Web APIとFeederを別コンポーネントに分けて⾮同期処理 • DBにデータを書き、PulsarにProduceする 👉
  • 9. Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved. 広告検索システムの概要図 9 リージョンA リージョンB $広告主 %AIモデル 配信制御 & + Feeder DB/API 検索エンジン " 💁 📱 💻 API 検索エンジン Feeder • 1通知につき1回、検索⽤データ変換ロジックを実⾏ • パーティションドトピック + Failover • 冗⻑性確保のため、パーティション数+αのConsumerを⽤意 👈
  • 10. Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved. 広告検索システムの概要図 10 リージョンA リージョンB $広告主 %AIモデル 配信制御 & + Feeder DB/API 検索エンジン " 💁 📱 💻 API 検索エンジン 検索エンジン • Feederで作った検索⽤データをindexに反映 • 3000台規模の検索エンジンのデータソースは Pulsarに⼀本化 • 外部DBへのクエリ発⾏無し • スケーラビリティはPulsarの性能に依存 • 本番運⽤以降事故なし • ジオレプリケーションも活⽤ 👉 👉
  • 11. Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved. なぜこのシステムにしたか︖ 11 (⾃前の)検索エンジンならではの苦悩
  • 12. Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved. 検索エンジンの課題1 12 検索速度/負荷分散のための⼗分なマシン数 • 全リージョン合計で3000台に更新データ を送信 • 外部DBへのアクセスも負荷的に厳しい • 更新頻度を上げるのに問題が出る • AIの活⽤頻度⤴ ⤴
  • 13. Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved. 検索エンジンの課題2 13 リソースは検索のみに使⽤したい • 更新頻度が増えるに連れ負荷が増える • 重複する更新⽤の処理はまとめたい • リソース増 ⇒アラート対応の確率増
  • 14. Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved. 検索エンジンの課題3 14 検索インデックスの管理が煩雑 • テーブル定義変更で ALTER TABLE みたいにはいかない • 新規クラスタの追加でインデックスの 再構築が必要
  • 15. Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved. 検索エンジンの課題 15 これらの課題をPulsarで解決
  • 16. Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved. 課題1をPulsarで解決 16 検索速度/負荷分散のための⼗分なマシン数 ⇒ Exclusive Subscriptionとジオレプリケーション で解決 • 1Subscriptionあたり1Consumerに限定できる • データの圧縮もPulsarで • LZ4, ZLIB, SNAPPY, ZSTD • メッセージスキーマ
  • 17. Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved. 課題2をPulsarで解決 17 リソースは検索のみに使⽤したい ⇒ PulsarのFailover Subscriptonでメッセージの順 序保証がされた前処理クラスタ(Feeder)を作成 • 各Consumerは同じSubscription • 検索エンジン内の更新処理をできる限りFeederへ • 1通知への操作がユニーク(重複なし)なため、DB へのデータ取得の負荷が上がりにくい
  • 18. Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved. 課題3をPulsarで解決 18 検索インデックスの管理が煩雑 ⇒ Pulsarのreset-cursorコマンドでConsumerの カーソルを過去の時間に巻き戻せるので、indexの再 作成が容易 • 定期的に全index情報をFeederが更新 • 検索エンジンのdeploy→巻き戻しで完成 • Dispatch Throttling機能で流量制御も可能
  • 19. Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved. これらのシステムを構築して思うこと 19 ノウハウを抽象化すると、Pulsarは以下 の3つのケースで使うべき
  • 20. Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved. 3つのキーワード 20 ⾮同期 ⼀対多の通信 データストア
  • 21. Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved. ⾮同期 21 Producer(書き込み側) • Pulsarに書き込めばOKなのでロジック待ちがなく ⾼速 Consumer(読み込み側) • ⼤量のリクエストで性能劣化するようなことがない • Backlog数のチェックは必須
  • 22. Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved. ⾮同期 22 • 同期処理より複雑さは増す ⚠ • リアルタイム性が利益に直結するケー スには向いていない ⚠ • 広告のReal-Time Bidding • 証券取引
  • 23. Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved. ⼀対多の通信 23 中間の処理などの、ユニークな処理ならできるかぎり集約 • メッセージの処理順序を問わない処理 • Subscription: Shared (最速) • メッセージの処理順序が厳密な処理 • Subscription: Failover, Key_shared 最終の処理など、複数台にコピーを反映するならExclusiveを選択 • ブロードキャストのような⼀対多の通信 • Subscription: Exclusive (+ ジオレプリケーション)
  • 24. Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved. データストア 24 Cursorをreset(巻き戻し)できる • 下流のDBの再構築 • 性能調査、負荷試験 • Topic Compactionと併⽤すると⾼速 • > Allows for faster "rewind" through topic logs https://pulsar.apache.org/docs/en/concepts- topic-compaction/
  • 25. Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved. 細かい話 25 その他細かい話 • 通知と実データは分けると吉 • マルチテナント
  • 26. Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved. 通知と実データは分けると吉 26 メッセージ⾃体にはデータを含めず、メ タデータ(primary keyなど)のみを送 り、データは別DB/APIで渡すパターン Producer Consumer ③ ④ ② ① DB/API
  • 27. Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved. 通知と実データは分けると吉 27 • Consumer視点でデータ不整合が起きない • 巻き戻しても古い実データが来ない • Microservicesな外部APIの活⽤ • Pulsarの重複排除機能使⽤可能
  • 28. Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved. マルチテナント 28 ヤフー社内にPulsarのCommitter含む管理 チームが存在 • ⼀部テナントを間借りして利⽤ • 運⽤はプロにまかせる(超⼤事) • 我々にもKafkaを⾃前運⽤していた時 期があったが…
  • 29. Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved. まとめ 29 • Pulsarは3000台規模の Consumer/Subscriptionにも対応 • ⾮同期、⼀対多の通信、データストア のユースケースで使うと良い • 通知と実データは分けると吉