Skip to content

Use multi threaded node.js app for Express benchmark #1

@PuKoren

Description

@PuKoren

You are using only 1 core over the 32 available on the c3.8xlarge for the Express benchmark, while you compare with Crow and others in multi thread mode

It would be nice to update the express code to use fork method of Node.js

Code is quite easy (taken from http://rowanmanning.com/posts/node-cluster-and-express/)

// Include the cluster module
var cluster = require('cluster');

// Code to run if we're in the master process
if (cluster.isMaster) {

    var cpuCount = require('os').cpus().length;

    // Create a worker for each CPU
    for (var i = 0; i < cpuCount; i += 1) {
        cluster.fork();
    }
// Code to run if we're in a worker process
} else {

    // Include Express
    var express = require('express');

    // Create a new Express application
    var app = express();

    // Add a basic route – index page
    app.get('/', function (req, res) {
        res.send('Hello World!');
    });

    // Bind to a port
    app.listen(3000);
    console.log('Application running!');

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions