Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ZeroMQ: Scale Up !

SysFera
October 17, 2012

ZeroMQ: Scale Up !

Talks presented at OSDC.fr 2012 (OpenWorld Forum 2012).
It's kinda a ZMQ 101, and how to use ZMQ for concurrent application design

SysFera

October 17, 2012
Tweet

More Decks by SysFera

Other Decks in Programming

Transcript

  1. Simple server (Python) import zmq context = zmq.Context(1) socket =

    context.socket(zmq.REP) socket.bind("tcp://*:5555") while True: # wait for request from client message = socket.recv() print ">: {}".format(message) answer = message[::-1] socket.send(answer) print "<: {}".format(answer) Client (Ruby) require 'zmq' context = ZMQ::Context.new(1) socket = context.socket(ZMQ::REQ) socket.connect("tcp://localhost:5555") message = "Have you met Ted ?" puts "<: #{message}" socket.send(message) answer = socket.recv() puts ">: #{answer}"
  2. Various routing patterns round-robin (REQ, PUSH, DEALER) multicast (PUB) fair

    queueing (REP, SUB, PULL, DEALER) explicit routing (ROUTER) point to point (PAIR) Concurrency ?
  3. Today ? data-centric model one datum, many executors you must

    control data accesses Consequences complexity race conditions heisenbugs
  4. How ? adopt message-driven design ! design independant tasks (threads,

    processes) use inproc:// (threads), ipc:// (processes), tcp:// (network) In practice ... use actor model formalized by Carl Hewitt in 1973 Popularized by Erlang