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.
Asked
Active
Viewed 3,089 times
2 Answers
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
-
I am using python on my server side. Ideally what I want is the number of messages currently sitting in the channel queue. – surya Apr 16 '19 at 18:45
-
My answer was for grpc-java. I don't know the answer for grpc-python. – Eric Anderson Apr 16 '19 at 20:41
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