Slide 27
Slide 27 text
Lokiアンチパターン
3. カーディナリティの高い値をLabelに設定する
ラベルセットごとにindex/chunkが生成されるため、
ラベルセットが多い → index/chunkが多くなる・chunkサイズが小さくなる
→ 検索パフォーマンスの低下につながる
chunk数がLimitを超えstream_limitエラーでログが破棄される恐れもある
例えば、HPAが設定されていて頻繁に作成/終了されるPodがあるとする
Best Practice
極力は固定/カーディナリティの低い値をLabelに設定する
filter operatorで検索できるものはLabelに設定せずfilter operatorを使う
Best practices | Grafana Loki documentation
{cluster=“unk”, namespace=“monitoring”}
{cluster=“unk”, namespace=“monitoring”, pod_name=“abcd”}
{cluster=“unk”, namespace=“monitoring”, pod_name=“efgh”}
{cluster=“unk”, namespace=“monitoring”, pod_name=“ijkl”}
Pod名をLabelに設定した場合は
Podの数の分index/chunkが生成され、
1chunkのサイズも小さくなる。
Pod名をLabelに設定してない場合は
全体で1index/chunkになるので
その分検索も早くなる