modified the comments and format
This commit is contained in:
Родитель
149db4945c
Коммит
b6a930aea4
|
@ -129,10 +129,10 @@ func DoStreamingRoundTrip(tc testpb.TestServiceClient, stream testpb.TestService
|
||||||
Payload: pl,
|
Payload: pl,
|
||||||
}
|
}
|
||||||
if err := stream.Send(req); err != nil {
|
if err := stream.Send(req); err != nil {
|
||||||
grpclog.Fatalf("%v.StreamingCall(_)=_, %v: ", tc, err)
|
grpclog.Fatalf("%v.StreamingCall(_) = _, %v: ", tc, err)
|
||||||
}
|
}
|
||||||
if _, err := stream.Recv(); err != nil {
|
if _, err := stream.Recv(); err != nil {
|
||||||
grpclog.Fatal("%v.StreamingCall(_)=_, %v: ", tc, err)
|
grpclog.Fatal("%v.StreamingCall(_) = _, %v: ", tc, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ func runStream(b *testing.B, maxConcurrentCalls int) {
|
||||||
tc := testpb.NewTestServiceClient(conn)
|
tc := testpb.NewTestServiceClient(conn)
|
||||||
stream, err := tc.StreamingCall(context.Background())
|
stream, err := tc.StreamingCall(context.Background())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
grpclog.Fatalf("%v.StreamingCall(_)=_,%v: ", tc, err)
|
grpclog.Fatalf("%v.StreamingCall(_) = _,%v: ", tc, err)
|
||||||
}
|
}
|
||||||
// Warm up connection.
|
// Warm up connection.
|
||||||
for i := 0; i < 10; i++ {
|
for i := 0; i < 10; i++ {
|
||||||
|
|
|
@ -21,7 +21,10 @@ var (
|
||||||
server = flag.String("server", "", "The server address")
|
server = flag.String("server", "", "The server address")
|
||||||
maxConcurrentRPCs = flag.Int("max_concurrent_rpcs", 1, "The max number of concurrent RPCs")
|
maxConcurrentRPCs = flag.Int("max_concurrent_rpcs", 1, "The max number of concurrent RPCs")
|
||||||
duration = flag.Int("duration", math.MaxInt32, "The duration in seconds to run the benchmark client")
|
duration = flag.Int("duration", math.MaxInt32, "The duration in seconds to run the benchmark client")
|
||||||
rpcType = flag.Int("rpc_type", 0, "client rpc type")
|
rpcType = flag.Int("rpc_type", 0,
|
||||||
|
`Configure different client rpc type. Valid options are:
|
||||||
|
0 : unary call;
|
||||||
|
1 : streaming call.`)
|
||||||
)
|
)
|
||||||
|
|
||||||
func unaryCaller(client testpb.TestServiceClient) {
|
func unaryCaller(client testpb.TestServiceClient) {
|
||||||
|
@ -91,7 +94,7 @@ func closeLoopStream() {
|
||||||
s, conn, tc := buildConnection()
|
s, conn, tc := buildConnection()
|
||||||
stream, err := tc.StreamingCall(context.Background())
|
stream, err := tc.StreamingCall(context.Background())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
grpclog.Fatalf("%v.StreamingCall(_)=_,%v: ", tc, err)
|
grpclog.Fatalf("%v.StreamingCall(_) = _,%v: ", tc, err)
|
||||||
}
|
}
|
||||||
for i := 0; i < 100; i++ {
|
for i := 0; i < 100; i++ {
|
||||||
streamCaller(tc, stream)
|
streamCaller(tc, stream)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче