[zeromq-dev] A simple Request-Reply architecture is much slower than expected.

crocket crockabiscuit at gmail.com
Sat Apr 13 04:19:18 CEST 2013


There is "Double Read(String name)" method, and it takes 50~60ms to call
Read() 1000 times.

I made two message queues that are basically a wrapper around that method.

(Java Client)DEALER <-----> ROUTER <-----> Read()


I expected the following code to take within 70ms to read 1000 times, but
it took 250~410ms.

long start=getTimeInMillis()
for(int i=0; i<1000; ++i)
  reader.send(name+i)

for(int i=0; i<1000; ++i)
  reader.recv()
long end=getTimeInMillis()

System.out.println("Milliseconds taken to read 1000 times : " + (end-start))

I utilized asynchronous send and recv, but I guess it was slow because
ROUTER used a strict requst-reply pattern.

I read zguide, and "Figure 38 - Detail of Asynchronous Server" inspired me
to make a variant.

Java Client <----> DEALER <-----> ROUTER|Proxy|DEALER <----->
DEALER <-----> Read()
It's simply an asynchronous server with only one worker.

Would it bring about the speedup that I wish for?

Please join this thread.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130413/cbd58a49/attachment.htm>


More information about the zeromq-dev mailing list