[zeromq-dev] tcp vs zeromq

ashwini ramamurthy ashwini.ram21 at gmail.com
Mon Jul 15 17:28:40 CEST 2013


Hi,

Like it was suggested , i am now combining req/rep(later will shift to
dealer/router) and pub/sub . The client sends messages to the server and
the server publishes this information to some other clients who have
subscribed.

To use multiple sockets i followed the suggestions on this page
http://stackoverflow.com/questions/6717874/combining-pub-sub-with-req-rep-in-zeromq
and
used zmq_poll . My server polls on req socket and pub socket.

While writing the code and the above post in stackoverflow i guessed that
my pub socket will never get polledin and that's what i am observing now.
Only my request is polled in and publish is not happening at all.

How do i fix this problem?

Thanks,
Ashwini



On Fri, Jul 12, 2013 at 9:32 PM, Bennie Kloosteman <bklooste at gmail.com>wrote:

> If you run it without a network stack zeromq can be very fast  so its not
> so much the protocol. You can see this in the tests but note in those cases
> zeromq is using C++.  For lots of small messages < 100 bytes zeroMq does
> need a lot more cpu than tcp but that is not a common scenario.
>
> There is also a cost for Java... Both C# and Java are GC languages so need
> to copy  packets to and from  zeromq , the Java tcp stack is likely to
>  have optmizations to reduce this significantly ( while the zeromq java and
> C# wrappers are minimal last time i looked at them) . If zeromq was in the
> kernel this could be reduced but right now it has a cost eg Kernel copy to
> C++ user space copied to Java  GC space.     If i was using zeromq  and
> found after building the system i needed faster  speeds  I would use async
> and than i would rewrite that part of the system in C++   and pass a
> "fixed" pointer to the packet when needed rather than copying everything
> into the GC space and then copying it into the logic domain.
>
>
> On Sat, Jul 13, 2013 at 1:51 AM, ashwini ramamurthy <
> ashwini.ram21 at gmail.com> wrote:
>
>> Hi All,
>>
>> To compare the performance of zeromq and tcp  I did the following
>> experiment
>>
>>
>>
>> *Experimental setup for zeromq *
>>
>>    -  android client(Motorola razr) which runs jeromq.
>>    -  java server(PC running Linux) which runs java binding of zeromq
>>    -  Using the REQUEST-REPLY messaging pattern
>>    - Sending 100/1000 messages to the server and 100/1000 messages to
>>    client (synchronous)
>>    - The client sends a hello message and waits for a reply from the
>>    server to send another message(ping-pong)
>>    - The server waits for a message and replies with a hello for every
>>    message sent
>>    - Both the devices were connected through wifi
>>    - *On an avg:For 100 messages the time taken was 937 msec*
>>    - *On an avg:For 1000 messages the time taken was 8270 msec*
>>
>> *Experimental setup for TCP*
>>
>>    - android client (Motorola razr)
>>    - java server (PC running Linux)
>>    - Using a REQ-REP pattern(ping-pong)
>>    - Sending 100/1000 messages to the server and 100/1000 back to
>>    client(synchronous)
>>    - Same as above, client sends a hello message to server and waits to
>>    receive a world message before sending the next message.
>>    - Both the devices were connected through wifi
>>    - *On an avg:For 100 messages the time taken was 504 msec*
>>    - *On an avg:For 1000 messages the time taken was 5240 msec*
>>
>> Is this excepted? or am i missing something or doing something wrong?
>>
>>
>>
>> Thanks,
>>
>> Ashwini
>>
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>
>>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130715/d4be07e0/attachment.htm>


More information about the zeromq-dev mailing list