connectrpc / connect-go

The Go implementation of Connect: Protobuf RPC that works.
https://connectrpc.com
Apache License 2.0
2.76k stars 91 forks source link

Is there a benchmark compare with original gprc? #704

Closed longbai closed 4 months ago

longbai commented 4 months ago

I like this project, the code is elegant and easy to use. I want to use in my project, but I am not sure the performance better or worse than grpc. I test in my laptop with connect server grpc server grpc client

the args is -c 10000 -n 1000 grpc `/c0 -n 10000 -c 1000 2024/03/06 20:20:43 grpc_mclient.go:32: INFO : Servers: [127.0.0.1:8972]

2024/03/06 20:20:43 grpc_mclient.go:34: INFO : concurrency: 1000 requests per client: 10

2024/03/06 20:20:43 grpc_mclient.go:39: INFO : message size: 581 bytes

2024/03/06 20:20:43 grpc_mclient.go:91: INFO : took 366 ms for 10000 requests 2024/03/06 20:20:43 grpc_mclient.go:108: INFO : sent requests : 10000 2024/03/06 20:20:43 grpc_mclient.go:109: INFO : received requests : 10000 2024/03/06 20:20:43 grpc_mclient.go:110: INFO : received requests_OK : 10000 2024/03/06 20:20:43 grpc_mclient.go:111: INFO : throughput (TPS) : 27322 2024/03/06 20:20:43 grpc_mclient.go:112: INFO : mean: 14822371 ns, median: 12783500 ns, max: 75994000 ns, min: 137000 ns, p99: 61774500 ns 2024/03/06 20:20:43 grpc_mclient.go:113: INFO : mean: 14 ms, median: 12 ms, max: 75 ms, min: 0 ms, p99: 61 ms connect-grpc ./c0 -n 10000 -c 1000 2024/03/06 20:22:10 grpc_mclient.go:32: INFO : Servers: [127.0.0.1:8972]

2024/03/06 20:22:10 grpc_mclient.go:34: INFO : concurrency: 1000 requests per client: 10

2024/03/06 20:22:10 grpc_mclient.go:39: INFO : message size: 581 bytes

2024/03/06 20:22:11 grpc_mclient.go:91: INFO : took 580 ms for 10000 requests 2024/03/06 20:22:11 grpc_mclient.go:108: INFO : sent requests : 10000 2024/03/06 20:22:11 grpc_mclient.go:109: INFO : received requests : 10000 2024/03/06 20:22:11 grpc_mclient.go:110: INFO : received requests_OK : 10000 2024/03/06 20:22:11 grpc_mclient.go:111: INFO : throughput (TPS) : 17241 2024/03/06 20:22:11 grpc_mclient.go:112: INFO : mean: 26686250 ns, median: 23851500 ns, max: 144814000 ns, min: 245000 ns, p99: 126916500 ns 2024/03/06 20:22:11 grpc_mclient.go:113: INFO : mean: 26 ms, median: 23 ms, max: 144 ms, min: 0 ms, p99: 126 ms`

I am not sure the compare be useful.

So Is there an official benchmark to compare grpc and connect-rpc right?

Thank you for your project.

akshayjshah commented 4 months ago

In general, Connect is slightly slower than grpc-go: they use the same protobuf runtime, but Connect uses net/http instead of gRPC's partial implementation of HTTP/2.

The best community-maintained benchmark I know of is https://github.com/LesnyRumcajs/grpc_bench. I don't think anyone is maintaining it really actively, so it's probably using old versions of all the different frameworks.

The actual performance impact of switching from grpc-go to Connect depends a lot on your workload, the types of middleware and interceptors you need, and the types of clients you need to support. In some cases, grpc-go will be faster; in other cases, Connect will be faster.

longbai commented 4 months ago

Thank you very much.