ZEROMQ: CHAPTER 8 A FRAMEWORK FOR DISTRIBUTED COMPUTING
CONTENTS Design for The Real World The Secret Life of WiFi Topic in a Framework Discovery Point-to-point Messaging Group Messaging Distributed Logging and Monitoring Content Distribution Protocol and implementation Conclusions
DESIGN FOR THE REAL WORLD Distributed, localized, scalable … Issues Discovery Presence Connectivity Point-to-point messaging Group messaging Content distribution Testing and simulation Distributed Logging
THE SECRET LIFE OF WIFI Why Mesh isn't Here Yet Some Physics Transmission Power, performance of AP What's the Current Status? Point-to-point VS. AP-to-client Performance Battery life
DISCOVERY Preemptive Discovery over Raw Sockets ICMP ping, raw IP socket It doesn't take any cooperation from the device To open a raw IP socket requires root privileges Cooperative Discovery using UDP Broadcasts The POSIX socket API was designed for universal flexibility not simplicity To push the UDP code into a separate library
POINT-TO-POINT MESSAGING UDP Beacon Framing True Peer Connectivity (Harmony Pattern) Not ROUTER-ROUTER ROUTER(in, one per all peers)-DEALER(out, one per a peer) Detecting Disappearances UDP heartbeating sounds simple but it's not It's tempting to add in TCP beacons We switch to TCP heartbeats only when a specific peer hasn't sent us any UDP beacons in a while
GROUP MESSAGING Group A set of peers JOIN / LEAVE command Repeat peer to peer Not PUB-SUB pattern Must solve the late joiner problem, last value cashing, etc.
DISTRIBUTED LOGGING AND MONITORING PUB-SUB pattern Extend the HELLO command with a headers X-ZRELOG=tcp:// :9992 LOG format Two bytesOne byte N bytes a protocol signaturea logging levelan event typeLog data
CONTENT DISTRIBUTION FileMQ PUB-SUB pattern to delivery files API example fmq_server_t *server = fmq_server_new (); fmq_server_bind (server, "tcp://*:5670"); fmq_server_publish (server, "/home/ph/filemq/share", "/public"); fmq_client_t *client = fmq_client_new (); fmq_client_connect (client, "tcp://pieter.filemq.org:5670"); fmq_client_subscribe (server, "/public/", "/home/ph/filemq/share");
PROTOCOL AND IMPLEMENTATION FILEMQ The File Message Queuing Protocol (FILEMQ) governs the delivery of files between a 'client' and a 'server'. FILEMQ runs over the ZeroMQ ZMTP protocol. ZRE (ZeroMQ Realtime Exchange Protocol ) The ZRE governs how a group of peers on a network discover each other, organize into groups, and send each other events. ZRE runs over the ZeroMQ ZMTP protocol. Zyre An open-source framework for proximity-based peer-to-peer applications
CONCLUSIONS Building applications for unstable decentralized networks is one of the end-games for ØMQ Zyre, There are some major areas unfinished High-level APIs Security Nomadic content Federation