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

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

服务器硬件配置: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等 经过框架路由之后 损耗还是很严重的!! 

时间: 2024-11-13 09:48:25

PHP7+Swoole、Node Express、Sails、Beego、ThinkPHP 并发性能测试的相关文章

Node & Express 入门指南

本文讲的是Node & Express 入门指南, Node 是一个 JavaScript 环境,使用了与谷歌 Chrome 浏览器相同的 JavaScript 引擎.Node 具有非常强大的功能,无论对 web 服务器还是 web 服务器的平台 API 来说,它都是搭建服务端应用中间层的诱人之选. 非阻塞事件驱动的 I/O 模型给予 Node 非常强大的性能,轻而易举地就能打败阻塞 I/O 和分线程处理多用户并发的线程服务器环境,比如 PHP 和 Ruby on Rails. 我曾经将千万级用

node+express+ejs制作简单页面上手指南_node.js

1.建立工程文件夹my_ejs. 2.首先利用npm install express和npm install ejs 下载这两个家伙.至于要不要设置成全局的,看习惯,我习惯性的下载到本项目中的文件夹中my_ejs. 然后建立相应的文件: index.js: form.ejs: index.ejs app.js: 开始运行app.js node app.js,然后再浏览器端访问:localhost:1337 单击发表文章: 点击发表,跳转到首页. 好了到此为止,一个简易的"网站"算是出来

node+express制作爬虫教程_node.js

最近开始重新学习node.js,之前学的都忘了.所以准备重新学一下,那么,先从一个简单的爬虫开始吧. 什么是爬虫 百度百科的解释: 爬虫即网络爬虫,是一种自动获取网页内容的程序.是搜索引擎的重要组成部分,因此搜索引擎优化很大程度上就是针对爬虫而做出的优化. 通俗一点讲: 把别人网站的信息给弄下来,弄到自己的电脑上.然后再做一些过滤,比如筛选啊,排序啊,提取图片啊,链接什么的.获取你需要的信息. 如果数据量很大,而且你的算法又比较叼,并且可以给别人检索服务的话,那么你的爬虫就是一个小百度或者小谷歌

node+express+jade制作简单网站指南_node.js

1.建立工程文件夹:my_jade 2.下载express和jade包到本地.我个人不喜欢下载成全局的,我喜欢下到工程文件夹中去. 3.建立相关的文件夹和文件. index.js: style.css gys.jade代码: index.jade: layout.jade app.js 运行app.js:node app.js; 在浏览器中预览: 在看一个不使用页面布局的例子: 修改index.js 修改app.js 运行app.js在浏览器中预览: 单击提交 会触发ajax. .本文就先到这里

一个node+express+socket.io开发的聊天室源码

首先是下载包: npm install express npm install socket.io 建立文件:   开发的聊天室源码-express socket聊天室">   服务器端代码:server.js    代码如下 复制代码 var http=require("http"); var express=require("express"); var sio=require("socket.io"); var app=ex

Java中的HashMap和ConcurrentHashMap的并发性能测试

先看看代码吧,模拟1000个并发,每个测试1000次操作,循环测试10轮.分别测试Put和Get操作import java.util.Collections; import java.util.HashMap; import java.util.Hashtable; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; /** * 测试HashMap和ConcurrentHashMap的并发性能差别. * * @

badboy + jmeter并发性能测试

今天下班时公司安排了一个同事来对项目做集群性能测试,怀着对性能测试的好奇心,下班后没有着急离开,而是等待 那位同事的到来,然后在旁边学习了下如何使用Badboy和jmeter做性能测试. 1. 软件介绍 1.1 Badboy Badboy,第一眼看见这个单词,以为是坏孩子的意思,后来一想,它是专门用来给项目找茬来的,取名为Badboy 倒是平添了几分可爱,呵呵. Badboy是用来录制操作过程的,它录制的结果是被jmeter做并发测试的素材使用. Badboy首页:http://www.badb

Redis并发性能测试

H:\redis-lhc-V1.0\Redis-x64-3.0.501>redis-benchmark -h 127.0.0.1 -p 6379 -t set,push,get -c 10000 -n 100000

使用Node.js、Express、MongoDB和AngularJS构建问卷调查应用程序

在前端,该应用程序会使用 AngularJS 和 Bootstrap 支持用户界面,并使用 Web Sockets 来支持投票,以便实时更新客户端. 最近,在向大学生们介绍 HTML5 的时候,我想要对他们进行问卷调查,并向他们显示实时更新的投票结果.鉴于此目的,我决定快速构建一个用于此目的的问卷调查应用程序.我想要一个简单的架构,不需要太多不同的语言和框架.因此,我决定对所有一切都使用 JavaScript - 对服务器端使用 Node.js 和 Express,对数据库使用 MongoDB,