113 Comments

image

Much 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.

Update 24.6.2012: Updated tests with some tweaks.

The Node.js and ASP.NET Web Api implementations

Here’s the Node.js code:

var express = require('express')
    , app = express.createServer();

app.use(express.bodyParser());

app.post('/', function(req, res){
    res.send(req.body);
});

app.listen(3000);

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();
        }
    }

Benchmark

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"
     },
     "phoneNumber":
     [
         {
           "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:

image

Specs of the instance

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

Versions

  • Node.js: 0.6.17
  • ASP.NET Web Api: The official beta release.
  • IIS: 7

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

Benchmark Results

image

 Web ApiNode.js
Time taken (in s)89.9541.65
Requests per second1111.692400.89
Time per request (in ms)89.9541.65
Failed requests00

Conclusion

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.

Comments

Comment by Cheap Oakley Sunglasses

Cheap Oakley Sunglasses...

This article is really good, people do not be conscious of the author''''s writing situations. I want to put forward it to more people, so the more the body will be such a wonderful feeling....

Comment by www.okfakeoakleys.info

www.okfakeoakleys.info...

I would like to understand when you write this article is what kind of mood, why would you write this article, also written so splendid, is that I can emulate. I think I could record something like you....

Comment by Jone Polvora

Nice post. But I think the default pipeline of ASP.NET stack is not simpler than your node setup. Take a look at this post. jameschambers.com/.../ . asp.net mvc do a lot more things by default. A fair comparison would be forcing node to do the same things that asp.net do. Or you must create an empty asp.net application, disable all handlers and create a custom IHttpHandler.

Comment by mulberry outlet

mulberry outlet...

Josefina Vazquez Mota said she will invite current Mexican President Felipe Calderon to become the nation's attorney general if she wins Sunday's election. The track incorporates live recordings from her hotel stay while bombers raided the city. Call...

Comment by ボッテガヴェネタ 財布

ボッテガヴェネタ 財布...

どうしたの、私はちょうどしたかったあなたを教えて、あなたは間違っている。あなたのポイント ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen は何の意味もなさない。...

Comment by ポーター トートバッグ

ポーター トートバッグ...

導入 YouTubeのビデオチュートリアル この場所で転記され、私も自分のウェブサイト ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen 、 取る楽埋め込みコードを取得する。...

Comment by サマンサタバサ バッグ

サマンサタバサ バッグ...

このことから、情報ダウンロードするマウスではなく、他の Webページ ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen ページにあちこちシフト私|交通|の転送ブログ。...

Comment by GaGa MILANO

GaGa MILANO...

こんにちは、全部 ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen がうまく起こっているこことofcourseの一人一人が事実、その内事実 良い、書き込みついていく。...

Comment by フェラガモ 財布

フェラガモ 財布...

その本当に A 良い 映画 トライ指摘このポスト ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen 約、そう私はここから明確なアイデアを得ました。...

Comment by グッチ アウトレット 財布

グッチ アウトレット 財布...

うわー、良い ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen のおかげでそれを維持。...

Comment by サマンサタバサ 財布

サマンサタバサ 財布...

私は実際午前このウェブページ 満足 一目読み取るするためにどの%記事を**** この 統計。...

Comment by セリーヌ アウトレット

セリーヌ アウトレット...

こんにちは、読んだ後にこの素晴らしい 記事 ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen I午前も 幸せ共有することが私の経験精通ここで同僚。...

Comment by オークリー メガネ

オークリー メガネ...

それはのみさ Webサイト ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen あなたを支援するための似|適当}場??所や他の人にも{同じことをするでしょう。...

Comment by バーバリー

バーバリー...

これらは本当に内事実 巨大 でアイデアブログ ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen 。ここで 要因は、いくつかの楽しいに触れた。何か方法はwrintingついていく。...

Comment by ケイトスペード iphone5ケース

ケイトスペード iphone5ケース...

こんにちは 同僚、その偉大 ポスト%を ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen %についてと完全 説明が定義、すべての時間をそれを維持する。...

Comment by ティファニー

ティファニー...

あなたがいる場合は準備鑑賞するユーモラスビデオ Web上 |行くには、私はあなたがこのウェブサイトクイック訪問を支払う Webページ、それ ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen は含まれています運び 材料真に|真に} そう ユーモラスだけでなく動画も{その他|追加| もの余分。...

Comment by モンブラン アウトレット

モンブラン アウトレット...

アメージングビデオ、実際 A 楽しい%を ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen %の品質を、このYouTubeのビデオはの点で私をたくさん触れ機能。...

Comment by ポーター 財布

ポーター 財布...

I 進む 日常 一部 記事やレビューとウェブサイトのコンテンツを、しかしこのブログ 与える 品質 書き込み ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen 。...

Comment by トリーバーチ アウトレット

トリーバーチ アウトレット...

今私は行く離れて午前私の朝食を行うために後 |まだ再び私の朝食は、再び来ることやり直す更ニュース ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen 。...

Comment by アバクロンビー&amp;フィッチ tシャツ

アバクロンビー&フィッチ tシャツ...

のような内容私がやる、だけ 見に行くクイック訪問を支払うこの Webページ ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen すべての時間 以降それは提供する理由でプレゼントを 機能の内容のおかげで、...

Comment by ゴヤール 財布

ゴヤール 財布...

いい何YouTubeのビデオをそれはある! 恐ろしい、私は|それスキ愛さ、と私は、このYouTubeに共有していますすべての私とフィルム 友人同僚 ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen 。...

Comment by フェラガモ カチューシャ

フェラガモ カチューシャ...

私と私の、彼らが持っているので、から すべての時間のためにいつものYouTubeでゲームクリップ友人 サッカーを見る気難しい品質 ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen 。...

Comment by モンブラン 万年筆

モンブラン 万年筆...

まで何にすべて、内容|この時現在既存 ウェブサイト%が ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen %は本当に実際に すばらしい人体験のために良い仕事の仲間|知識}を、よく、{素敵を維持する。...

Comment by オークリー サングラス アウトレット

オークリー サングラス アウトレット...

する取得 良い取引この%から ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen %その後、これらはが望むしたい場合は 戦略 サイト。...

Comment by バーバリー ワンピース

バーバリー ワンピース...

方法 Webサイトブログ ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen あなたのの賛成での支援のためのトラフィックを増やすための1追加の他のよりはもありますリンク交換つまり、したがってはもそれを試してみてください...

Comment by ケイトスペード リボン マザーバッグ

ケイトスペード リボン マザーバッグ...

不確実性非常にまもなくこれの管理がないサイトのウェブサイトのウェブページが働いている、以降 ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen その品質による%、それが有名な有名な有名なになります内容。...

Comment by サマンサタバサ

サマンサタバサ...

そのこのウェブサイトのウェブページを、私は客員このを見に行くするために私が初めてではないウェブサイト daillyと得る 楽しい データ ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen ここから毎日。...

Comment by モンブラン

モンブラン...

誰かが書き込むと記事彼/彼女維持 アイデア彼/彼女の中でユーザーの心脳その方法それはユーザーが知っているのに注意して理解することができます。 したがってその理由は、このポスト ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen です outstdanding。ありがとう!...

Comment by ray ban magasin

ray ban magasin...

Cool article, It was funny...

Comment by newbalanceoutletstores.net

newbalanceoutletstores.net...

Hello! I know this is kinda off topic but I was wondering if you knew where I could find a captcha plugin for my comment form? I'm using the same blog platform as yours and I'm having trouble finding one? Thanks a lot!...

Comment by new balance 人気

new balance 人気...

アメージング!私は純粋あなたのデザインとスタイルスタイルとデザインレイアウト サイト。 テーマは を使用しているか、この自由が個人ユーザはすべてが利用できる?あなたがあれば本当にありませんでそれの名前を言いたい一般市民、メールでの連絡先私。この上で私の手を得るためにテーマ私は本当に好きは絶対にラブラブたい! ありがとう。...

Comment by ray ban sunglasses sale

ray ban sunglasses sale...

Greetings. I am wondering if you might be interested in doing a website link exchange? I notice your blog: and my website are based mostly around the same subject. I'd really like to switch links or perhaps guest author a article for you. Here is my p...

Comment by cheap ray ban

cheap ray ban...

Nice article, It was funny...

Comment by toms outlet online

toms outlet online...

Hello. I noticed your blog title, "" does not really reflect the content of your site. When creating your website title, do you think it's best to write it for Search engine marketing or for your viewers? This is something I've been struggling with...

Comment by ニューバランス 店舗

ニューバランス 店舗...

こんにちはあなたの心でしょう共有するあなたはと一緒に仕事をすることしているどのブログプラットフォーム?私はつもりだ近日私自身のブログを開始することが、私はタフ抱え時間 BlogEngineの間/ Wordpress/B2evolutionとDrupalの。私は質問の理由は、あなたのためですデザインとスタイル私は完全にユニーク何かを探していますし、ほとんどのブログ、異なるようです。 PS用私の謝罪 さトピックオフが、私は聞いていた!...

Comment by ray ban 3447

ray ban 3447...

I’m not sure if this is a formatting issue or something to do with web browser compatibility but I figured I’d post to let you know....

Comment by tiffanyandcojewelleryuk.com

tiffanyandcojewelleryuk.com...

Gday! I am about to start my own website and was wondering if you know where the best place to purchase a blog url is? I am not even sure if that's what its known as? (I'm new to this) I'm referring to ". How do I go about getting one of these for ...

Comment by sport blue 6s

sport blue 6s...

president's chance to transform himself from war maker by inheritance to his own kind of peace maker,...

Comment by Nike Air Max 1 Liberty

Nike Air Max 1 Liberty...

ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen zcyeujd Nike Air Max 90 Femme...

Comment by jordan 6 sport blue

jordan 6 sport blue...

hundreds of military families who are selected to attend....

Comment by Nike Air Max Pas Cher

Nike Air Max Pas Cher...

ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen qzbburci Nike Air Max 90...

Comment by Nike Air Max 1 Pas Cher

Nike Air Max 1 Pas Cher...

ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen gwkipzps Nike Air Max 1 Essential...

Comment by Nike Air Max 90 Pas Cher

Nike Air Max 90 Pas Cher...

ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen pjxdsm Nike Air Max Pas Cher...

Comment by Nike Air Max High Heels

Nike Air Max High Heels...

ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen uvunuxy Nike High Heels...

Comment by Jordan High Heels

Jordan High Heels...

ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen fnrnvd Jordan High Heels For Sale...

Comment by Jordan High Heels

Jordan High Heels...

ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen onpzfy Nike High Heels...

Comment by Nike High Heels 2013

Nike High Heels 2013...

ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen pmfspa Cheap Nike High Heels...

Comment by jordan outlet

jordan outlet...

An investigation by Kansas City Police revealed Belcher and Perkins had a volatile, but not violent, relationship. They argued about money and partying, and Perkins had left Belcher at least once after their daughter was born, and had received couples ...

Comment by louis vuitton sale

louis vuitton sale...

see a cab pull over into the bike lane to let someone off and a cyclist DOESN'T...

Comment by cheap kobe 8 shoes

cheap kobe 8 shoes...

ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen twobsy cheap kobe 8 shoes...

Comment by nike air max 2014 mens

nike air max 2014 mens...

ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen unsghjna nike air max 2014 mens...

Comment by Cheap Nike Lebron 10(X) For Sale

Cheap Nike Lebron 10(X) For Sale...

ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen uevjkvemsl cheap lebron x...

Comment by nike air max 2011 mens

nike air max 2011 mens...

ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen lvzavocgzw cheap nike air max 2013...

Comment by Men Coach Shoes

Men Coach Shoes...

David, the freshman forward, became so embarrassed that he ignored team tradition and stopped wearing a tie to school on game days. His low point came on Jan.18, after Gunderson lost again, to EvergreenValley. In the locker room David began to cry, som...

Comment by Coach Backpack Poppy

Coach Backpack Poppy...

with free shipping both ways available at rather low prices from online store for as well as purses and accessories. Many in varied styles available with fast delivery and friendly service....

Comment by cheap lebron 9 for sale

cheap lebron 9 for sale...

ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen okewcpddqiq Cheap Lebron 9 Shoes Sale online...

Comment by jordan outlet online

jordan outlet online...

The situation in Europe is being torn asunder. We need to face the facts: European leaders, after two years have not solved any of their problems (they will meet to discuss them); Greece will leave the euro . He and the credit union workers said they h...

Comment by louis vuitton online

louis vuitton online...

city's main street. Would go over to see how much I got wrong by walking the...

Comment by kate spade paris

kate spade paris...

ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen orgfjomp Luis Vuitton Factory Outlet eayetncyct Luis Vuitton Outlet esnngztee Louis Vuiton Outlet Store czxrjtov Luis Vuitton iypmtkjgwkb Luis Vuitton Factory Outlet wvjksbx Luis Vuitton Outlet llb...

Comment by abercrombie kids

abercrombie kids...

ASP.NET Web Api vs Node.js Benchmark - Mikael Koskinen nguxiqcem Luis Vuitton Factory Outlet gylsekkz Luis Vuitton Outlet alvexu Louis Vuiton Outlet Store zbhbejeuw Luis Vuitton mmndfiuma Luis Vuitton Factory Outlet usfjbsx Luis Vuitton Outlet bjlihmh ...

Comment by nike free run 2 dam

nike free run 2 dam...

Have you thought about adding some videos to the article? I think it might enhance viewers understanding....

Comment by jordan classic shoes

jordan classic shoes...

The children had a fabulous time and even our 16 month old could be included in our activites. On other days, we had no hesitation whatsoever in leaving our children in the caring and wonderful hands of Nathalie and her amazing staff. There is even a f...

Comment by new jordan release dates

new jordan release dates...

The protests in Tunisia were sparked by the suicide of an unemployed college graduate in December, CNN reports. The man set himself on fire in front of a government building in the town of Sidi Bouzid after police confiscated his fruit cart, saying he ...

Comment by Jordan 11 Legend Blue

Jordan 11 Legend Blue...

The second factor is that Dominion is paying far more for the oil, natural gas and coal that it burns to produce power than it has been allowed to pass on to Virginians' bills since 2004. The technology in the hands of the US govt today is frightening...

Comment by ヴィトン ブランド バッグ ショルダー

ヴィトン ブランド バッグ ショルダー...

know: if you regarding workout is for sissies, Then you must know that this working out is being carried out every and every day written by practitioner some athletes, outstanding internet marketers and most of the leaders anywhere. in the bottom of ea...

Comment by Jordan 13 Barons

Jordan 13 Barons...

While your teenager is sharing something with you, she is doing several things. It's not thatApple needs the help, of course the company is actuallythe largest in existence, with a net worth nearing half a trillion dollars. Amateur ChampionshipPosted ...

Comment by jordan 6 sprot blue

jordan 6 sprot blue...

It would have been nice to see some sturdy metal instead. According to a source close to the team, Bisciotti has been working to bridge a gap with Ogden over the issue of cutting his younger brother in training camp, hoping to lure the likely Hall of F...

Comment by jordan 6 black infrared

jordan 6 black infrared...

"That's the fastest way to get him to clam up again," says Faber. The SteelSeries Siberia V2 USB powered headset has been an award winning headset for some time, comes in various colors and is mainly used by gaming enthusiasts throughout the world. ...

Comment by Legend Blue 11s

Legend Blue 11s...

Those who pass will receive the license in the mail.. I raised the case merely as an example of how crazy the year had been in terms of the number of murders I mean two cases in the last few hours of 2008? It is nuts.. Each commentator wants to overest...

Comment by Black Infrared 6s

Black Infrared 6s...

0 39:21 Oh, we're still doing those "call a timeout after they call a timeout" charades this year? Good to know. Identify any looming surprises or crises and areas of unfinished business, or whether a team member may need extra support or backup cov...

Comment by Gucci Zoo Outlet

Gucci Zoo Outlet...

ubagsoutlet.com.2233...