首页 > Web开发 > 详细

vertx.io 与nodejs 一个简单的性能比较

时间:2014-01-23 21:25:41      阅读:636      评论:0      收藏:0      [点我收藏+]

vertx.io 与node 都是可以进行js运行的一个引擎,但是vertx 支持的语言相对于node 多,可以查看官网。今天下网上查询相关的信息

时来了解到vertx.io 性能比node 好,于是自己编写简单的代码进行测试,同样书输出相同的信息。使用apache ab 模块进行性能呢比较。

1.node 端的代码:

var http = require(‘http‘);
http.createServer(function (req, res) {
  res.writeHead(200, {‘Content-Type‘: ‘text/html‘});
  res.end("<div><p>this is  the first paragraph <p></div>");
}).listen(3000, ‘127.0.0.1‘);

使用3000端口进行

2.vertx 端代码:

var vertx = require(‘vertx‘);

vertx.createHttpServer().requestHandler(function(req) {

  req.response.end("<div><p>this is  the first paragraph <p></div>");

}).listen(8080, ‘localhost‘);

3.运行脚本

分别进行

ab -n 1000 -c 100 http://localhost:8080/

ab -n 1000 -c 100 http://localhost:3000/

在测试时基本不相上下

ab -n 1000 -c 1000 http://localhost:8080/

ab -n 1000 -c 1000 http://localhost:3000/

在测试时基本不相上下但是vertx 会稍好一点

ab -n 5000 -c 1000 http://localhost:8080/

ab -n 5000 -c 1000 http://localhost:3000/

在测试时基本不相上下但是node会稍好一点

ab -n 50000 -c 1000 http://localhost:8080/

ab -n 50000 -c 1000 http://localhost:3000/

在测试时基本不相上下但是node会稍好一点

这是我一些简单的测试,基本上性能不相上下。

可能vertx 在处理其他的模型时,性能会更好吧。

vertx.io 与nodejs 一个简单的性能比较

原文:http://www.cnblogs.com/rongfengliang/p/3531110.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!