Skip to content

Commit

Permalink
Add benchmark for compression
Browse files Browse the repository at this point in the history
  • Loading branch information
camdencheek committed Aug 12, 2020
1 parent aa87954 commit 29ffc00
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions operator/builtin/output/google_cloud_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,9 @@ func startServer() (*grpc.ClientConn, chan *logpb.WriteLogEntriesRequest, func()
}

type googleCloudOutputBenchmark struct {
name string
entry *entry.Entry
name string
entry *entry.Entry
configMod func(*GoogleCloudOutputConfig)
}

func (g *googleCloudOutputBenchmark) Run(b *testing.B) {
Expand All @@ -306,6 +307,9 @@ func (g *googleCloudOutputBenchmark) Run(b *testing.B) {

cfg := NewGoogleCloudOutputConfig(g.name)
cfg.ProjectID = "test_project_id"
if g.configMod != nil {
g.configMod(cfg)
}
op, err := cfg.Build(testutil.NewBuildContext(b))
require.NoError(b, err)
op.(*GoogleCloudOutput).client = client
Expand Down Expand Up @@ -345,27 +349,31 @@ func BenchmarkGoogleCloudOutput(b *testing.B) {
Timestamp: t,
Record: "test",
},
nil,
},
{
"MapRecord",
&entry.Entry{
Timestamp: t,
Record: mapOfSize(1, 0),
},
nil,
},
{
"LargeMapRecord",
&entry.Entry{
Timestamp: t,
Record: mapOfSize(30, 0),
},
nil,
},
{
"DeepMapRecord",
&entry.Entry{
Timestamp: t,
Record: mapOfSize(1, 10),
},
nil,
},
{
"Labels",
Expand All @@ -376,6 +384,17 @@ func BenchmarkGoogleCloudOutput(b *testing.B) {
"test": "val",
},
},
nil,
},
{
"Compression",
&entry.Entry{
Timestamp: t,
Record: "compressiblecompressiblecompressiblecompressiblecompressiblecompressiblecompressible",
},
func(cfg *GoogleCloudOutputConfig) {
cfg.UseCompression = true
},
},
}

Expand Down

0 comments on commit 29ffc00

Please sign in to comment.