Over a million developers have joined DZone.

Node.js vs. ASP.NET Web API

DZone's Guide to

Node.js vs. ASP.NET Web API

· Web Dev Zone ·
Free Resource

Bugsnag monitors application stability, so you can make data-driven decisions on whether you should be building new features, or fixing bugs. Learn more.

imageMuch has been said about the Node.js’s great performance so I wanted to test out how it compares to an ASP.NET Web Api backend.I created a simple server for both of the platforms which accepts a POST-request and then responds back with the request’s body.

The Node.js and ASP.NET Web Api implementations

Here’s the Node.js code:

var express = require('express')
    , app = express.createServer();
app.post('/', function(req, res){

And here’s the ASP.NET Web Api controller:

public class ValuesController : ApiController
    // POST /api/values
    public Task<string> Post()
        return this.ControllerContext.Request.Content.ReadAsStringAsync();


I used Apache’s ab tool to test the performance of the platforms. The benchmark was run with the following settings:

  • Total number of requests: 100 000
  • Concurrency: 100

The benchmark (test.dat) contained a simple JSON, taken from Wikipedia.

     "firstName": "John",
     "lastName" : "Smith",
     "age"      : 25,
     "address"  :
         "streetAddress": "21 2nd Street",
         "city"         : "New York",
         "state"        : "NY",
         "postalCode"   : "10021"
           "type"  : "home",
           "number": "212 555-1234"
           "type"  : "fax",
           "number": "646 555-4567"

Here’s the whole command which was used to run the performance test:

ab -n 100000 -c 100 -p .\test.dat -T 'application/json; charset=utf-8' http://localhost/

The performance test was run 3 times and the best result for each platform was selected. The performance difference between the test runs was minimal.

Test Environment

The benchmark was run on a Windows Server 2008 R2, hosted on an c1.medium Amazon EC2 –instance:


Specs of the instance

  • 1.7GB memory
  • 5 EC2 Compute Units (2 virtual cores)


  • Node.js: 0.6.17
  • ASP.NET Web Api: Current release (12.5.2012)
  • IIS: 7

Both the Node and IIS –servers were run with their out-of-the-box settings.

Benchmark Results


  Web Api Node.js
Time taken (in s) 89.95 41.65
Requests per second 1111.69 2400.89
Time per request (in ms) 89.95 41.65
Failed requests 0 0


The out-of-the-box performance of the Node.js seems to be better than the performance of the ASP.NET Web Api + IIS7. Tweaking the IIS7’s settings could make the ASP.NET Web Api perform better but for this test the default settings of IIS7 were used.

Monitor application stability with Bugsnag to decide if your engineering team should be building new features on your roadmap or fixing bugs to stabilize your application.Try it free.


Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}