Components/XSock

From Polytech Center Barcelona
Jump to: navigation, search

ZeroMQ was a breakthrough research by Hintjens and others. He realized that by creating a simple socket interface (dumb pipes), but shift complexity to the endpoints you have a scalable network infrastructure paradigm. On top of these simple interfaces, he created a bunch of example patterns: REQ-REP, PUB-SUB, PUSH-PULL...

Problems with ZMQ:

  • Each pattern requires a separate socket instance. It should be possible to multiplex REQ-REP and PUB-SUB over the same socket.
  • No guaranteed delivery of messages.
  • Poor async support.

Our proposal:

  • Same basic socket design as ZMQ (open and forget)
  • Basic message packet format: magic bytes, command, payload.
  • Multiplexing.
  • Requests:
    • Send request with request-id
    • Receive back a request-ack (containing request-id)
      • If not received within 10 secs, async awaited request retries 5 times before failing
    • Once ack received, wait for response.
      • If no response within 30 secs, async awaited request fails.
  • Background process ping-pong which stores 2 pieces of data:
    • Server ping time
    • Server connection status (on or off)

The recipe for distributed designs are contained in ZMQ documents outlined by Hintjens.

Also we can add simple mixnet and p2p layer designs to this system.