Skip to content

Commit

Permalink
Compactor: Add runtime.GC() to reduce memory usage (#915)
Browse files Browse the repository at this point in the history
* runtime.GC() to reduce compactor memory needs

Signed-off-by: Joe Elliott <[email protected]>

* changelog

Signed-off-by: Joe Elliott <[email protected]>
  • Loading branch information
joe-elliott authored Aug 27, 2021
1 parent b16e589 commit e586b33
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* [ENHANCEMENT] Add support to tempo workloads to `overrides` from single configmap in microservice mode. [#896](https://github.com/grafana/tempo/pull/896) (@kavirajk)
* [ENHANCEMENT] Make `overrides_config` block name consistent with Loki and Cortex in microservice mode. [#906](https://github.com/grafana/tempo/pull/906) (@kavirajk)
* [ENHANCEMENT] Make `overrides_config` mount name static `tempo-overrides` in the tempo workloads in microservice mode. [#906](https://github.com/grafana/tempo/pull/914) (@kavirajk)

* [ENHANCEMENT] Reduce compactor memory usage by forcing garbage collection. [#915](https://github.com/grafana/tempo/pull/915) (@joe-elliott)

## v1.1.0-rc.0 / 2021-08-11

Expand Down
2 changes: 2 additions & 0 deletions tempodb/compactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"io"
"runtime"
"sort"
"strconv"
"time"
Expand Down Expand Up @@ -211,6 +212,7 @@ func (rw *readerWriter) compact(blockMetas []*backend.BlockMeta, tenantID string

// write partial block
if currentBlock.CurrentBufferLength() >= int(rw.compactorCfg.FlushSizeBytes) {
runtime.GC()
tracker, err = appendBlock(rw, tracker, currentBlock)
if err != nil {
return errors.Wrap(err, "error writing partial block")
Expand Down

0 comments on commit e586b33

Please sign in to comment.