mirror of https://github.com/grafana/loki
Reuse string/InstanceDesc buffers in index gateway clients (#9341)
**What this PR does / why we need it**: When running the IndexGateway in ring mode, `ring.MakeBuffersForGet()` in the index gateway client allocated fixed size `[]string`/`[]InstanceDesc` slices with a capacity of 5 for each and every request. By using a `sync.Pool` the client can reduce the amount of allocations. Additionally, since we run the index gateway ring with a high replication factor to be able to scale them better horizontally, an initial capacity of 5 is most of the time too low, leading to extra allocations when growing the capacity of the slice. **Checklist** - [ ] Reviewed the [`CONTRIBUTING.md`](https://github.com/grafana/loki/blob/main/CONTRIBUTING.md) guide (**required**) - [ ] Documentation added - [ ] Tests updated - [ ] `CHANGELOG.md` updated - [ ] Changes that require user attention or interaction to upgrade are documented in `docs/sources/upgrading/_index.md` --------- Signed-off-by: Christian Haudum <christian.haudum@gmail.com>pull/9290/head^2
parent
e46e650b50
commit
4bffed22e4
Loading…
Reference in new issue