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

benchmark: wire in new gzip compressor #7486

Merged
merged 3 commits into from
Aug 13, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions benchmark/benchmain/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import (
"google.golang.org/grpc/benchmark/latency"
"google.golang.org/grpc/benchmark/stats"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/encoding/gzip"
"google.golang.org/grpc/experimental"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/internal"
Expand Down Expand Up @@ -128,10 +129,11 @@ const (
workloadsUnconstrained = "unconstrained"
workloadsAll = "all"
// Compression modes.
compModeOff = "off"
compModeGzip = "gzip"
compModeNop = "nop"
compModeAll = "all"
compModeOff = "off"
compModeGzip = "gzip"
PapaCharlie marked this conversation as resolved.
Show resolved Hide resolved
compModeGzipV2 = "gzipV2"
compModeNop = "nop"
compModeAll = "all"
// Toggle modes.
toggleModeOff = "off"
toggleModeOn = "on"
Expand All @@ -154,7 +156,7 @@ const (

var (
allWorkloads = []string{workloadsUnary, workloadsStreaming, workloadsUnconstrained, workloadsAll}
allCompModes = []string{compModeOff, compModeGzip, compModeNop, compModeAll}
allCompModes = []string{compModeOff, compModeGzip, compModeGzipV2, compModeNop, compModeAll}
allToggleModes = []string{toggleModeOff, toggleModeOn, toggleModeBoth}
allNetworkModes = []string{networkModeNone, networkModeLocal, networkModeLAN, networkModeWAN, networkLongHaul}
allRecvBufferPools = []string{recvBufferPoolNil, recvBufferPoolSimple, recvBufferPoolAll}
Expand Down Expand Up @@ -310,6 +312,11 @@ func makeClients(bf stats.Features) ([]testgrpc.BenchmarkServiceClient, func())
grpc.WithDecompressor(grpc.NewGZIPDecompressor()),
)
}
if bf.ModeCompressor == compModeGzipV2 {
opts = append(opts,
grpc.WithDefaultCallOptions(grpc.UseCompressor(gzip.Name)),
)
}
if bf.EnableKeepalive {
sopts = append(sopts,
grpc.KeepaliveParams(keepalive.ServerParameters{
Expand Down Expand Up @@ -875,10 +882,10 @@ func setToggleMode(val string) []bool {

func setCompressorMode(val string) []string {
switch val {
case compModeNop, compModeGzip, compModeOff:
case compModeNop, compModeGzip, compModeGzipV2, compModeOff:
return []string{val}
case compModeAll:
return []string{compModeNop, compModeGzip, compModeOff}
return []string{compModeNop, compModeGzip, compModeGzipV2, compModeOff}
default:
// This should never happen because a wrong value passed to this flag would
// be caught during flag.Parse().
Expand Down
Loading