The following link contains a detailed description of the issue: https://github.com/grpc/grpc-node/issues/2384
When a server receives multiple RPCs from a client, instead of sending back responses as it processes the requests, it seems to send back responses only after completing all the requests. This seems extremely strange to me, and I'm wondering if there is something wrong with my configuration.
I have an extremely minimal deployment. Following are relevant code snippets
proto file:
service Rewriter {
rpc Test(TestRequest) returns (TestResponse) {} // both arg and response contain a single string field
}
server.js registers a single RPC method
var _test = function () {
// multi second CPU computation
return { content: "test" };
};
var test = function (call, callback) {
callback(null, _test());
};
var server = new grpc.Server();
server.addService(rewriter.Rewriter.service, {
test: test,
});
server.bindAsync(
`0.0.0.0:1234`,
grpc.ServerCredentials.createInsecure(),
() => {
server.start();
}
client.js
var client = new rewriter.Rewriter(
"localhost:1234",
grpc.credentials.createInsecure()
);
client.test(callback) // called 10 times
The 10 callback for 10 client.test()
calls get fired only after server has processed all the 10 requests. I would expected each callback to be fired sequentially, as the server iteratively processes each request.