in Uncategorized

Node.js – Cost of IPC

I ran a quick test to quantify the cost of IPC between workers and the master in a node.js cluster. The test code is below (which I borrowed from node’s docs).

On receiving an HTTP request, each worker process sends a message to the master. I ran three variations – no messages, send one message, and send 5 messages.

1. Don’t send a message.

2. Send one message per request

3. Send five messages per request

These are done on Ubuntu 11.04 on a quad-core Xeon box using node 0.6.12.

Write a Comment



  1. Your js code for receiving a message could be using some extra cycles too with the unnecessary boolean check and potential type conversion in the second check.

    if(msg.cmd && msg.cmd == ‘notifyRequest’) {

    can be:

    if(msg.cmd === ‘notifyRequest’) {