Shard 的最佳化管理
前言
進入此章節的先備知識
此章節的重點學習
Shard 的最佳化管理方式 - Sharding Strategy
Search 在執行時,一個 Shard 會分配一個 Thread,數量太多反而會拖慢速度
每個 Shard 都有基本運作的成本,數量太多成本愈高
指定 Shard 在 Cluster 中的分配方式,以優化儲存硬體的資源
刪除整批資料時,以 Index 為單位來刪除,而不要從一批 Documents 來刪除
建議使用 Data Stream 或 Index Lifecycle Management (ILM) 來管理 time series 資料
一般會建議讓單一 Shard 的大小在 10 ~ 50 GB 左右
1GB 的 Heap Memory 大約能處理 20 個 Shards
一個 Index 有多個 Shard 時,避免大多數的 Shard 都被分配在同一台 Node 身上
修正 oversharging (過多的 shards) Cluster 的方法
使用較長時間區間的 time-based indices 配置方式
刪掉空的或沒必要的 Indices
在系統較不忙的時段,執行 Force Merge 來合併 Segment Files
透過 Shrink API 將現有的 Index 的 shard 數量變少
透過 reindex API 來合併較小的 indices
參考資料
Last updated