书籍文库  |  文档资料  |  最近更新  |  MAP  |  TAG  | 
注册
手机版
就爱阅读网
当前位置:首页 > 电脑办公 > 电脑设计 > 程序设计 > node http性能测试实例

node http性能测试实例

分享人:kizimi 来源:互联网 时间:2018-08-26 06:05:00 阅读:0

一,开启Apache 二,简易http请求demo 三,执行测试命令

一,开启Apache
//开启apache:  sudo apachectl start//重启apache:  sudo apachectl restart//关闭apache:  sudo apachectl stop
二,简易http请求demo

http.js

var http = require('http')http  .createServer(function(req, res){ res.writeHead(200, {'Content-Type': 'text/plain'}) res.write('hello nodejs') res.end()  })  .listen(2015)

执行node http.js,运行起服务

三,执行测试命令

测试命令,请求数1000,并发数10

ab -n1000 -c10 https://localhost:2015/

测试结果

This is ApacheBench, Version 2.3 <$Revision: 1796539 $>Copyright 1996 Adam Twiss, Zeus Technology Ltd, https://www.zeustech.net/Licensed to The Apache Software Foundation, https://www.apache.org/Benchmarking localhost (be patient)Completed 100 requestsCompleted 200 requestsCompleted 300 requestsCompleted 400 requestsCompleted 500 requestsCompleted 600 requestsCompleted 700 requestsCompleted 800 requestsCompleted 900 requestsCompleted 1000 requestsFinished 1000 requestsServer Software:  Server Hostname:  localhostServer Port:2015Document Path: /Document Length:  12 bytesConcurrency Level:10Time taken for tests:0.234 secondsComplete requests:1000Failed requests:  0Total transferred:113000 bytesHTML transferred: 12000 bytesRequests per second: 4272.63 [#/sec] (mean)Time per request: 2.340 [ms] (mean)Time per request: 0.234 [ms] (mean, across all concurrent requests)Transfer rate: 471.49 [Kbytes/sec] receivedConnection Times (ms)  min  mean[+/-sd] medianmaxConnect:  0 00.10 2Processing:  0 21.5214Waiting:  0 21.4214Total: 1 21.5214Percentage of the requests served within a certain time (ms)  50%2  66%2  75%3  80%3  90%4  95%5  98%7  99%9 100%  14 (longest request)
就爱阅读www.92to.com网友整理上传,为您提供最全的知识大全,期待您的分享,转载请注明出处。

热点阅读

网友最爱