Hi Eric,

Thanks a lot for your reply.
I think that in our case the "repeated" solution would be fine because the 
client must have received all the data before processing them.

Julien


Le vendredi 31 mars 2017 18:13:13 UTC+2, Eric Gribkoff a écrit :
>
> There are tradeoffs with either approach. The repeated field approach is 
> akin to batching, and requires all of the messages to be prepared by the 
> server before any are sent, and the entire set of messages to be received 
> by the client before doing any processing, increasing latency. On the other 
> hand, if the repeated fields are highly compressible as a batch, sending 
> them all as a single message will allow gRPC's per-message compression to 
> reduce the message size (gRPC streaming compression is work in progress, 
> and would allow the stream approach to also benefit from compression across 
> multiple messages).
>
> In general, if your use case would allow the client to process the 
> incoming messages one at a time, the stream is the better choice. If your 
> client will just be blocking until all of the messages arrive and then 
> processing them in aggregate, the repeated field may be appropriate, but 
> even in this scenario the stream would work just as well, except for losing 
> some potential compressibility.
>
> Eric
>
> On Fri, Mar 31, 2017 at 8:39 AM, 'Julien' via grpc.io <
> [email protected] <javascript:>> wrote:
>
>> Hello.
>>
>> I need to get a list of messages from server to client.
>> I see two possible ways to implement this:
>> 1.
>>   - define the message
>>   - define a service with a function which returns a stream of the message
>>
>> 2.  
>>   - define the message
>>   - define a second message with a repeated field of the first message
>>   - define a service with a function which returns the second message
>>
>> Here is an example:
>>
>> syntax = "proto3";
>>
>> import "google/protobuf/empty.proto";
>>
>> message Dummy {
>>   string foo = 1;
>>   string bar = 2;
>> }
>>
>> message DummyList {
>>   repeated Dummy dummy = 1;
>> }
>>
>> service DummyService {
>>   rpc getDummyListWithStream(google.protobuf.Empty) returns (stream Dummy
>> ) {}
>>   rpc getDummyListWithRepeated(google.protobuf.Empty) returns (DummyList) 
>> {}
>> }
>>
>>
>> What is the most efficient way to implement this? 
>> getDummyListWithStream or getDummyListWithRepeated?
>> Note: client and server are both written in C++.
>>
>> Thanks.
>>
>> Julien
>>
>> -- 
>> 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] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/grpc-io.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/grpc-io/b8e554c0-c1c3-4877-b1ad-082e1945ad83%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/grpc-io/b8e554c0-c1c3-4877-b1ad-082e1945ad83%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/191bf1d9-7b14-42bf-b71a-1c68c69427fc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to