Review: ZeroMQ [Packt Publishing]

ZeroMQ book

TL;DR: Despite its flaws, this book could still make a good printed primer for new hires. Experienced people should look elsewhere.

I am a big fan of the ZeroMQ library. When Packt asked me to review their ZeroMQ book I was very interested to see how it turned out. ZeroMQ is a networking library which is commonly described as “Sockets on steroids”. Many successful projects use ZeroMQ to handle network communication and IPC, for example ZeroRPC and the Mongrel2 web server.

I strongly believe that if you are writing networked software that you should become familiar with the ZeroMQ library.

Standard disclaimer: I have no affiliation with the author or publisher of this book. I do not benefit from sales of this book. I received an electronic copy for review from the publisher.

ZeroMQ’s intended audience is people with (some) C coding experience, but no ZeroMQ experience is assumed. It is a very short book. Amazon lists it at 108 pages, but the pdf I have is really only about 90 pages.

Already I know that this is probably not a book for me… but I will try to be fair.

The book is broken up into 4 sections.
Chapter 1 covers the request-reply pattern, plus some other minor details.
Chapter 2 covers publish-subscribe, and pipeline patterns, as well as some very brief coverage of resource management and using Valgrind to find leaks.
Chapter 3 covers the difference between standard sockets and ZeroMQ sockets, as well as covering the high(er) level CZMQ API
Chapter 4 covers advanced patterns, and techniques needed for real world scenarios (eg how to handle slow subscribers).

The Good:

  • Its cheap. At the moment the ebook is around 13 bucks on Packt’s site. Even if its terrible (and it does have some issues), for 13 bucks you might consider taking the plunge if you are new to ZeroMQ.
  • Covers the common messaging patterns that ZeroMQ implements. REQUEST-REPLY, PUBLISH-SUBSCRIBE, PIPELINE (aka PUSH-PULL)
  • Briefly covers the CZMQ API. This is one time where its good to be brief. The book covers just enough to show you that it exists, and start you off.
  • The diagrams are really good. They are similar to the diagrams in the zguide, but nicer. They are easy to understand, plentiful, and professional looking.

The Bad

  • Coverage is actually very brief. A lot of sections are overly brief and would benefit from a little more explanation and exploration.
  • The writing is very halting. It doesn’t flow very well. I’m not saying I could do much better, but its certainly noticeable while reading.
  • There’s sections that don’t make sense or are incomplete. For example, there’s a section on using Valgrind to detect memory leaks. The author shows a tiny C program (which doesnt use ZeroMQ) with a trivial leak and shows Valgrind’s output. Then the author shows a sample suppression file. But the author never explains why the suppression file is needed, or uses Valgrind on a ZeroMQ program. The section (like a lot of others) feels half written.

The Ugly

  • A lot of the code in this book is pretty bad quality. Almost eye-stabbingly bad. There’s misleading variable names, missing sections of code, sections of code that do nothing constructive, and even downright bugs. Luckily the code quality picks up a bit for the second half of the book and it’s still pretty clear what the author was actually intending. Its jarring, but these issues won’t be a large barrier to understanding.
    I sincerely hope these issues are fixed in a second edition.
  • The books site claims that it is example rich, but in reality the examples are very short. I would prefer meaningful examples that could occur in the real world over lots of “hello world” snippets. No big deal though.
  • There’s some minor mistakes. For example, in the PUB-SUB section, the book states that filtering is done on the subscriber side. In ZeroMQ, this changed in 3.x, so now for TCP and IPC endpoints, filtering is done on the publisher side. Completely understandable, because this changed between versions. But it should have been picked up in editing.

The lingering taste

Overall, the coverage is ok, but a little brief. The book feels half finished, and looks like it could have benefited from more time in editing. Its not a bad book though. Content-wise, it manages to cover everything a beginner needs to know.

A second edition (with more pages) should be able to fix these problems and turn this into a truly good book.

Who should buy this book?

This definitely isn’t a book for everyone. Its too brief for my tastes, and the quality issues are jarring. However there are some times when a short book is better than a long book, and when a comprehensive overview is actually overkill. For example, if you hire new programmers you will want something that will quickly introduce them to the concepts and techniques behind ZeroMQ. I think this could be a book that would quickly bring them up to speed.
Anyone looking for detailed coverage of ZeroMQ should skip it though.

What supplements/alternatives exist?

The most obvious supplement is the Z Guide. This is pretty much a must read if you are serious about developing with ZeroMQ.

For people that want larger books with comprehensive coverage, Pieter Hintjens (the author of the ZeroMQ library) has written Code Connected Volume 1. This covers the first 5 chapters of the ZGuide. There is a free ebook version.
There is also an O’Reilly book called ZeroMQ: Messaging for Many Applications, also by Pieter Hintjens.

For people wanting advanced tips and uses of ZeroMQ, I highly recommend Pieters blog. There’s a lot of really great stuff on there.

  1. Any thoughts on O’Reilly’s offering?

    (I bought it when it was on sale, but to be honest I haven’t read it since!)

  2. To be honest I haven’t read that one. Other people I know say its good though. It is written by Pieter Hintjens, the guy that wrote ZeroMQ, so I’d expect it to be good.

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>