5

GRPC server does queue the requests and serve them based on the maxWorker configuration which is passed when the sever starts up. How do I print the metric- number of items in the queue .? Essentially, I would like to keep track of the numbers of requests in waiting state.

surya
  • 171
  • 2
  • 12

2 Answers2

0

You can pass your own executor to serverBuilder.executor(). Note that you are then responsible for shutting down the executor service after the server has terminated.

Eric Anderson
  • 24,057
  • 5
  • 55
  • 76
0

The solution for grpc-python is similar to grpc-java. You can pass your customized future executor to the server constructor, and monitor the submission of task yourself.

gRPC Python API: grpc.server(thread_pool, ...)

The executor class to extend: concurrent.futures.ThreadPoolExecutor

Lidi Zheng
  • 1,801
  • 8
  • 13