-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added benchmark, Moved minio-deps to fork without race fix we don't n…
- Loading branch information
Showing
5 changed files
with
63 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright (c) The Thanos Authors. | ||
// Licensed under the Apache License 2.0. | ||
|
||
package s3_test | ||
|
||
import ( | ||
"bytes" | ||
"context" | ||
"strings" | ||
"testing" | ||
|
||
"github.com/cortexproject/cortex/integration/e2e" | ||
e2edb "github.com/cortexproject/cortex/integration/e2e/db" | ||
"github.com/go-kit/kit/log" | ||
"github.com/thanos-io/thanos/pkg/objstore/s3" | ||
"github.com/thanos-io/thanos/test/e2e/e2ethanos" | ||
|
||
"github.com/thanos-io/thanos/pkg/testutil" | ||
) | ||
|
||
// Regression benchmark for https://github.com/thanos-io/thanos/issues/3917. | ||
func BenchmarkUpload(b *testing.B) { | ||
b.ReportAllocs() | ||
ctx := context.Background() | ||
|
||
s, err := e2e.NewScenario("e2e_bench_mino_client") | ||
testutil.Ok(b, err) | ||
b.Cleanup(e2ethanos.CleanScenario(b, s)) | ||
|
||
const bucket = "test" | ||
m := e2edb.NewMinio(8080, bucket) | ||
testutil.Ok(b, s.StartAndWaitReady(m)) | ||
|
||
bkt, err := s3.NewBucketWithConfig(log.NewNopLogger(), s3.Config{ | ||
Bucket: bucket, | ||
AccessKey: e2edb.MinioAccessKey, | ||
SecretKey: e2edb.MinioSecretKey, | ||
Endpoint: m.HTTPEndpoint(), | ||
Insecure: true, | ||
}, "test-feed") | ||
testutil.Ok(b, err) | ||
|
||
buf := bytes.Buffer{} | ||
buf.Grow(1028 * 1028 * 100) // 100MB. | ||
word := "abcdefghij" | ||
for i := 0; i < buf.Cap()/len(word); i++ { | ||
_, _ = buf.WriteString(word) | ||
} | ||
str := buf.String() | ||
|
||
b.ResetTimer() | ||
for i := 0; i < b.N; i++ { | ||
testutil.Ok(b, bkt.Upload(ctx, "test", strings.NewReader(str))) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters