Software Architecture using ØMQ

by Pieter Hintjens Strange Loop 2012

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

A complex story is best told as a series of vacuous 1liners

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

90% of software is trash. 90% of the rest will be trash RSN

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

We basically don't know how to make code that can survive ten, let alone 50 years Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

The most difficult challenge in our profession is simple accuracy

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

Future code has to talk to code, has to be chatty, sociable, wellconnected

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

When we can move faster, where we go is more critical than ever.

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

Writing distributed code is like a live jam session. It's all about other people Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

How we connect to each other matters more than who we are

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

The physics of software is the physics of people

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

Ideas are cheap. Execution is the hard part

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

Making perfect software is easy, once you learn the trick (which is kinda hard) Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

Simplicity always beats functionality

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

Problems are not all equal, and most are illusions

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

When you know the real problem you have done half the work

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

Do nothing that is not a minimal, plausible answer to a well-defined problem

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

Every commit should be shippable

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

Design by removing problems, not adding features

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

Five Steps to Satori: Learn, Draw, Divide, Conquer, Repeat

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

1. Learn the language before you write a poem

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

2. If it looks pretty, it's more likely to work

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

3. A good contract is worth a thousands assumptions

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

4. When you take small steps, it hurts less when you fall

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

5. Solve one problem, and repeat until you run out of time or money

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

Distributed software lives or dies by its protocols

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

Protocols are contracts that describe the rights and obligations of each party

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

An unprotocol takes minutes to explain, hours to design, days to write, weeks to prove, months to mature, and years to replace Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

Use human language in your unprotocols.

nom-protocol = open-peering *use-peering

ORLY? YARLY!

use-peering = C:ICANHAZ / S:CHEEZBURGER / C:HUGZ S:HUGZ-OK / S:HUGZ C:HUGZ-OK

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

open-peering = C:OHAI ( S:OHAI-OK / S:WTF )

Use GPLv3 for your open specs. Remixability is freedom

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

If you're willing to give up flexibility for speed you deserve neither flexibility nor speed Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

Use cheap text for the low-volume chatty control commands

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

Use nasty hand-coded binary for the highvolume data

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

ØMQ framing makes a lousy codec but a great separator

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

A handcrafted codec can always beat a generic serializer

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

A codegenerated codec can always beat a handcrafted one

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

iMatix GSL: technology so dangerous we had to lock it up for years

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

File transfer is the zombie problem of distributed applications

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

Router sockets are the beating heart of every real ØMQ protocol engine Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

The world needs a chunked, flow-controlled, restartable, cancellable, async, multicast file transfer ØMQ protocol Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

No matter how hard you push, a file will not just go down a socket

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

C: S: S: S:

fetch chunk 1 chunk 2 chunk 3

That annoying pause after you finish your beer, before you catch the waiter's eye Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

C: S: C: S: C: S: C:

fetch chunk 1 send chunk 1 fetch chunk 2 send chunk 2 fetch chunk 3 send chunk 3 fetch chunk 4

You can, and I've tested this, order a new beer before your old one is empty

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

C: C: C: S: C: S: S:

fetch chunk 1 fetch chunk 2 fetch chunk 3 send chunk 1 fetch chunk 4 send chunk 2 send chunk 3

Requestreply is just a vulgar subclass of publishsubscribe

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

C: C: S: S: C: S:

subscribe send credit send chunk send chunk send credit send chunk

On a router socket, you should never hit the high-water mark

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

Heartbeats are our protocol's way of asking if we still care

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

Protocol stack = message codec + protocol engine Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

command_t *request = command_decode (socket) execute_engine (command)

State machines are a perfect domain language for protocol engines

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

State machines can be cudly and gentle, when you get to know them

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

You don't want to bet against a compiler

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

If you're not thinking of security, security is probably thinking of you

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

For connected bidirectional protocols over ØMQ use SASL

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

For loosely connected and one-way protocols over ØMQ, use AES and such

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

SASL over ØMQ is darned simple

secure-nom = open-peering *use-peering open-peering = C:OHAI *( S:ORLY C:YARLY ) ( S:OHAI-OK / S:WTF ) ORLY = 1*mechanism challenge mechanism = string challenge = *OCTET YARLY = mechanism response response = *OCTET

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

Theory is fine in theory, but in practice, practice is better

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

FileMQ is a file sharing protocol and stack over ØMQ. Reusable until 2062 Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

To sum it up:

1. Aim for 50 years 2. It's all about people 3. Minimal plausible solutions

zero.mq/ch6

4. To real immediate problems 5. Document the contracts

The Weird Fish Book, coming soon from O'Reilly

6. Cheap and Nasty codecs 7. Code generation rocks 8. Router sockets rock 9. CBFC > HWM 10. Learn state machines 11. Learn about SASL

Photos by Pieter Hintjens cc-by-sa © 2012 Pieter Hintjens

12. Worked example: FileMQ

by Pieter Hintjens - GitHub

Use cheap text for the low-volume .... cc-by-sa © 2012 Pieter Hintjens. State machines are a perfect domain language for protocol ... Cheap and Nasty codecs. 7.

21MB Sizes 1 Downloads 195 Views

Recommend Documents

Pieter Herman response.pdf
Page 1 of 27. Page 1 of 27. Page 2 of 27. Page 2 of 27. Page 3 of 27. Page 3 of 27. Pieter Herman response.pdf. Pieter Herman response.pdf. Open. Extract.

pdf-56\oracle-application-express-forms-converter-by-douwe-pieter ...
Page 3 of 8. ORACLE APPLICATION EXPRESS FORMS CONVERTER BY. DOUWE PIETER VAN DEN BOS PDF. Oracle Application Express Forms Converter ...

Sample 5 - Pieter Willem Botha.pdf
Sample 5 - Pieter Willem Botha.pdf. Sample 5 - Pieter Willem Botha.pdf. Open. Extract. Open with. Sign In. Main menu. Displaying Sample 5 - Pieter Willem ...

pdf-17181\get-agile-scrum-for-ux-design-development-by-pieter ...
pdf-17181\get-agile-scrum-for-ux-design-development-by-pieter-jongerius.pdf. pdf-17181\get-agile-scrum-for-ux-design-development-by-pieter-jongerius.pdf.

fedora by the numbers - GitHub
The Section of the Presentation. Which Features ... 90%. 100%. Edition Downloads as Percent of Total over Time. Atomic. Cloud. Server (Net) ... Edition + Spins Downloads as Percent of Total over Time. Security. Scientific. Robotics. Jam.

Coolidge by Amity Shlaes - GitHub Pages
or bookshelves' grow to be full because you can have it inside your lovely laptop even cell phone. This Coolidge having great arrangement in word and layout, ...

DuinoCube User Manual by Simon Que - GitHub
delve into the finer details of some system components, such as the FAT file ... importantly, Arduino shields can be designed to stack on top of one another, .... but can be run on Linux using the Wine emulator. http://notepadplusplus.org/ .... Conne

JavaScript Cheat Sheet by DaveChild - Cheatography.com - GitHub
Start of string. $. End of string . Any single character. (a|b) a or b. (...) ... Page 1 of 2. Sponsored by Readability-Score.com. Measure your website readability!

USB Drawn By: Title: Version - GitHub
C9. C10. IN. GND. OUT. EN BP. U$11. C11. C12. U$10. VDDIO. 1. BYP. 2. SCL. 4. GND. 5. SDA. 6. SA0. 7. INT2. 9. GND. 10. INT1. 11. GND. 12. VDD. 14. C13.

ESCs supported by BLHeli SiLabs - GitHub
The ESC supports 2S to 6S operation. Switching speed is quite fast. Fet resistances are around ..... RotorGeeks 20A Plus: The ESC supports 2S to 4S operation.

RUM PUNCH by ELMORE LEONARD - GitHub Pages
even cell phone. This RUM PUNCH having great arrangement in word and layout, so you will not really feel uninterested in reading. PDF File: RUM PUNCH. 2.

Step-by-step instructions for Cygwin - GitHub
2. Install Cygwin: First you have to select where do you want to download the parts from. I recommend choosing ... of the mirrors: http://cygwin.com/mirrors.html ...

ESCs supported by BLHeli Atmel - GitHub
The ESC supports 2S to 4S operation. It supports damped light mode, overtemp protection and bootloader on input plug. Switching speed is quite fast, although ...

GitHub
domain = meq.domain(10,20,0,10); cells = meq.cells(domain,num_freq=200, num_time=100); ...... This is now contaminator-free. – Observe the ghosts. Optional ...

GitHub
data can only be “corrected” for a single point on the sky. ... sufficient to predict it at the phase center (shifting ... errors (well this is actually good news, isn't it?)

Torsten - GitHub
Metrum Research Group has developed a prototype Pharmacokinetic/Pharmacodynamic (PKPD) model library for use in Stan 2.12. ... Torsten uses a development version of Stan, that follows the 2.12 release, in order to implement the matrix exponential fun

Untitled - GitHub
The next section reviews some approaches adopted for this problem, in astronomy and in computer vision gener- ... cussed below), we would question the sensitivity of a. Delaunay triangulation alone for capturing the .... computation to be improved fr

ECf000172411 - GitHub
Robert. Spec Sr Trading Supt. ENA West Power Fundamental Analysis. Timothy A Heizenrader. 1400 Smith St, Houston, Tx. Yes. Yes. Arnold. John. VP Trading.

Untitled - GitHub
Iwip a man in the middle implementation. TOR. Andrea Marcelli prof. Fulvio Risso. 1859. Page 3. from packets. PEX. CethernetDipo topo data. Private. Execution. Environment to the awareness of a connection. FROG develpment. Cethernet DipD tcpD data. P

BOOM - GitHub
Dec 4, 2016 - 3.2.3 Managing the Global History Register . ..... Put another way, instructions don't need to spend N cycles moving their way through the fetch ...

Supervisor - GitHub
When given an integer, the supervisor terminates the child process using. Process.exit(child, :shutdown) and waits for an exist signal within the time.