Skip to content

Commit

Permalink
chore: Disable bloom filtering for bounded sharding strategy (#14272)
Browse files Browse the repository at this point in the history
This commit temporarily disables bloom filtering chunk refs in the `GetShards()` call on the index gateway when using the `bounded` sharding strategy.

This will result in chunks only being filtered once by the bloom gateway, reducing the amount of checks that need to be done on the bloom filters for a single request.Signed-off-by: Christian Haudum <[email protected]>
  • Loading branch information
chaudum authored Sep 26, 2024
1 parent f74b44c commit 6143a54
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions pkg/indexgateway/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ func (g *Gateway) GetShards(request *logproto.ShardsRequest, server logproto.Ind
return g.boundedShards(ctx, request, server, instanceID, p, forSeries)
}

// boundedShards handles bounded shard requests, optionally using blooms and/or returning precomputed chunks.
// boundedShards handles bounded shard requests, optionally returning precomputed chunks.
func (g *Gateway) boundedShards(
ctx context.Context,
req *logproto.ShardsRequest,
Expand Down Expand Up @@ -466,18 +466,20 @@ func (g *Gateway) boundedShards(

// 2) filter via blooms if enabled
filters := v1.ExtractTestableLabelMatchers(p.Plan().AST)
if g.bloomQuerier != nil && len(filters) > 0 {
xs, err := g.bloomQuerier.FilterChunkRefs(ctx, instanceID, req.From, req.Through, refs, p.Plan())
if err != nil {
level.Error(logger).Log("msg", "failed to filter chunk refs", "err", err)
} else {
filtered = xs
}
sp.LogKV(
"stage", "queried bloom gateway",
"err", err,
)
}
// NOTE(chaudum): Temporarily disable bloom filtering of chunk refs,
// as this doubles the load on bloom gateways.
// if g.bloomQuerier != nil && len(filters) > 0 {
// xs, err := g.bloomQuerier.FilterChunkRefs(ctx, instanceID, req.From, req.Through, refs, p.Plan())
// if err != nil {
// level.Error(logger).Log("msg", "failed to filter chunk refs", "err", err)
// } else {
// filtered = xs
// }
// sp.LogKV(
// "stage", "queried bloom gateway",
// "err", err,
// )
// }

g.metrics.preFilterChunks.WithLabelValues(routeShards).Observe(float64(ct))
g.metrics.postFilterChunks.WithLabelValues(routeShards).Observe(float64(len(filtered)))
Expand Down

0 comments on commit 6143a54

Please sign in to comment.