benchmarks: add flag to benchmain to use bufconn instead of network (#1837)

This will allow us to focus on grpc internals in profiling by excluding the cost of syscalls, which is a significant part of our time spent.
This commit is contained in:
dfawley
2018-02-15 14:52:38 -08:00
committed by GitHub
parent 3926816d54
commit 46fd263cc8
4 changed files with 92 additions and 43 deletions

View File

@ -44,7 +44,12 @@ func main() {
grpclog.Fatalf("Failed to serve: %v", err)
}
}()
addr, stopper := benchmark.StartServer(benchmark.ServerInfo{Addr: ":0", Type: "protobuf"}) // listen on all interfaces
lis, err := net.Listen("tcp", "localhost:0")
if err != nil {
grpclog.Fatalf("Failed to listen: %v", err)
}
addr := lis.Addr().String()
stopper := benchmark.StartServer(benchmark.ServerInfo{Type: "protobuf", Listener: lis}) // listen on all interfaces
grpclog.Println("Server Address: ", addr)
<-time.After(time.Duration(*duration) * time.Second)
stopper()