alex@alex-ThinkPad-T430:~$ ab -n1000 -c100 192.168.1.81/release/test.apk
This is ApacheBench, Version 2.3 <$Revision: 1706008 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd,
Licensed to The Apache Software Foundation,
Benchmarking 192.168.1.81 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests
Server Software: Apache-Coyote/1.1
Server Hostname: 192.168.1.81
Server Port: 80
Document Path: /release/test.apk
Document Length: 20300487 bytes
Concurrency Level: 100
Time taken for tests: 6.486 seconds
Complete requests: 1000
Failed requests: 0
Total transferred: 20300772000 bytes
HTML transferred: 20300487000 bytes
Requests per second: 154.17 [#/sec] (mean)
Time per request: 648.617 [ms] (mean)
Time per request: 6.486 [ms] (mean, across all concurrent requests)
Transfer rate: 3056498.14 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 0.8 0 6
Processing: 43 638 333.7 519 2088
Waiting: 0 5 15.8 1 93
Total: 43 639 333.9 520 2091
WARNING: The median and mean for the initial connection time are not within a normal deviation
These results are probably not that reliable.
Percentage of the requests served within a certain time (ms)
50% 520
66% 672
75% 843
80% 883
90% 1085
95% 1334
98% 1528
99% 1781
100% 2091 (longest request)
我们可以看到1000个请求的总用时是6.486秒,下面再看看nodeJS的表现,nodeJS文件目录为项目目录/public/
同上面测试tomcat一样,测试同一个20m的apk文件,index.js的代码如下:
var express = require('express'); var app = express(); app.get('/', function (req, res) { res.send('Hello World!'); }); app.use(express.static('public')); var server = app.listen(3000, function () { var host = server.address().address; var port = server.address().port; console.log('Example app listening at %s:%s', host, port); });alex@alex-ThinkPad-T430:~$ ab -n1000 -c100 192.168.1.81:3000/test.apk
This is ApacheBench, Version 2.3 <$Revision: 1706008 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd,
Licensed to The Apache Software Foundation,
Benchmarking 192.168.1.81 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests
Server Software:
Server Hostname: 192.168.1.81
Server Port: 3000
Document Path: /test.apk
Document Length: 20300487 bytes
Concurrency Level: 100
Time taken for tests: 18.002 seconds
Complete requests: 1000
Failed requests: 0
Total transferred: 20300799000 bytes
HTML transferred: 20300487000 bytes
Requests per second: 55.55 [#/sec] (mean)
Time per request: 1800.207 [ms] (mean)
Time per request: 18.002 [ms] (mean, across all concurrent requests)
Transfer rate: 1101261.94 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.7 0 3
Processing: 1685 1798 43.1 1799 1876
Waiting: 32 53 11.1 52 87
Total: 1685 1798 43.0 1801 1876
Percentage of the requests served within a certain time (ms)
50% 1801
66% 1829
75% 1837
80% 1840
90% 1849
95% 1856
98% 1862
99% 1871
100% 1876 (longest request)
NodeJS总耗时为18.002秒,比tomcat的速度慢3倍左右。