Code Connected Volume 1: Learning ZeroMQ
Free

Code Connected Volume 1: Learning ZeroMQ

By Pieter Hintjens
Free
Book Description

"Even connecting a few programs across a few sockets is plain nasty when you start to handle real life situations. Trillions? The cost would be unimaginable. Connecting computers is so difficult that software and services to do this is a multi-billion dollar business. So today we're still connecting applications using raw UDP and TCP, proprietary protocols, HTTP, Websockets. It remains painful, slow, hard to scale, and essentially centralized. To fix the world, we needed to do two things. One, to solve the general problem of "how to connect any code to any code, anywhere". Two, to wrap that up in the simplest possible building blocks that people could understand and use easily. It sounds ridiculously simple. And maybe it is. That's kind of the whole point."

If you are a programmer and you aim to build large systems, in any language, then Code Connected is essential reading. Code Connected Volume 1 takes you through learning ZeroMQ, step-by-step, with over 80 examples. You will learn the basics, the API, the different socket types and how they work, reliability, and a host of patterns you can use in your applications.

Print editions available for purchase via the author's web site.

Table of Contents
  • Preface
    • ØMQ in a Hundred Words
    • How It Began
    • The Zen of Zero
    • How This Book Came To Be
    • Audience
    • Code Connected
  • Chapter 1. Basics
    • Fixing the World
    • Starting Assumptions
    • Getting the Examples
    • Ask and Ye Shall Receive
    • A Minor Note on Strings
    • Version Reporting
    • Getting the Message Out
    • Divide and Conquer
    • Programming with ØMQ
      • Getting the Context Right
      • Making a Clean Exit
    • Why We Needed ØMQ
    • Socket Scalability
    • Upgrading from ØMQ v2.2 to ØMQ v3.2
      • Compatible Changes
      • Incompatible Changes
      • Suggested Shim Macros
    • Warning: Unstable Paradigms!
  • Chapter 2. Sockets and Patterns
    • The Socket API
      • Plugging Sockets into the Topology
      • Sending and Receiving Messages
      • Unicast Transports
      • ØMQ is Not a Neutral Carrier
      • I/O Threads
    • Messaging Patterns
      • High-Level Messaging Patterns
      • Working with Messages
      • Handling Multiple Sockets
      • Multipart Messages
      • Intermediaries and Proxies
      • The Dynamic Discovery Problem
      • Shared Queue (DEALER and ROUTER sockets)
      • ØMQ’s Built-In Proxy Function
      • Transport Bridging
    • Handling Errors and ETERM
    • Handling Interrupt Signals
    • Detecting Memory Leaks
    • Multithreading with ØMQ
    • Signaling Between Threads (PAIR Sockets)
    • Node Coordination
    • Zero-Copy
    • Pub-Sub Message Envelopes
    • High-Water Marks
    • Missing Message Problem Solver
  • Chapter 3. Advanced Request-Reply Patterns
    • The Request-Reply Mechanisms
      • The Simple Reply Envelope
      • The Extended Reply Envelope
      • What’s This Good For?
      • Recap of Request-Reply Sockets
    • Request-Reply Combinations
      • The REQ to REP Combination
      • The DEALER to REP Combination
      • The REQ to ROUTER Combination
      • The DEALER to ROUTER Combination
      • The DEALER to DEALER Combination
      • The ROUTER to ROUTER Combination
      • Invalid Combinations
    • Exploring ROUTER Sockets
      • Identities and Addresses
      • ROUTER Error Handling
    • The Load Balancing Pattern
      • ROUTER Broker and REQ Workers
      • ROUTER Broker and DEALER Workers
      • A Load Balancing Message Broker
    • A High-Level API for ØMQ
      • Making a Detour
      • Features of a Higher-Level API
      • The CZMQ High-Level API
    • The Asynchronous Client/Server Pattern
    • Worked Example: Inter-Broker Routing
      • Establishing the Details
      • Architecture of a Single Cluster
      • Scaling to Multiple Clusters
      • Federation Versus Peering
      • The Naming Ceremony
      • Prototyping the State Flow
      • Prototyping the Local and Cloud Flows
      • Putting it All Together
  • Chapter 4. Reliable Request-Reply Patterns
    • What is “Reliability”?
    • Designing Reliability
    • Client-Side Reliability (Lazy Pirate Pattern)
    • Basic Reliable Queuing (Simple Pirate Pattern)
    • Robust Reliable Queuing (Paranoid Pirate Pattern)
    • Heartbeating
      • Shrugging It Off
      • One-Way Heartbeats
      • Ping-Pong Heartbeats
      • Heartbeating for Paranoid Pirate
    • Contracts and Protocols
    • Service-Oriented Reliable Queuing (Majordomo Pattern)
    • Asynchronous Majordomo Pattern
    • Service Discovery
    • Idempotent Services
    • Disconnected Reliability (Titanic Pattern)
    • High-Availability Pair (Binary Star Pattern)
      • Detailed Requirements
      • Preventing Split-Brain Syndrome
      • Binary Star Implementation
      • Binary Star Reactor
    • Brokerless Reliability (Freelance Pattern)
      • Model One: Simple Retry and Failover
      • Model Two: Brutal Shotgun Massacre
      • Model Three: Complex and Nasty
    • Conclusion
  • Chapter 5. Advanced Pub-Sub Patterns
    • Pros and Cons of Pub-Sub
    • Pub-Sub Tracing (Espresso Pattern)
    • Last Value Caching
    • Slow Subscriber Detection (Suicidal Snail Pattern)
    • High-Speed Subscribers (Black Box Pattern)
    • Reliable Pub-Sub (Clone Pattern)
      • Centralized Versus Decentralized
      • Representing State as Key-Value Pairs
      • Getting an Out-of-Band Snapshot
      • Republishing Updates from Clients
      • Working with Subtrees
      • Ephemeral Values
      • Using a Reactor
      • Adding the Binary Star Pattern for Reliability
      • The Clustered Hashmap Protocol
      • Building a Multithreaded Stack and API
  • Postface
    • Tales from Out There
      • Rob Gagnon’s Story
      • Tom van Leeuwen’s Story
      • Michael Jakl’s Story
      • Vadim Shalts’s Story
    • How This Book Happened
    • Removing Friction
    • Licensing
    • Code Connected Volume 2
    No review for this book yet, be the first to review.
      No comment for this book yet, be the first to comment
      You May Also Like
      Also Available On
      App store smallGoogle play small
      Categories
      Curated Lists
      • Pattern Recognition and Machine Learning (Information Science and Statistics)
        by Christopher M. Bishop
        Data mining
        by I. H. Witten
        The Elements of Statistical Learning: Data Mining, Inference, and Prediction
        by Various
        See more...
      • CK-12 Chemistry
        by Various
        Concept Development Studies in Chemistry
        by John Hutchinson
        An Introduction to Chemistry - Atoms First
        by Mark Bishop
        See more...
      • Microsoft Word - How to Use Advanced Algebra II.doc
        by Jonathan Emmons
        Advanced Algebra II: Activities and Homework
        by Kenny Felder
        de2de
        by
        See more...
      • The Sun Who Lost His Way
        by
        Tania is a Detective
        by Kanika G
        Firenze_s-Light
        by
        See more...
      • Java 3D Programming
        by Daniel Selman
        The Java EE 6 Tutorial
        by Oracle Corporation
        JavaKid811
        by
        See more...