Modify comments
This commit is contained in:
@ -91,7 +91,8 @@ func setupClientEnv(config *testpb.ClientConfig) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// createConns creates connections according to given config.
|
// createConns creates connections according to given config.
|
||||||
// It returns a slice of connections created, the function to close all connections, and errors if any.
|
// It returns the connections and corresponding function to close them.
|
||||||
|
// It returns non-nil error if there is anything wrong.
|
||||||
func createConns(config *testpb.ClientConfig) ([]*grpc.ClientConn, func(), error) {
|
func createConns(config *testpb.ClientConfig) ([]*grpc.ClientConn, func(), error) {
|
||||||
var opts []grpc.DialOption
|
var opts []grpc.DialOption
|
||||||
|
|
||||||
@ -222,7 +223,6 @@ func (bc *benchmarkClient) doCloseLoopUnary(conns []*grpc.ClientConn, rpcCountPe
|
|||||||
for _, conn := range conns {
|
for _, conn := range conns {
|
||||||
client := testpb.NewBenchmarkServiceClient(conn)
|
client := testpb.NewBenchmarkServiceClient(conn)
|
||||||
// For each connection, create rpcCountPerConn goroutines to do rpc.
|
// For each connection, create rpcCountPerConn goroutines to do rpc.
|
||||||
// Close this connection after all goroutines finish.
|
|
||||||
for j := 0; j < rpcCountPerConn; j++ {
|
for j := 0; j < rpcCountPerConn; j++ {
|
||||||
go func() {
|
go func() {
|
||||||
// TODO: do warm up if necessary.
|
// TODO: do warm up if necessary.
|
||||||
@ -269,7 +269,6 @@ func (bc *benchmarkClient) doCloseLoopStreaming(conns []*grpc.ClientConn, rpcCou
|
|||||||
}
|
}
|
||||||
for _, conn := range conns {
|
for _, conn := range conns {
|
||||||
// For each connection, create rpcCountPerConn goroutines to do rpc.
|
// For each connection, create rpcCountPerConn goroutines to do rpc.
|
||||||
// Close this connection after all goroutines finish.
|
|
||||||
for j := 0; j < rpcCountPerConn; j++ {
|
for j := 0; j < rpcCountPerConn; j++ {
|
||||||
c := testpb.NewBenchmarkServiceClient(conn)
|
c := testpb.NewBenchmarkServiceClient(conn)
|
||||||
stream, err := c.StreamingCall(context.Background())
|
stream, err := c.StreamingCall(context.Background())
|
||||||
|
@ -140,7 +140,7 @@ func startBenchmarkServer(config *testpb.ServerConfig, serverPort int) (*benchma
|
|||||||
return nil, grpc.Errorf(codes.InvalidArgument, "unknow payload config: %v", config.PayloadConfig)
|
return nil, grpc.Errorf(codes.InvalidArgument, "unknow payload config: %v", config.PayloadConfig)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Start protobuf server is payload config is nil.
|
// Start protobuf server if payload config is nil.
|
||||||
addr, closeFunc = benchmark.StartServer(benchmark.ServerInfo{
|
addr, closeFunc = benchmark.StartServer(benchmark.ServerInfo{
|
||||||
Addr: ":" + strconv.Itoa(port),
|
Addr: ":" + strconv.Itoa(port),
|
||||||
Type: "protobuf",
|
Type: "protobuf",
|
||||||
|
@ -229,6 +229,8 @@ func main() {
|
|||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
<-stop
|
<-stop
|
||||||
|
// Wait for 1 second before stopping the server to make sure the return value of QuitWorker is sent to client.
|
||||||
|
// TODO revise this once server graceful stop is supported in gRPC.
|
||||||
time.Sleep(time.Second)
|
time.Sleep(time.Second)
|
||||||
s.Stop()
|
s.Stop()
|
||||||
}()
|
}()
|
||||||
|
Reference in New Issue
Block a user