This is ApacheBench, Version 2.3 <$Revision: 1706008 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Server Software: Server Hostname: localhost Server Port: 3000
Document Path: XXXXX Document Length: 42477 bytes
Concurrency Level: 10 Time taken for tests: 3.002 seconds Complete requests: 124 Failed requests: 0 Total transferred: 5467136 bytes HTML transferred: 5437056 bytes Requests per second: 41.31 [#/sec] (mean) Time per request: 242.097 [ms] (mean) Time per request: 24.210 [ms] (mean, across all concurrent requests) Transfer rate: 1778.48 [Kbytes/sec] received
Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.3 0 1 Processing: 191 231 20.2 230 300 Waiting: 191 230 20.0 229 296 Total: 191 232 20.2 230 300
Percentage of the requests served within a certain time (ms) 50% 230 66% 234 75% 235 80% 238 90% 246 95% 285 98% 294 99% 298 100% 300 (longest request) Finished 124 requests
This is ApacheBench, Version 2.3 <$Revision: 1706008 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Server Software: Server Hostname: localhost Server Port: 3000
Document Path: XXXXX Document Length: 42477 bytes
Concurrency Level: 10 Time taken for tests: 3.006 seconds Complete requests: 209 Failed requests: 0 Total transferred: 8926808 bytes HTML transferred: 8877693 bytes Requests per second: 69.53 [#/sec] (mean) Time per request: 143.828 [ms] (mean) Time per request: 14.383 [ms] (mean, across all concurrent requests) Transfer rate: 2900.06 [Kbytes/sec] received
Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.3 0 1 Processing: 113 142 17.5 137 189 Waiting: 112 141 17.5 137 188 Total: 114 142 17.5 137 189
Percentage of the requests served within a certain time (ms) 50% 137 66% 143 75% 156 80% 160 90% 168 95% 179 98% 183 99% 185 100% 189 (longest request) Finished 209 requests
可以看见,对比 QPS(或 RPS,Requests per second),development:production = 41.31:69.53 [#/sec] (mean);对比平均用户请求等待时间(Time per request),development:production = 242.097:143.828 [ms] (mean)。基本上单个请求快了 100 ms 左右。
虽然没有官网上说的「3 倍」那么夸张,不过按文档上说还会「高速缓存视图模板」和「高速缓存从 CSS 扩展生成的 CSS 文件」,而我测试的是一个纯 API 接口,只返回 JSON 数据,所以理论上 HTML 页面打开的速度的对比应该会更加明显(之后也测试了这种情况,速度要快 1/3 左右)。