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
回首過去_看_KKBOX_怎麼走搜尋音樂這條路.pdf
Search
Eason Chen
August 11, 2018
Technology
1
130
回首過去_看_KKBOX_怎麼走搜尋音樂這條路.pdf
Eason Chen
August 11, 2018
Tweet
Share
More Decks by Eason Chen
See All by Eason Chen
使用 Grafana + Prometheus 打造視覺化監控平台
jhihming
1
300
Other Decks in Technology
See All in Technology
止まらないLinuxシステムを構築する_高信頼性クラスタ入門
koedoyoshida
1
180
本当のAWS基礎
toru_kubota
1
620
ワールドカフェI /チューターを改良する / World Café I and Improving the Tutors
ks91
PRO
0
150
【NW X Security JAWS#3】L3-4:AWS環境のIPv6移行に向けて知っておきたいこと
shotashiratori
1
620
The AI Revolution Will Not Be Monopolized: Behind the scenes
inesmontani
PRO
1
160
Autonomous Database Cloud 技術詳細 / adb-s_technical_detail_jp
oracle4engineer
PRO
15
35k
IPUT App Dev. Co. -Overview 2024/4
iputapp
0
120
Cloud Service Mesh に触れ合う
phaya72
1
180
Azure Container Apps + Bicep 〜 こんな感じで運用しています
kaz29
3
620
Building Dashboards as a Hobby
egmc
0
370
web-application-security
matsuihidetoshi
1
190
よく聞くけど使ったことないソフトウェアNo.1 KafkaとSnowflake
foursue
4
510
Featured
See All Featured
Infographics Made Easy
chrislema
238
18k
Build your cross-platform service in a week with App Engine
jlugia
226
17k
VelocityConf: Rendering Performance Case Studies
addyosmani
321
23k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
188
16k
Atom: Resistance is Futile
akmur
260
25k
The Illustrated Children's Guide to Kubernetes
chrisshort
32
46k
The Art of Programming - Codeland 2020
erikaheidi
43
12k
The Mythical Team-Month
searls
216
42k
Build The Right Thing And Hit Your Dates
maggiecrowley
25
2k
What's in a price? How to price your products and services
michaelherold
238
11k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
14
1.5k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
13
8.3k
Transcript
回首過去 看 KKBOX 怎麼走搜尋音樂這條路 Eason Chen 2018/08/11
Agenda • 現況 • 使用者體驗改善 • 機器配置 • 系統升級 •
監控平台 • 踩坑全記錄
None
欸,有沒有免費帳號來一下?
KKBOX 不就播歌而已 你在裡面做什麼?
$149起
你們號稱有 4000 萬首歌曲 為什麼找不到這首?
KKBOX 有哪些地方用到搜尋?
None
None
None
None
CMS 後台
KKBOX Open API
None
None
https://www.kube-app.com
None
None
None
音樂曲庫資料量 • 4000 萬首歌曲 • 700 萬張專輯 • 200 萬位歌手
• 900 萬張歌單
如何提供 快穩準 的音樂搜尋
在 2014 年開始使用 Elasticsearch
比較 Solr 和 Elasticsearch Solr 3.5 Elasticsearch 1.6 架構 Master-Slave
Cluster 配置 需要預先在 XML 檔案設定 直接透過 RESTful API 設定 功能 著重於文本搜尋 也支援資料分析 社群 發展成熟 成長中
還是老闆的一句話
使用
MeCab 支援日文搜尋 • 問題:日本習慣輸入羅馬拼音搜尋歌手 • 解決方案 ◦ 漢字 => 五十音
=> 羅馬拼音 ◦ 字典:Mecab-ipadic-neologd
OpenCC 支援繁簡轉換 • 問題:星馬地區習慣輸入簡體 • 解決方案 ◦ 一律轉為台灣繁體
容錯搜尋處理 • 問題:英文容易拼錯 • 解決方案 ◦ Term Suggester 根據編輯距離找出和 關鍵字相近的字串
◦ 指定 index 放在同一個 shard
優化 Autocomplete 回應時間 Edge ngram Context Suggester 實做方法 周杰倫 ➔
周、周杰、周杰倫 FST (Finite State Transducer) 實測秒數 15.85 ms 5.8 ms
資料處理 小寫字母 ASCII 原型詞根 Dash 縮寫符號 表情符號 Token Filter /
LIbrary lowercase asciifolding porter_stem word_delimiter emojione 案例 Mayday mayday Jóhann Jóhannsson Johann Johannsson apples apple A-Lin a lin alin grinning
None
配置
None
Node 1 (M) Node 2 Node 2 (M) Split Brain
None
None
升級
CI / CD • 測試不同環境的程式行為 • 自動化檢測 安裝套件 語法檢查 單元測試
整合測試 Coverage
2014/06 開始使用 ES 1.6 2017/10 升級 ES 2.4 2018/03 升級
ES 5.6
升級計畫 • 功能測試 • Client 平行轉換 • 壓力測試
備援計畫
升級效益 • CPU 使用量減少 25% • JVM 最大值從 31G 下降到
24G • API 平均回應時間從 222ms 下降到 192ms • Index 更新時間縮短 33%
為什麼沒有繼續往上升到 6.x?
監控
Munin
Munin to Kibana Munin Kibana + Marvel 性能指標豐富 勝 介面操作容易
勝 資料來源穩定 勝
Kibana vs Grafana Kibana Grafana 資料來源 Elasticsearch Prometheus + Elasticsearch
Exporter
Grafana - Template 功能
None
None
None
https://grafana.com/dashboards/7259
https://github.com/KKBOX/grafana-elasticsearch-dashboard
踩坑全記錄
12:47 Server 5 沒有回應 Cluster Health 亮紅燈 12:48 Server 5
離開 Cluster Shard 重新分配 Server 4 接手歌單 Shard Server 4 忙碌到沒有回應 12:49 Server 4 離開 Cluster Shard 再度重新分配
事發當下 Server 5 的 Swap 變化 隔天 Server 1 短暫離開
Cluster 的 Swap 變化 Swap Issue
Swap Issue • 解決方案 ◦ vm.swappiness 設為 0 ◦ unmount
swap partition
• 問題:某些機器 CPU 使用率特別高 • 追蹤:跟索引文件的分配方式有關 • 解決方案 ◦ 人工
Sharding 介入調整 ◦ 重構歌曲和歌單的 Query 機器負載分布不均
搜尋效能下降 • 問題:機器運行一段時間後,搜尋效能下降 • 追蹤 ◦ GC 的花費時間,隨著 JVM 運行越久而不斷上升
◦ Groovy 有 Memory Leak Issue
None
None
Q & A
強大的應用來自背後偉大的資料! KKBOX Open API 為什麼讓開發者紛紛入坑? 快快掃, 別錯過!
101 國際會議廳 門口 講 台 門口 展覽A區 校園側門 (入口2) 基隆路
大門 (入口1)
THANK YOU