PHP7+Swoole、Node Express、Sails、Beego、ThinkPHP 并发性能测试

简介: 最近由于产品业务出现请求瓶颈,需要更换产品框架,针对现在集中主流方案进行了逐一测试  服务器硬件配置:2 核 2G虚拟机 , 10000请求 500并发测试结果如下性能测试结果1、Nodejs Express测试结果如下 大约每秒处理2100请求 响应时间在230ms左右,cpu负...

最近由于产品业务出现请求瓶颈,需要更换产品框架,针对现在集中主流方案进行了逐一测试  

服务器硬件配置:2 核 2G虚拟机 , 10000请求 500并发测试结果如下


性能测试结果

1、Nodejs Express测试结果如下 大约每秒处理2100请求 响应时间在230ms左右,cpu负载百分之40左右

Server Software:
Server Hostname:        172.16.200.202
Server Port:            3000

Document Path:          /
Document Length:        12 bytes

Concurrency Level:      500
Time taken for tests:   4.692 seconds
Complete requests:      10000
Failed requests:        0
Total transferred:      2060000 bytes
HTML transferred:       120000 bytes
Requests per second:    2131.47 [#/sec] (mean)
Time per request:       234.580 [ms] (mean)
Time per request:       0.469 [ms] (mean, across all concurrent requests)
Transfer rate:          428.79 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        1   16   8.3     15      57
Processing:    71  212  31.0    204     359
Waiting:       71  211  31.0    203     359
Total:         86  228  29.0    221     380

Percentage of the requests served within a certain time (ms)
  50%    221
  66%    230
  75%    241
  80%    248
  90%    258
  95%    291
  98%    302
  99%    304
 100%    380 (longest request)


2、PHP7+Swoole 秒处理请求2300  响应时间40s左右 cpu只占用了15% 

Server Software:        12XueWeibo
Server Hostname:        172.16.200.202
Server Port:            3456

Document Path:          /
Document Length:        27 bytes

Concurrency Level:      100
Time taken for tests:   3.406 seconds
Complete requests:      8000
Failed requests:        0
Total transferred:      1584000 bytes
HTML transferred:       216000 bytes
Requests per second:    2348.89 [#/sec] (mean)
Time per request:       42.573 [ms] (mean)
Time per request:       0.426 [ms] (mean, across all concurrent requests)
Transfer rate:          454.18 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        4   18   2.9     19      28
Processing:    10   24   3.5     24      46
Waiting:       10   24   3.5     24      46
Total:         16   42   3.4     42      60

Percentage of the requests served within a certain time (ms)
  50%     42
  66%     44
  75%     44
  80%     45
  90%     46
  95%     48
  98%     49
  99%     51
 100%     60 (longest request)

3、Nodejs Sails  每秒处理500左右请求 每个请求响应用掉190ms 时间 cpu 百分之50左右


Benchmarking 172.16.200.202 (be patient)
Completed 800 requests
Completed 1600 requests
Completed 2400 requests
Completed 3200 requests
Completed 4000 requests
Completed 4800 requests
Completed 5600 requests
Completed 6400 requests
Completed 7200 requests
Completed 8000 requests
Finished 8000 requests


Server Software:
Server Hostname:        172.16.200.202
Server Port:            1337

Document Path:          /
Document Length:        10444 bytes

Concurrency Level:      100
Time taken for tests:   14.820 seconds
Complete requests:      8000
Failed requests:        0
Total transferred:      87740708 bytes
HTML transferred:       83552000 bytes
Requests per second:    539.81 [#/sec] (mean)
Time per request:       185.249 [ms] (mean)
Time per request:       1.852 [ms] (mean, across all concurrent requests)
Transfer rate:          5781.69 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        2   12  14.3     11    1231
Processing:    23  173  48.9    165     515
Waiting:       16  125  40.9    123     432
Total:         34  185  50.2    176    1313

Percentage of the requests served within a certain time (ms)
  50%    176
  66%    179
  75%    181
  80%    184
  90%    239
  95%    298
  98%    343
  99%    362
 100%   1313 (longest request)

4、golang Beego   每秒大约处理2400个请求  每个请求响应时间45ms  cpu 百分之15左右


Document Path:          /routerinfo
Document Length:        1152 bytes

Concurrency Level:      100
Time taken for tests:   3.494 seconds
Complete requests:      8000
Failed requests:        7641
   (Connect: 0, Receive: 0, Length: 7641, Exceptions: 0)
Total transferred:      10348153 bytes
HTML transferred:       9468153 bytes
Requests per second:    2289.46 [#/sec] (mean)
Time per request:       43.678 [ms] (mean)
Time per request:       0.437 [ms] (mean, across all concurrent requests)
Transfer rate:          2892.06 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        2   17   4.5     18      27
Processing:    11   26   8.0     24      85
Waiting:       11   26   8.0     24      85
Total:         15   43   6.9     42      96

Percentage of the requests served within a certain time (ms)
  50%     42
  66%     44
  75%     46
  80%     46
  90%     49
  95%     54
  98%     64
  99%     71
 100%     96 (longest request)


5、 ThinkPHP 请求量缩减10倍1000, 并发量缩减50倍10,结果如下 每秒106请求 平均响应时间 94ms ,目前api就是用的此框架 果断需要更换了

Server Software:        Tengine/2.1.2
Server Hostname:        api.uia.com
Server Port:            80

Document Path:          /index/index/index
Document Length:        622 bytes

Concurrency Level:      10
Time taken for tests:   9.405 seconds
Complete requests:      1000
Failed requests:        0
Total transferred:      960000 bytes
HTML transferred:       622000 bytes
Requests per second:    106.33 [#/sec] (mean)
Time per request:       94.047 [ms] (mean)
Time per request:       9.405 [ms] (mean, across all concurrent requests)
Transfer rate:          99.68 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        1    2   0.6      2       8
Processing:    32   92  14.5     91     170
Waiting:       32   92  14.4     91     170
Total:         33   94  14.5     93     172

Percentage of the requests served within a certain time (ms)
  50%     93
  66%     99
  75%    103
  80%    105
  90%    111
  95%    117
  98%    126
  99%    133
 100%    172 (longest request)




很显然从结果看来 Sails、ThinkPHP等 经过框架路由之后 损耗还是很严重的!! 







相关实践学习
通过性能测试PTS对云服务器ECS进行规格选择与性能压测
本文为您介绍如何利用性能测试PTS对云服务器ECS进行规格选择与性能压测。
目录
相关文章
原生php实现列表接口+分页接口+排序接口组合使用+包括测试数据(不加任何封装)
原生php实现列表接口+分页接口+排序接口组合使用+包括测试数据(不加任何封装)
原生php实现列表接口+分页接口+排序接口组合使用+包括测试数据(不加任何封装)
|
3月前
|
JSON JavaScript 前端开发
超级实用!详解Node.js中的util模块和express模块
超级实用!详解Node.js中的util模块和express模块
|
3月前
|
存储 JavaScript 数据库
nodejs中express框架实现增删改查接口
nodejs中express框架实现增删改查接口
|
11天前
|
开发框架 JavaScript 中间件
node+express搭建服务器环境
node+express搭建服务器环境
node+express搭建服务器环境
|
3月前
|
监控 供应链 测试技术
PTS压测问题之自动变成500 并发如何解决
PTS(Performance Testing Service)是一项面向网站、应用等提供的压力测试服务,用于模拟不同场景下的用户访问,评估系统的性能表现;在进行PTS压测时,可能会出现一些异常或报错,本合集将PTS压测中频繁出现的问题及其解决办法进行汇编,旨在帮助用户更有效地进行性能测试和问题定位。
277 2
|
7天前
|
开发框架 JavaScript 前端开发
【Node系列】Express 框架
Express.js 是一个基于 Node.js 平台的极简、灵活的 web 应用开发框架,提供一系列强大的特性来帮助你创建各种 web 和移动设备应用。
26 2
|
1月前
|
Web App开发 JavaScript 前端开发
使用Node.js和Express构建RESTful API
使用Node.js和Express构建RESTful API
16 0
|
1月前
|
弹性计算 缓存 测试技术
2核4g服务器能支持多少人访问?阿里云2核4G服务器并发数测试
2核4g服务器能支持多少人访问?阿里云2核4G服务器并发数测试,2核4G服务器并发数性能测试,阿小云账号下的2核4G服务器支持20人同时在线访问,然而应用不同、类型不同、程序效率不同实际并发数也不同,2核4G服务器的在线访问人数取决于多个变量因素
|
2月前
|
开发框架 JavaScript 前端开发
比较两个突出的node.js框架:koa和express
接上文讲述了 koa框架,这边文章比较一下这两个突出的node.js框架:koa和express