forked from booksbyus/zguide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
preface_print.txt
57 lines (36 loc) · 6.43 KB
/
preface_print.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
+ Preface
++ 0MQ in a Hundred Words
0MQ (also known as ZeroMQ, 0\MQ, or zmq) looks like an embeddable networking library but acts like a concurrency framework. It gives you sockets that carry atomic messages across various transports like in-process, inter-process, TCP, and multicast. You can connect sockets N-to-N with patterns like fan-out, pub-sub, task distribution, and request-reply. It's fast enough to be the fabric for clustered products. Its asynchronous I/O model gives you scalable multicore applications, built as asynchronous message-processing tasks. It has a score of language APIs and runs on most operating systems. 0MQ is from [http://www.imatix.com iMatix] and is LGPLv3 open source.
++ How It Began
We took a normal TCP socket, injected it with a mix of radioactive isotopes stolen from a secret Soviet atomic research project, bombarded it with 1950-era cosmic rays, and put it into the hands of a drug-addled comic book author with a badly-disguised fetish for bulging muscles clad in spandex[figure]. Yes, 0MQ sockets are the world-saving superheroes of the networking world.
++ The Zen of Zero
[[code type="textdiagram" title="A terrible accident..."]]
.------------. .--------------.
| | | |
| TCP socket +------->| | ZAP!
| | BOOM! | 0MQ socket |
'------------' | | POW!!
^ ^ ^ | |
| | | '--------------'
| | |
| | |
| | '--------- Spandex
| |
| '-------------- Cosmic rays
Illegal radioisotopes from
secret Soviet atomic city
[[/code]]
The Ø in 0MQ is all about tradeoffs. On the one hand this strange name lowers 0MQ's visibility on Google and Twitter. On the other hand it annoys the heck out of some Danish folk who write us things like "ØMG røtfl", and "Ø is not a funny looking zero!" and "//Rødgrød med fløde!//", which is apparently an insult that means "may your neighbours be the direct descendants of Grendel!" Seems like a fair trade.
Originally the zero in 0MQ was meant as "zero broker" and (as close to) "zero latency" (as possible). Since then, it has come to encompass different goals: zero administration, zero cost, zero waste. More generally, "zero" refers to the culture of minimalism that permeates the project. We add power by removing complexity rather than by exposing new functionality.
++ How This Book Came To Be
In the summer of 2010, 0MQ was still a little-known niche library described by its rather terse reference manual and a living but sparse wiki. Martin Sustrik and myself were sitting in the bar of the Hotel Kyjev in Bratislava plotting how to make 0MQ more widely popular. Martin had written most of the 0MQ code, and I'd put up the funding and organized the community. Over some Zlaty Bazants, we agreed that 0MQ needed a new, simpler web site and a basic guide for new users.
Martin collected some ideas for topics to explain. I'd never written a line of 0MQ code before this, so it became a live learning documentary. As I worked through simple examples to more complex ones, I tried to answer many of the questions I'd seen on the mailing list. Because I'd been building large-scale architectures for 30 years, there were a lot of problems at which I was keen to throw 0MQ. Amazingly the results were mostly simple and elegant, even when working in C. I felt a pure joy learning 0MQ and using it to solve real problems, which brought me back to programming after a few years' pause. And often, not knowing how it was "supposed" to be done, we improved 0MQ as we went along.
From the start, I wanted the 0MQ guide to be a community project, so I put it onto GitHub and let others contribute with pull requests. This was considered a radical, even vulgar approach by some. We came to a division of labor: I'd do the writing and make the original C examples, and others would help fix the text and translate the examples into other languages.
This worked better than I dared hope. You can now find all the examples in several languages and many in a dozen languages. It's a kind of programming language Rosetta stone and a valuable outcome in itself. We set up a high score: reach 80% translation and your language got its own Guide. PHP, Python, Lua, and Haxe reached this goal. People asked for PDFs, and we created those. People asked for ebooks, and got those. About a hundred people contributed to the examples to date.
The book, in its on-line version "The Guide", achieved its goal of popularizing 0MQ. The style pleases most and annoys some, which is how it should be. In December 2010, my work on 0MQ and this guide stopped, as I found myself going through late-stage cancer, heavy surgery, and six months of chemotherapy. When I picked up work again in mid-2011, it was to start using 0MQ in anger for one of the largest use cases imaginable: on the mobile phones and tablets of the world's biggest electronics company.
But the goal of the 0MQ book was, from the start, a printed work. So it was exciting to get an email from Bill Lubanovic in January 2012 introducing me to his editor, Andy Oram, at O'Reilly, suggesting a 0MQ book. Of course! Where do I sign? How much do I have to pay? Oh, I //get money// for this? All I have to do is finish it?
Of course as soon as O'Reilly announced a 0MQ book, other publishers started sending out emails to potential authors. You'll probably see a rash of 0MQ books coming out next year. That's good. Our niche library has hit the mainstream and deserves its six inches of shelf space. My apologies to the other 0MQ authors. We've set the bar horribly high, and my advice is to make your books complementary. Perhaps focus on a specific language, platform, or pattern.
This is the magic and power of communities: be the first community in a space, stay healthy, and you own that space for ever.
++ Audience
This book is written for professional programmers who want to learn how to make the massively distributed software that will dominate the future of computing. We assume you can read C code, because most of the examples here are in C even though 0MQ is used in many languages. We assume you care about scale, because 0MQ solves that problem above all others. We assume you need the best possible results with the least possible cost, because otherwise you won't appreciate the trade-offs that 0MQ makes. Other than that basic background, we try to present all the concepts in networking and distributed computing you will need to use 0MQ.
.inbook preface.xml