Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NetMQ vs clrzmq

Tags:

zeromq

netmq

Months ago I was selecting .NET library to use for implementing ZeroMQ communication, and I was pretty confused with the fact that there are few libraries suggested at zeromq.org.

Meanwhile I've learned few things, so I'll share here. Someone may find this helpful. So let me ask myself:

What is the difference between NetMQ and clrzmq?

(Although I'll answer this myself, if anyone else has some experience on the subject - alternative answer is welcome!)

like image 839
Aleksandar Pesic Avatar asked Jul 31 '16 10:07

Aleksandar Pesic


2 Answers

The key difference between the two is in the approach:

  • CLRZMQ is binding project which actually uses libzmq library in background (it's a .NET wrapper for libzmq library);
  • NetMQ is .NET-native port of ZeroMQ, meaning that it does not wrap existing libzmq but rewrites it in pure C#.

Which one to use? Well, there's no simple answer. Here are few important things to keep in mind while choosing:

  • When it comes to portability - NetMQ wins by far, especially due to the fact that there's .NET Core version of NetMQ. Deployment is also easier with NetMQ - there are no native libraries to worry about (x64 / x86, etc.).
  • On the other side the fact that NetMQ actually rewrites everything is bit scary for me - there's always risk that something is not precisely mirrored from the original code, and that it may cause incompatibility with other ZeroMQ nodes. There's also question how fast NetMQ will implement new features from the original library.
  • Performances. At the moment I don't know which library wins in performances, but this is definitely thing to consider while choosing. libzmq should be significantly faster than any managed code, but in communication between CLRZMQ and libzmq marshaling has to take place, so I really can't predict which library will win in speed.

UPDATE: Another important advantage of NetMQ is support - You'll get the answer in up to day or two, and sometimes within hours.

UPDATE 2: A problem with poller implementation in NetMQ (described here) turned out to be show-stopper problem for NetMQ in my case. Due to this problem I've migrated my projects to CLRZMQ (I may change my mind down the road...) Nevertheless, talking about poller, there's one problem in CLRZMQ documentation you should be aware of, and it's described here

like image 160
Aleksandar Pesic Avatar answered Nov 01 '22 19:11

Aleksandar Pesic


According to Doron Somech:

http://somdoron.com/2013/03/introducing-netmq/

As of 2014 C# binding (CLRZMQ) is no longer maintained and NetMQ is the default choice for ZeroMQ and .Net.

It seems that:

https://github.com/zeromq/clrzmq4

replaced the original CLRZMQ project.

I'm using NetMQ and looking forward to contribute to the project.

P.S. I build same Pub-Sub scenario for NetMQ and native ZeroMQ and didn't find any performance difference. Great work, Doron!

like image 23
HMartyrossian Avatar answered Nov 01 '22 19:11

HMartyrossian