I'm trivially inserting n to a db throug a grpc server
 When I use the non streamed version I have to call the stub n times and 
got n calls to my observer , whereas when I use the stream I just call the 
stub once and call the request observer n times for onNext(E).
 Aparently the streamed version should be faster but for 2000 records 12 
seconds/non stream and 2 min abd 31 seconds /streamed version   for 50000 
records 1min 28sec /non stream  64min 47seconds

>From the server side you notice that the records are inserted not in order 
showing off an asyncronous behaviour in the non streamed case, and 
perfectly ordered in the streamed case.

Is that the expected behaviour, so calls to stream are syncronically 
treated, and the non streamed asyncronouslly (at server side)?

The code below ilustrates the issue but it's only a draft 
Thank you


 
service kgrpcServer{
   rpc addE1(E) returns(newId){}
   rpc addE2(stream E) returns(newId){}
}





  val e =E.newBuilder()
  val limit=51000
  val cnt=CountDownLatch(1)   //=1 for streamed version  =limit for non 
streamed version
  SX1.cnt=cnt                 <--The stream observer with a lach on it 

  for(n in 0..limit-1) {
      print("\r"+n)
      e.t1 = "second"
      e.t2 = n.toString()
      EXP.addE2(e.build())           <--EXP a facade to make the rpccalls 
either streamed non streamed, in the server side a database register will be 
created for each call
      Thread.sleep(1)
  }
  
  cnt.await()
  
  EXP.end()   <--- Close conection 

  println("All done")


-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" 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/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to