Re: [grpc-io] Streamed ve non Streamed services speed

2018-01-04 Thread marcbegemot
thank you so much now it makes perfect sense 

-- 
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 post to this group, send email to grpc-io@googlegroups.com.
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/b1875421-0775-440c-98af-ac897ae8d76d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[grpc-io] Streamed ve non Streamed services speed

2017-12-24 Thread marcbegemot
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 5 
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 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to grpc-io+unsubscr...@googlegroups.com.
To post to this group, send email to grpc-io@googlegroups.com.
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/df0037bb-252c-4887-b3eb-77d19eda04a3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.