7 ms·
ØMQ - The Guide
- antimora 11y agoJust recently I have found out that nanomsg is the successor of ZeroMQ. Does anyone have an opinion about this new lib? I am curious how mature and stable it's.
- aidenn0 11y agoThere's nothing as comprehensive as the ZMQ guide for documentation, but here[1] is a good place to get started. It seems fairly stable API wise at this point. I haven't used it much, since there's no way to switch from ZMQ without losing wire-protocol compatibility, and I haven't started any new projects that need IPC recently. 1: http://tim.dysinger.net/posts/2013-09-16-getting-started-with-nanomsg.html http://tim.dysinger.net/posts/2013-09-16-getting-started-wit...
- Cidan 11y agoI built our entire monitoring infrastructure on top of nanomsg and nodejs; previously I used zmq. Over the last 3 months, I've had absolutely no issues with a bit over 200 servers communicating with each other. Pretty cool stuff.
- stevekemp 11y agoI used nanomsg to have 20+ servers listening to queue from a single master. I found that over time the memory consumption would rise horridly and I had to stop using it. I've just had another sanity-check of my code and don't spot an obvious leak, but I'm willing to believe it is there: https://github.com/skx/nanoexec https://github.com/skx/nanoexec Otherwise though using nanomsg was a pleasure, and I have it in use elsewhere without problems.
- bmaeser 11y agoits actually not a successor, but a fork by one of zmq's core devs, Martin Sustrik. there is a writeup in the docs how nanomsg differ from zmq: http://nanomsg.org/documentation-zeromq.html http://nanomsg.org/documentation-zeromq.html
- PieterH 11y agoNano is excellent in many ways, though it's not a successor, that's just bombast from its author. ZeroMQ is far more than a library. It is a large community and hundreds of projects, e.g. independent ZeroMQ versions in Java, .Net, C++, Erlang, C. Nano is one library and bindings. Take a look at the git repositories and the email list and you really see the significant differences. These aren't technical. They're why the ZeroMQ community merges pull requests rapidly, and products tend to be stable on master, while Nano has pull requests hanging for months, and isn't stable. Nano should have been compatible with ZeroMQ, then it would have been a successor and the protocols could have evolved over time to become what Sustrik wanted. Instead it tried to define itself by one-upping ZeroMQ, missing many opportunities. ZeroMQ has so much stuff built on top. Nano? So little. This is not accidental or random. The ZeroMQ community is welcoming to people, and every effort is welcome, unless it's really disruptive. Nano is just a the wrong side of hostile, arrogant, and insecure and it shows in the arguments on the mailing list (which we just don't get on zeromq-dev). Edit: by "not stable", I refer to its "0.5 beta" status, not any technical instability. The point being there is no guarantee of forward compatibility.
- cbetz 11y agoSmall correction: There is a pure Go implementation of nanomsg (https://github.com/gdamore/mangos https://github.com/gdamore/mangos).
- PieterH 11y agoAh, indeed, thank you. This is encouraging and I'd like to see more of this. We need spaces for experimentation and competition, and the more libraries attack this "NoBroker" space, the better. I do wish Nano would stand on its own merits rather than the cheap "why we're better than ZeroMQ" marketing. Also I'm somewhat disappointed that Sustrik isn't using Nano in his own new projects (like libmill). That's not a great vote of confidence.
- dragonwriter 11y ago> I do wish Nano would stand on its own merits rather than the cheap "why we're better than ZeroMQ" marketing. IIRC, 0MQ launched with quite a lot of "why we're better than AMQP" marketing.
- graffitici 11y agoThis is probably one of the finest documentations of all time. Doesn't just guide you through the features of ZeroMQ, but actually teaches you about the horrendously complicated task of programming distributed systems in an elegant way. Everybody should have a read!
- curiously 11y agoany real reason you should use zeromq over rabbitmq?
- zo1 11y agoZeroMQ (in certain configurations) is broker-less if I recall correctly. The clients connect to each other, rather than going through a broker. Last I checked, ZeroMQ is more of a "low-level" library/framework that provides easy-paths to more higher-level functionality that would be comparable with what you'd expect from a standard message queuing system. Anyone got a different take from it? I only did the tutorials quite a while back.
- jkarneges 11y agoYep, it's best to think of ZeroMQ as networking library than an "MQ". It makes communication between processes easier than writing BSD sockets code by hand. For example, the Mongrel2 web server uses ZeroMQ to drive backend handlers. You probably wouldn't dream of transporting HTTP requests and responses over a brokered message queue, but ZeroMQ is different since it's "just sockets".
- nawitus 11y agoYes, ZeroMQ is brokeless. However, you can implement a broker with ZeroMQ. In addition, it should be noted that ZeroMQ buffers messages when the connection is disconnected.
- glitcher 11y agoIn the Postface section one of the contributors writes: "We investigated different solutions to find something suitable for our needs. We tried different message brokers (RabbitMQ, ActiveMQ Apollo, Kafka), but failed to reach a low and predictable latency with any of them."
- chillydawg 11y agoIf micro (possibly nano) seconds matter, you can't use a broker system like rabbit. 0mq is a set of wrappers around tcp and udp and allow you to do network programming at extreme performance levels generally not available without a whole lot of mucking about.
- spotman 11y agoThe 0MQ guide is one of the best pieces of documentation ever written. I read it years ago and continue to refer to it periodically for both projects that I use 0MQ for, and projects I don't. It's simply a rad guide. Highly recommended.
- PieterH 11y agoThank you for this, I appreciate it. The Guide took a long time to write, around a year. It was the first ZeroMQ project where I merged all pull requests without code review. The results were amazing: most of the examples are now in many languages, a Rosetta stone of distributed programming. This was what convinced me that a "merge first, fix later" approach would work well more broadly (and it has). I'm rewriting the Guide slowly, as the software has changed and we've found nicer, simpler ways to solve some of the harder problems. There is a lot of new ZeroMQ-related material on my blog, at hintjens.com.
- mdpm 11y agoAnd thanks for the culture&empire writeup too :)
- fezz 11y agoI started 0MQ last year and the documentation was quite a pleasure to read and the whole thing has been great so far.
- taeric 11y agoI find I compare all technical writing nowdays to the TeXBook. Has a similar style in that it is highly technical and personal at the same time.
- yaiu 11y agoIt annoys me that ø is representing "zero"
- justincormack 11y agoIt should be a slashed zero, but that does not have a unicode codepoint and the combining version renders poorly.
- PieterH 11y agoWe've stopped using "ØMQ" in text and now just use "ZeroMQ" in most places (like in the Guide). The original choice was to annoy people into remembering the name... it kind of worked though got tiresome after a few years. I still like the logo.
- provemewrong 11y agoThe worst part is that now you're left with people who don't quite know how to call it. Just looking at the thread, you can see variations like ØMQ, 0MQ, ZMQ and finally ZeroMQ all in both upper and lowercase.
- emmelaich 11y agoOn the topic of chars ... Your Python examples of server and client use the unicode ellipsis (\xe2) which breaks Python2.
- dwc 11y agoHver gang.
- brudgers 11y agoFor what it's worth, it made the title a whole lot more visually appealing that "0" or "zero" when I posted it...and it's true to the page title.
- kristofferR 11y agoHøh, I was gonna ask why it was used, but that (sort of) explains it. It seems like Americans like our Ø way more than our Æ or Å, I wonder why. Colbert used it correctly at least.. ØMQ pronounced correctly would have been a horrible name anyway though.
- pekk 11y agoAs a disinterested third party, I know there is some criticism of ZeroMQ and I am interested in what that is about. When or why would you want to avoid ZeroMQ?
- mpdehaan2 11y agoMy general experience with 0mq in the past (with a past team) has not been great. While a nice abstraction library over sockets, sending it the wrong parameter is quite likely to crash in painful ways in rare instances. Maybe it's gotten better over the past year. Yes, it's fast. But if you want a message bus and are going to want for advanced features, I'd recommend a proper message bus. It's going to abstract away some of the socket details, but you can still get bitten pretty easily - again, may have gotten better in the last several months, I don't know. Be careful also with distros carrying older versions, you are probably wanting to make sure you get the latest than what your distro may contain for the same reasons.
- PieterH 11y agoThe original codebase used asserts rather poorly, for error handling rather than internal sanity checks. Four years ago we had fixed most of these problems, and had a "futzing" project to try to crash the library. Over time we've removed the edge cases... the codebase did take a long time to become properly stable, one of the downsides of lots of new code written rapidly, and one reason we insist on small gradual patches these days. (There have been _very_ few new errors introduced since we switched to our decentralized contribution process in early 2011.)
- mpdehaan2 11y agoGood to know. For what it's worth, the majority of my bad experiences were in 2013 to late 2014, and usually through the python bindings. Usually calling the functions in differnt ways was able to dodge the problem. It's not always quite obvious what caused it to crash, but it was sort of "if it hurts when you do that" sort of thing. Often these types of errors happened only under heavy traffic and were hard to replicate except under stress or lots of repeated calls. If not using the python bindings, it might be better off for most people.
- lobster_johnson 11y agoHas the problem with req/rep over lossy connections been solved (http://lucumr.pocoo.org/2012/6/26/disconnects-are-good-for-you/ http://lucumr.pocoo.org/2012/6/26/disconnects-are-good-for-y...)? My understanding was that you couldn't detect disconnects because ZMQ doesn't expose the internal state.
- edward 11y agoThe HTML for this page is 2.7MB. Somebody on the train to FOSDEM was telling me that they use it as a test case for web browsers and HTML parsers.
- PieterH 11y agoThat's kind of cool. It's a full, large book complete with examples with full syntax coloring. And still fits into less than 1/100th of a cent of disk space.
- dredmorbius 11y agoAnd the images add only another 750 KB. Rendered in Chrome it takes 98.7 MB (compare vs. ~250~MB for a a typical G+ page on load, often growing to 2+ GB, just sitting there). This is an exceptionally strong argument for well-coded, self-contained, static pages.
- ninjakeyboard 11y agoYa this is a good read. I cut my teeth on this stuff. This guy here is good if you're working with scala. https://github.com/mDialog/scala-zeromq https://github.com/mDialog/scala-zeromq mDialog were actually bought by google so I guess it worked out well for them too: http://techcrunch.com/2014/06/19/google-acquires-mdialog/ http://techcrunch.com/2014/06/19/google-acquires-mdialog/
- chengas123 11y agoWhen would you use 0mq vs Google's grpc? What are the main differences between them? I rarely hear them mentioned as alternatives to each other, but I haven't been able to grasp the differences.
- chris-hexx 11y agogrpc is Google's flavor of RPC, with transport and semantics specified for you. 0MQ is an abstraction over raw sockets that lets you worry less about how different parts of a distributed application find and talk to each other. There's no real direct comparison; you can implement request/reply patterns, like RPC, using 0MQ for the networking parts, but that's not all it's limited to.
- chetanahuja 11y agoThe fact that it's a LGPLv3 licensed library gives me pause to use even in our backend infrastructure (never ever in code running on client devices). The v3 situation is so complicated that even fsf had to come up with a matrix to explain how their own licenses play with each other. Not a very comforting situation: http://gplv3.fsf.org/dd3-faq http://gplv3.fsf.org/dd3-faq
- deleted 11y ago[deleted]
- agwa 11y agoThis is pure licensing FUD. First, as complicated as the licensing interactions around the GPL may be, the quite simple fact is that the (L)GPL's requirements only apply if you distribute code, so there is no more reason to take pause when using an LGPLv3 library in backend infrastructure than there would be if you were using a BSD-licensed library. As for client devices, it is possible to distribute proprietary applications linked with LGPL libraries, though there are requirements you must follow. The amount of time it takes to figure out and comply with those requirements is minimal compared to the person-hours that went into developing ZeroMQ, which you are getting for free. Edit: apparently ZeroMQ includes a static linking exception to the LGPL, so you don't even have to comply with the LGPL's most onerous restriction when linking with ZeroMQ! http://zeromq.org/area:licensing http://zeromq.org/area:licensing
- chetanahuja 11y agoWell it's FUD in the sense that I really, actually feel Fear Uncertainty and Doubt about using any code under GPLv3 license. There's good reason to [https://www.google.com/search?q=gplv3+for+commercial+use&oq=gplv3+for+commercial https://www.google.com/search?q=gplv3+for+commercial+use&oq=... ] worry. Large companies I've worked in before this (with teams of technically savvy lawyers on staff) have been known to promulgate an outright ban of such open source software in their production stack. Now, nothing makes me happier than being proven wrong in this case (especially with the static linking exception AND this little nugget "It is the intention of the ZeroMQ community to move gradually towards the Mozilla Public License v2, as a replacement for the current LGPLv3 + static link exception" ). So in a sense, my comment here has had a positive result not just for me but also for anyone else reading this thread and worried about the license. So on balance, I'd credit this subthread more for clearing up of FUD than the reverse ;-)
- coherentpony 11y agoNot familiar with 0mq, but I'm very familiar with MPI. Does anybody have any experience for how these compare?
- lobster_johnson 11y agoI've been thinking about using ZeroMQ for RPC, but the one problem it doesn't solve is discovery, ie. finding a peer to talk to among a dynamic pool over which you'd like to load-balance. zbeacon looks promising until I realized it uses UDP broadcasts. You can do it with ZooKeeper or Consul, but then you have to roll that glue for every app, or write a library which only you are going to end up using, and you'll end up doing it for every language you implement in. We write a lot of microservices, in all sorts of languages, and we'd like to move away from a centralized load-balancer, which is both a bottleneck and a SPoF. (gRPC looks like a great start, but I'm puzzled why they chose to ignore/defer discovery. Plain one-on-one RPC is trivial, the difficult part is making it completely distributed and fault-tolerant, neither of which gRPC seem to address at all.)
- jkarneges 11y agoZeroMQ sockets can connect or bind, and this is independent of the socket type. If you want to load balance requests against a dynamic number of responders, just have the responders connect their REP sockets to a set of bound REQ sockets.
- lobster_johnson 11y agoBut you still need to know the IPs and ports of the endpoints to connect to. This is what I mean by discovery.
- chisleu 11y agoZeroMQ merely solves exposure of sockets as queues. In all distributed systems, there must be a set of known hosts, or discovery becomes tedious. DNS is an easy way to solve this.
- lobster_johnson 11y agoZeroMQ is an abstraction that hides a lot of complexity for you in the name of convenience, and there's no reason why it couldn't abstract discovery, too. Instead you have to build it from scratch for every client app.
- e12e 11y agoIs this outdated wrt security for zmq 4.0+? [ed: I see now that the latest version is just a release-candidate -- I accidentally thought 4.0 was "out"]
- PieterH 11y agoYes, it does not describe the current security mechanisms. I've written articles on my blog to explain those; they need to be reworked into a new Guide text. Version 4.0 is stable; there's a pending 4.1 update.