当前位置:首页 > 服务器技术 > IIS

linux – node.js vs IIS 7.5性能

设置:

EC2上的2台机器,型号为m3.xlarge.

第一个用ubuntu服务器.

第二个是win2008r2.

ubuntu上的node.js使用基本示例返回对任何请求的字符串响应.

asp.net httphandler返回相同的响应.

使用https://github.com/newsapps/beeswithmachineguns
我使用10台机器执行200000并发2000(每台机器200)
我跑了基准并得到了:

的NodeJS:

 Complete requests:         200000

 Requests per second:       5605.170000 [#/sec] (mean)

 Time per request:          358.071900 [ms] (mean)

 50% response time:         31.000000 [ms] (mean)

 90% response time:         239.300000 [ms] (mean)

IIS:

 Complete requests:         200000

 Requests per second:       9263.810000 [#/sec] (mean)

 Time per request:          215.992900 [ms] (mean)

 50% response time:         214.000000 [ms] (mean)

 90% response time:         244.000000 [ms] (mean)

nodeJS代码是:

http.createServer(function (request, response) {
  response.writeHead(200, {'Content-Type': 'text/plain'});
  response.end('Some responsen');
}).listen(80);

httphandler代码是:

context.Response.Write("Some responsen" + Guid.NewGuid().ToString("N"));

我认为节点js会快得多,我做错了吗?

编辑:

在使用集群模块后,我从节点js每秒获得16685个请求
我将提出最强大的EC2实例并检查它们

解决方法:

m3.xlarge实例有几个cpu核心,而node.js是单线程的.您可以尝试对node.js cluster module进行基准测试,看看是否使用了更多的CPU帮助.并且,由于node.js是全新的,请确保使用最新的稳定系列(在编写本文时为0.8.x).


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!