[zeromq-dev] Question about zeromq throughput benchmarks.

Alexander V Vershilov alexander.vershilov at gmail.com
Thu Mar 27 10:41:42 CET 2014


Hi,

I’m trying to write a small benchmark program using zeromq-4.0.4 that will
be used as a

prototype for higher level library. Test program creates a pair of
asynchronous sockets and

send a bunch of messages with no acknowledgement and a the end reads a
reply.


Surprisingly, this test program does not compare favourably with an
equivalent direct

implementation over TCP. I have the following timings for sending 10,000
messages of the

given size on the localhost:


packet   tcp   zmq       ratio

size                               zmq/tcp

(bytes)  (us)  (us)      (the smaller is better)

1        4597   4385         1.28
10       5505   4012       0.72

20       4507   3680       0.81

30       5672   4465       0.78

40       3949   7498       1.89

64       3795   4426       1.16

79       3785   4642       1.22

85       3753   7369       1.96
100      3789   7586      2.00
528      5547   8646      1.55
600      4695  13498     2.87
1000     5273  13378    2.53
1024     5489  15279    2.78
1360     5663  23681    4.18
2000     6633  31957    4.81
10000   25243 104826   4.15



Regardless that deviation is big (not represented in table) the general
ratio remains the same,

ZeroMQ is on par with tcp for small messages, and works much worse with
bigger one.


Both the small message and big message results are surprising to me. For
one, I would have

thought that any ZeroMQ overhead would be increasingly insignificant as one
scales up the

message size, yet these results seem to suggest the opposite. Second, I
would have thought

that ZeroMQ’s batching makes a huge difference in throughput, especially
when sending lots

of small messages. Yet I am seeing no case where ZeroMQ actually has better
throughput

than TCP. Mind, I am discussing *throughput* here, not *latency*, which I
do understand

can only be slightly worse in ZeroMQ as compared to TCP.


Is there something I am misunderstanding here? I have gone through several
`iterations of

my benchmarks, but perhaps you can point out any problem with it?

Also I wanted to ask about the best pattern for the following benchmarks.
This benchmark

is the core of another program where there are a  number of hosts that may
be connected with

“one-direction” connections, and sent asynchronous messages over that
connections, the only

requirement is that messages should not be lost (or thrown away due to
reach of the HWM)

or there should be a notification about missing messages, so library can
close connection and

notify user about problem.


At this time I’ve found that PUSH->PULL pattern works well here, however,
maybe it’s

possible to use some other pattern to reduce cost. Because with  PUSH->PULL
pattern on

each node I have to create 1 PULL socket, and N PUSH sockets (one per
remote host we are

connected to).


I hope that attached emails will be shown in mailing shown in maillist.


Thanks in advance.

---

Alexander Vershilov
mail-to: alexander.vershilov at tweag.io
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140327/24f9811f/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: c-tcp-throughput.c
Type: text/x-csrc
Size: 3608 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140327/24f9811f/attachment.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: c-zmq-throughput.c
Type: text/x-csrc
Size: 2272 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140327/24f9811f/attachment-0001.c>


More information about the zeromq-dev mailing list