Thank you Richard for your answer. Our max payload size going through grpc.aio.UnaryUnaryCall is ~20MB . It does not seem crazy big for serializing or deserializing steps, but with many simultaneous requests, could that add up ?
We'll look at doing some more ad-hoc measurements to determine the source of the blocking. Thanks Le mercredi 22 février 2023 à 10:16:25 UTC-8, Richard Belleville a écrit : > > Does it yield to the event loop while reading data > > It absolutely should be > <https://github.com/grpc/grpc/blob/e41e41e209d395b04b755af15cc36448fe6fb06b/src/python/grpcio/grpc/aio/_call.py#L517> > > and if it's not, then we would consider it a bug. I will note that > deserializing > the protobuf > <https://github.com/grpc/grpc/blob/e41e41e209d395b04b755af15cc36448fe6fb06b/src/python/grpcio/grpc/aio/_call.py#L524> > > is a blocking operation, so a very complex proto (or simply a very big one, > where a copy takes a long time) could explain the issue you're seeing. > > > Do we have to use grpc.aio.UnaryStreamCall to read() and yield > periodically? > > If the issue is the deserialization time, then I would expect this to help. > > Any chance you can do a little ad-hoc measurement to determine what the > source of the blocking is? If this is a common problem, I suppose we could > do a native thread offload for protobuf serialization where we release the > GIL, do the deserialization in native code, and provide an async def > deserialization method. > On Thursday, February 16, 2023 at 10:18:55 AM UTC-8 Charles Chan wrote: > >> Hello, >> >> We are using Python 3 to implement a HTTP server using asyncio, the HTTP >> server initiates a grpc.aio.UnaryUnaryCall to the backend to retrieve a >> (large) file. We notice these requests seems to be block other requests on >> the asyncio server. >> >> How does grpc.aio.UnaryUnaryCall work underneath the covers? Does it >> yield to the event loop while reading data, in between every chunk of data? >> Do we have to use grpc.aio.UnaryStreamCall to read() and yield periodically? >> >> Thanks >> >> Note: I found another thread ( >> https://groups.google.com/g/grpc-io/c/r7thQeaAYYI/m/2s8qad9ZBAAJ) but it >> doesn't fully answer my question. >> > -- 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/d28ffa82-78c0-4bfc-b6f5-7a3ddf67357an%40googlegroups.com.