Unfortunately, we don't currently have any support for this kind of zero-copy read on the receiving side. In the long run, we have some ideas about how we'd like to support this kind of thing, but we haven't had time to turn our attention to this yet, so we have no concrete plan or ETA yet. But I would expect that we will eventually add some APIs to support this kind of thing.
Note that gRPC does not provide any guarantee that received messages will show up in any particular chunk size. You may happen to be seeing 8192 bytes right now, but that's highly dependent upon the server application, the network, proxies, encryption software, and a bunch of other factors, so what you're seeing right now could change at any time. On Thu, Jun 16, 2022 at 10:58 PM Waqas Alam <[email protected]> wrote: > Hi, > I'm using C++ gRPC Serialization Trait to encode gRPC messages using zero > copy in gRPC unary API. Each message has a vector of buffers where each > buffer is passed to grpc::Slice and there is no need to copy the buffer. I > was wondering if there is something interesting I can do on the receive > side ? What I have observed is that gRPC doesn't keep any state for the > slices and data is received in chunks of size 8192 which is > GRPC_TCP_DEFAULT_READ_SLICE_SIZE. The issue I have is if total size of the > all the buffers in a message is greater than 8192 a buffer may overlap two > or more slices. This can happen for subsequent slices as well so currently > I have to copy all the slices into a single slice or copy the buffer which > extends over multiple slices. If there was a way to limit number of buffers > to a single slice they can share the underneath memory of a single slice > and also avoid the copy operation. Just curious if current gRPC API > provides such a capability. > > thanks > > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/grpc-io/5c5dbe60-6b22-48b8-b31d-8435f3117727n%40googlegroups.com > <https://groups.google.com/d/msgid/grpc-io/5c5dbe60-6b22-48b8-b31d-8435f3117727n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Mark D. Roth <[email protected]> Software Engineer Google, Inc. -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/CAJgPXp7qw7BeaMnU2C87nqPxqKwdQ2s%2BPcOOR3_UJ1Vc_USSgQ%40mail.gmail.com.
