Open zeodtr opened 4 years ago
I'm sorry to tell you that this is not a surprising result. The @grpc/grpc-js
library is a lot less mature than the Java gRPC library, so we have done a lot less work to optimize it. That is in addition to whatever inherent differences there may be between the runtimes.
@murgatroid99 FYI, I have another throughput-related benchmark results (though I cannot disclose the source code, since the server-part code is not actually a benchmark code, but just a part of our software). It's as follows: (as above, longer is worse)
The rpc function is a server-streaming function that sends a stream of string array (like a DBMS select result).
Any news or updates on this one ?
Problem description
@grpc/grpc-js: Streaming throughput is about half of Java equivalent.
Reproduction steps
I've attached a ZIP file. Attachment: TestGrpc.zip The ZIP file includes the following programs.
The steps are as follows:
TestGrpc.zip
.NodeJS
directory, runnpm install
.node TestGrpcServer.js
on one command window.node TestGrpcClient.js
on the other command window and wait. In about 30 seconds, result will be shown.File -> New -> Project from Existing Sources...
, openJava/TestGrpcClient/pom.xml
.Add Configuration...
. InRun/Debug Configurations
, add anApplication
configuration, withMain class:
setting tocom.example.TestGrpcClient.TestGrpcClientApplication
.On my windows 10 PC and a linux machine, Node.js grpc client took about 26 seconds to receive 10,000,000 strings. Java grpc client took about 16 seconds to receive 10,000,000 strings.
It was somewhat unexpected that the Node.js version is about twice as slow as the Java version regarding the streaming throughput. In my application, the throughput is very important, so this is a show-stopper for me. Can I improve this situation with some option tweaking?
Environment
grpc
packages was even slower than @grpc/grpc-js)Additional context
None.