Skip to content

richardor/zeromq.node

This branch is 169 commits behind JustinTulloss/zeromq.node:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
ronkorving
Aug 27, 2014
df9a227 · Aug 27, 2014
Dec 23, 2011
Apr 14, 2012
Aug 27, 2014
Jul 25, 2013
Aug 18, 2014
Mar 21, 2013
Feb 11, 2012
Aug 18, 2014
Aug 27, 2014
Dec 5, 2011
Jun 4, 2014
Jul 17, 2013
Jul 15, 2014
Nov 25, 2013
Oct 19, 2011
Aug 27, 2014

Repository files navigation

Build Status

node-zeromq

ØMQ bindings for node.js.

Installation

Install zmq package first.

$ npm install zmq

Example

producer.js:

var zmq = require('zmq')
  , sock = zmq.socket('push');

sock.bindSync('tcp://127.0.0.1:3000');
console.log('Producer bound to port 3000');

setInterval(function(){
  console.log('sending work');
  sock.send('some work');
}, 500);

worker.js:

var zmq = require('zmq')
  , sock = zmq.socket('pull');

sock.connect('tcp://127.0.0.1:3000');
console.log('Worker connected to port 3000');

sock.on('message', function(msg){
  console.log('work: %s', msg.toString());
});

Running tests

Install dev deps:

 $ npm install

Build:

 $ make

Test:

 $ make test

Running benchmarks

Benchmarks are available in the perf directory, and have been implemented according to the zmq documentation: How to run performance tests

In the following examples, the arguments are respectively:

  • the host to connect to/bind on
  • message size (in bytes)
  • message count

You can run a latency benchmark by running these two commands in two separate shells:

node ./local_lat.js tcp://127.0.0.1:5555 1 100000
node ./remote_lat.js tcp://127.0.0.1:5555 1 100000

And you can run throughput tests by running these two commands in two separate shells:

node ./local_thr.js tcp://127.0.0.1:5555 1 100000
node ./remote_thr.js tcp://127.0.0.1:5555 1 100000

About

Node.js bindings to the zeromq library

Resources

License

Stars

Watchers

Forks

Packages

No packages published