4

I need to transfer financical data between two process (currently c++ and c#, in future c++ and c++ on Linux). It's live quotes - something like 1 100, 1 100.1, 2 101.2 end so on.). Data has well-defined format. Latency must be low. I'm choosing between zeromq and using shared memory myself. I have couple questions about zeromq:

  • will it be less buggy and easier to use zeromq instead of using shared memory myself?
  • if zeromq latency on localhost is comparable with the latency of shared memory?

I don't need to run my parts on different hosts or something like that. So I have one producer-one consumer pattern on localhost. I'm just not sure if I should use zeromq for such simple scenario, or probably i should just use shared memory and that's it?

4

3 回答 3

6

Shared memory is nasty and error prone, in my opinion. ZMQ is elegant. I would prefer the ZMQ route always.

If anything, ZMQ will be easier to set up than shared memory - not the other way around.

于 2013-05-06T18:43:52.450 回答
4

ZeroMQ could be faster than the shared memory because of its baked in buffering. The messaging patterns also provide a much more flexible way of approaching problems. As always, do your own tests and determine which you prefer.

I would expect the ZeroMQ version to be simpler long term.

于 2013-06-08T06:35:54.970 回答
0

ZMQ uses Linux Sockets for IPC. Last time I checked they were limited to passing 100K of data. So if you're passing larger amounts you'll need to use shared memory. The boost shared memory package works great, but I'm not familiar with bindings for it in other languages.

于 2018-11-18T07:35:57.577 回答