As I have read from this link about max_workers and maximum_concurrent_rpcs. It is seems that when I set max_workers to 1 and maximum_concurrent_rpcs to 1000 it should response to RPC methods ASAP.

My server code slurp:

self.server = grpc.server(futures.ThreadPoolExecutor(max_workers=1), maximum_concurrent_rpcs=1000)
self.server.add_insecure_port('{}:{}'.format(host, port))

And I have an RPC method that I sleep for 2 seconds and then returns the result. The problem I have is that server waits for the first method to get served and then returns the result for the second (waits 2 second after first method returns response). It seems that it returns results synchronously.

The interesting part is that when I increase max_workers to 2 or 3, server responds asynchronously. Why this behavior is like this?


put on hold as off-topic by πάντα ῥεῖ, Heslacher, dfhwze, Toby Speight, t3chb0t Aug 14 at 10:39

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – πάντα ῥεῖ, Heslacher, dfhwze, t3chb0t
If this question can be reworded to fit the rules in the help center, please edit the question.

Browse other questions tagged or ask your own question.