elixir-grpc / grpc

An Elixir implementation of gRPC
https://hex.pm/packages/grpc
Apache License 2.0
1.36k stars 210 forks source link

Performance issues with `Mint` adapter #307

Open beligante opened 1 year ago

beligante commented 1 year ago

Describe the bug There are some issues with the current implementation for mint adapter from a performance standpoint.

To Reproduce Easy way to see is In Interop tests script

If you wrap the runner with :timer.tc and run mix run script/run.exs --rounds 1 it's possible to see that the amount of time that Gun adapter takes to run all test cases vs Mint is quite different. On my machine the avg for both was:

With the numbers above it's possible to assume for sure that there are some performance improvements that needs to be done for Mint adapter.

Expected behavior Similar times for both adapters

Versions:

Additional context A few things that I could observer from the current implementation that could be better:

I'm open for investigate and fix this issue and also I'm quite open for suggestions.

polvalente commented 1 year ago

I'd look for a simpler script that benchmarks with Benchee so that things are more easily reproducible.

It could be the case that the Mint code is as fast as Gun when there's no concurrency. If this is the case, then it's a problem with process message serialization.

If even with minimal concurrency it's still much slower, then it's a matter of finding the bottleneck in the code.

beligante commented 1 year ago

Gotcha! I'll work on the script for Benchee (which - TIL about the lib) and see what are the results. Tks Paulo!