Skip to content

Commit

Permalink
Run all benchmarks. (#4742)
Browse files Browse the repository at this point in the history
* Run all benchmarks.

* Start debugging memchunk benchmark.

* Do not iterate when closed.

* Pass default tenant config.

* Set default limits.

* Fix two more benchmarks.

* Enable cron trigger again.
  • Loading branch information
jeschkies committed Nov 17, 2021
1 parent 628747e commit 5ece938
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .drone/drone.jsonnet
Expand Up @@ -337,13 +337,13 @@ local manifest(apps) = pipeline('manifest') {
},
node: { type: 'no-parallel' },
steps: [
run('LogQL', ['go test -mod=vendor -bench=Benchmark -benchtime 20x -timeout 120m ./pkg/logql/'])
run('All', ['go test -mod=vendor -bench=Benchmark -benchtime 20x -timeout 120m ./pkg/...']),
],
trigger: {
event: {
include: ['cron'],
},
cron+: {
cron: {
include: ['loki-bench'],
},
},
Expand Down
6 changes: 3 additions & 3 deletions .drone/drone.yml
Expand Up @@ -66,9 +66,9 @@ node:
type: no-parallel
steps:
- commands:
- go test -mod=vendor -bench=Benchmark -benchtime 20x -timeout 120m ./pkg/logql/
- go test -mod=vendor -bench=Benchmark -benchtime 20x -timeout 120m ./pkg/...
image: grafana/loki-build-image:0.18.0
name: LogQL
name: All
trigger:
cron:
include:
Expand Down Expand Up @@ -1004,6 +1004,6 @@ kind: secret
name: deploy_config
---
kind: signature
hmac: f6b69b7568765a77ee58c8db118be08c1db77953b9facb117c7849bcbc94d4f1
hmac: 3d6580e7a97cbdc40b5185fdb0a9e2011fb92ad9ff3bc393a577b1306abc8bc4

...
4 changes: 4 additions & 0 deletions pkg/chunkenc/memchunk.go
Expand Up @@ -1129,6 +1129,10 @@ func newBufferedIterator(ctx context.Context, pool ReaderPool, b []byte) *buffer
}

func (si *bufferedIterator) Next() bool {
if si.closed {
return false
}

if !si.closed && si.reader == nil {
// initialize reader now, hopefully reusing one of the previous readers
si.reader = si.pool.GetReader(bytes.NewBuffer(si.origBytes))
Expand Down
8 changes: 2 additions & 6 deletions pkg/ingester/checkpoint_test.go
Expand Up @@ -500,16 +500,12 @@ func Benchmark_SeriesIterator(b *testing.B) {
streams := buildStreams()
instances := make([]*instance, 10)

limits, err := validation.NewOverrides(validation.Limits{
MaxLocalStreamsPerUser: 1000,
IngestionRateMB: 1e4,
IngestionBurstSizeMB: 1e4,
}, nil)
limits, err := validation.NewOverrides(defaultLimitsTestConfig(), nil)
require.NoError(b, err)
limiter := NewLimiter(limits, NilMetrics, &ringCountMock{count: 1}, 1)

for i := range instances {
inst := newInstance(defaultConfig(), fmt.Sprintf("instance %d", i), limiter, nil, noopWAL{}, NilMetrics, nil, nil)
inst := newInstance(defaultConfig(), fmt.Sprintf("instance %d", i), limiter, runtime.DefaultTenantConfigs(), noopWAL{}, NilMetrics, nil, nil)

require.NoError(b,
inst.Push(context.Background(), &logproto.PushRequest{
Expand Down
2 changes: 1 addition & 1 deletion pkg/ingester/instance_test.go
Expand Up @@ -296,7 +296,7 @@ func Benchmark_PushInstance(b *testing.B) {
require.NoError(b, err)
limiter := NewLimiter(limits, NilMetrics, &ringCountMock{count: 1}, 1)

i := newInstance(&Config{}, "test", limiter, loki_runtime.DefaultTenantConfigs(), noopWAL{}, NilMetrics, &OnceSwitch{}, nil)
i := newInstance(&Config{IndexShards: 1}, "test", limiter, loki_runtime.DefaultTenantConfigs(), noopWAL{}, NilMetrics, &OnceSwitch{}, nil)
ctx := context.Background()

for n := 0; n < b.N; n++ {
Expand Down
2 changes: 1 addition & 1 deletion pkg/ingester/stream_test.go
Expand Up @@ -406,7 +406,7 @@ func Benchmark_PushStream(b *testing.B) {
require.NoError(b, err)
limiter := NewLimiter(limits, NilMetrics, &ringCountMock{count: 1}, 1)

s := newStream(&Config{}, limiter, "fake", model.Fingerprint(0), ls, true, NilMetrics)
s := newStream(&Config{MaxChunkAge: 24 * time.Hour}, limiter, "fake", model.Fingerprint(0), ls, true, NilMetrics)
t, err := newTailer("foo", `{namespace="loki-dev"}`, &fakeTailServer{})
require.NoError(b, err)

Expand Down
2 changes: 0 additions & 2 deletions pkg/iter/entry_iterator.go
Expand Up @@ -379,7 +379,6 @@ func (i *queryClientIterator) Close() error {

type nonOverlappingIterator struct {
labels string
i int
iterators []EntryIterator
curr EntryIterator
}
Expand All @@ -403,7 +402,6 @@ func (i *nonOverlappingIterator) Next() bool {
if i.curr != nil {
i.curr.Close()
}
i.i++
i.curr, i.iterators = i.iterators[0], i.iterators[1:]
}

Expand Down

0 comments on commit 5ece938

Please sign in to comment.