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

ZMQ on Node.js

ZMQ on Node.js

Avatar for Casear Chu

Casear Chu

May 29, 2013

More Decks by Casear Chu

Other Decks in Programming

Transcript

  1. •Windows • node.js should be 32bit • install zmq •

    install VS2010 C++ express • install Windows SDK 7.1 • install python <3.0.0 • npm install zmq •Mac • brew install zmq • npm install zmq ping 192.168.0.190 13年5月29⽇日星期三
  2. About Me me = name:Casear Chu, email: “[email protected]” company:”Chuto(迌)” blog:

    “http://casear.chuto.tw” IsMarried:true hasChild:true projects:null interests:[“web” “maker” “others”] faith:”have fun and change the world” picture:”/9j/ 4AAQSkZJRgABAQEAYABgAAD/ 13年5月29⽇日星期三
  3. We are looking for Front-end Developer Arduino Raspberry Pi embedded

    Hadoop big data We play anything for fun 3D Printer 13年5月29⽇日星期三
  4. I/O? Background or? Dynamic component? Deliver immediately? message queues? Slow

    Componet? Different network transport? language? architectures? network errors? 重試? 忽略? 放棄? Load Balance? Reliable? Fair Queue? crashes? Reconnect? Problems? 13年5月29⽇日星期三
  5. var zmq = require(‘zmq’) var req = zmq.socket(‘req’) req.connect(‘tcp://XXX:XX’) req.on(‘message’,function(data){

    console.log(data.toString()) }) req.send(‘Hello’) req,send(‘hello2’) 13年5月29⽇日星期三
  6. var zmq = require(‘zmq’) var rep = zmq.socket(‘rep’) req.bind(‘tcp://XXX:XX’,function(err) {

    rep.on(‘message’,function(data){ console.log(data.toString()) rep.send(data*2) } ) 13年5月29⽇日星期三
  7. Note • Frame is length+content • Req-Res is blocking •

    IPC not work on Windows 13年5月29⽇日星期三
  8. crash slowly for its input out of memory Message queues

    can overflow slow clients Networks can fail Hardware can fail 13年5月29⽇日星期三
  9. Shrugging It Off disconnect and reconnect -< cause memory leak

    keep alive good slient or bad slient 13年5月29⽇日星期三
  10. Miss messages because join late Subscriber fetch slow , queues

    overflow Network Slow, queues overflow 13年5月29⽇日星期三