Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve ingester flush memory usage. #3200

Merged
merged 12 commits into from
Jan 21, 2021

Conversation

cyriltovena
Copy link
Contributor

This builds on #3193.

And re-use memory buffer when flushing chunks.

❯ benchcmp  before.txt after.txt
benchmark                  old ns/op     new ns/op     delta
Benchmark_FlushLoop-16     104723243     9233780       -91.18%

benchmark                  old allocs     new allocs     delta
Benchmark_FlushLoop-16     1115           568            -49.06%

benchmark                  old bytes     new bytes     delta
Benchmark_FlushLoop-16     241857243     989590        -99.59%

I need to rebase once we have #3193 this will ease review.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
```
goos: darwin
goarch: amd64
pkg: github.com/grafana/loki/pkg/ingester
Benchmark_FlushLoop-16    	      16	  70040359 ns/op	241901661 B/op	    1112 allocs/op
PASS
ok  	github.com/grafana/loki/pkg/ingester	4.829s
```

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
benchcmp

```
❯ benchcmp  before.txt after.txt
benchmark                  old ns/op     new ns/op     delta
Benchmark_FlushLoop-16     104723243     9233780       -91.18%

benchmark                  old allocs     new allocs     delta
Benchmark_FlushLoop-16     1115           568            -49.06%

benchmark                  old bytes     new bytes     delta
Benchmark_FlushLoop-16     241857243     989590        -99.59%
```

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Copy link
Contributor

@sandeepsukhani sandeepsukhani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@codecov-io
Copy link

Codecov Report

Merging #3200 (68aa00d) into master (07ece2b) will decrease coverage by 0.04%.
The diff coverage is 91.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3200      +/-   ##
==========================================
- Coverage   63.23%   63.18%   -0.05%     
==========================================
  Files         195      195              
  Lines       16637    16643       +6     
==========================================
- Hits        10520    10516       -4     
- Misses       5165     5177      +12     
+ Partials      952      950       -2     
Impacted Files Coverage Δ
pkg/ingester/flush.go 82.46% <90.00%> (+0.71%) ⬆️
pkg/ingester/checkpoint.go 72.62% <100.00%> (ø)
pkg/promtail/positions/positions.go 46.80% <0.00%> (-11.71%) ⬇️
pkg/logql/evaluator.go 89.87% <0.00%> (-0.36%) ⬇️
pkg/promtail/targets/file/filetarget.go 66.89% <0.00%> (+2.06%) ⬆️

@cyriltovena cyriltovena merged commit ea488f9 into grafana:master Jan 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants