does it make sense to use zeromq on localhost? or it's better to use shared memory?
Asked Answered
C

3

5

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?

Cb answered 5/5, 2013 at 18:50 Comment(0)
R
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.

Relator answered 8/6, 2013 at 6:35 Comment(0)
S
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.

Subtangent answered 6/5, 2013 at 18:43 Comment(0)
R
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.

Relator answered 8/6, 2013 at 6:35 Comment(0)
A
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.

Actuary answered 18/11, 2018 at 7:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.