Hi, you're correct that channel should be created either during server 
start or during initialization, you can then pass the stub reference to 
server handler. As for the threads,  you can use thread_pool to control 
executors used by the 
server: 
https://github.com/grpc/grpc/blob/master/src/python/grpcio/grpc/__init__.py#L2030

Best,
Xuan

On Friday, January 27, 2023 at 9:12:38 AM UTC-8 Jens Troeger wrote:

> Hello,
>
> Suppose I have a Servicer A whose request handler needs to call another 
> Servicer B. Creating a channel and a stub every time A’s handler runs 
> doesn’t seem efficient or sensible.
>
> What’s the suggested/proper way to chain gRPC calls? (In Python, if that 
> matters.)
>
> Can I hook into the Servicer’s boot, open a channel and create a stub, and 
> then pass down that stub through the context? Is there some interceptor 
> support that’s useful?
>
> Which leads me to the next question: can I control how many threads and 
> processes a Servicer can spawn for request handling? I assume each of those 
> needs their own channel and stub to call to another Servicer?
>
> Much thanks!
> Jens
>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to grpc-io+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/b8e23730-5165-414c-a012-b70575f7ced4n%40googlegroups.com.

Reply via email to