vertx.io 与nodejs 一个简单的性能比较
  TEZNKK3IfmPf 2024年03月22日 77 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 在处理其他的模型时,性能会更好吧。

【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2024年03月22日 0

暂无评论

推荐阅读
  TEZNKK3IfmPf   2024年04月12日   17   0   0 http
  TEZNKK3IfmPf   2023年11月14日   24   0   0 http
  TEZNKK3IfmPf   2024年03月29日   23   0   0 服务器http
  TEZNKK3IfmPf   2024年05月31日   26   0   0 httphttps
  TEZNKK3IfmPf   2024年04月19日   38   0   0 TCPhttp
  TEZNKK3IfmPf   2024年05月31日   35   0   0 服务器http
TEZNKK3IfmPf