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

Run all benchmarks. #4742

Merged
merged 9 commits into from Nov 17, 2021
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions .drone/drone.jsonnet
Expand Up @@ -336,14 +336,14 @@ 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'],
trigger: {
event: {
include: ['cron'],
},
cron+: {
include+: ['loki-bench'],
cron: {
include: ['loki-bench'],
},
},
},
Expand Down
6 changes: 3 additions & 3 deletions .drone/drone.yml
Expand Up @@ -62,9 +62,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 @@ -956,6 +956,6 @@ kind: secret
name: deploy_config
---
kind: signature
hmac: 51902a0ab9982aa73cf0151076af99808912bfd357dff8184f408d40cc70d140
hmac: e9bf0aa0f9949cfc7eda3e598970299f041f673a161b4e99c342e3af2b936022

...
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()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why are we closing the iterator here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Because we're done with it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah. I misread for i.curr == nil || !i.curr.Next() { } and though we were not done iterating. Thanks!

}
i.i++
i.curr, i.iterators = i.iterators[0], i.iterators[1:]
}

Expand Down