一、环境介绍

  • linux centos7
  • php7.1.18
  • go1.12.1
  • 2核4G内存

二、代码

  • swoole代码
<?php
$http = new swoole_http_server("127.0.0.1", 9501); $http->on("start", function ($server) {
echo "Swoole http server is started at http://127.0.0.1:9501\n";
}); $http->on("request", function ($request, $response) {
$response->header("Content-Type", "text/html");
$response->end("Hello World\n");
}); $http->start();
  • golang 代码
package main
import (
"io"
"net/http"
)
func main() {
http.ListenAndServe("0.0.0.0:9502", http.HandlerFunc(handle))
}
func handle(rw http.ResponseWriter, r *http.Request) {
rw.Header().Set("Content-Type", "text/html")
io.WriteString(rw, "Hello World\n")
}

三、开始测试

3.1 ab -n 100 -c 10

swoole

Document Path:          /
Document Length: 12 bytes Concurrency Level: 10
Time taken for tests: 0.014 seconds
Complete requests: 100
Failed requests: 0
Write errors: 0
Total transferred: 16000 bytes
HTML transferred: 1200 bytes
Requests per second: 6957.01 [#/sec] (mean)
Time per request: 1.437 [ms] (mean)
Time per request: 0.144 [ms] (mean, across all concurrent requests)
Transfer rate: 1087.03 [Kbytes/sec] received Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.1 0 1
Processing: 0 1 0.3 1 2
Waiting: 0 1 0.2 1 1
Total: 1 1 0.3 1 2 Percentage of the requests served within a certain time (ms)
50% 1
66% 1
75% 1
80% 2
90% 2
95% 2
98% 2
99% 2
100% 2 (longest request)

golang

Server Software:
Server Hostname: 127.0.0.1
Server Port: 9502 Document Path: /
Document Length: 12 bytes Concurrency Level: 10
Time taken for tests: 0.021 seconds
Complete requests: 100
Failed requests: 0
Write errors: 0
Total transferred: 11300 bytes
HTML transferred: 1200 bytes
Requests per second: 4760.54 [#/sec] (mean)
Time per request: 2.101 [ms] (mean)
Time per request: 0.210 [ms] (mean, across all concurrent requests)
Transfer rate: 525.33 [Kbytes/sec] received Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.2 0 1
Processing: 0 1 0.8 1 8
Waiting: 0 1 0.7 1 7
Total: 0 1 0.8 1 8 Percentage of the requests served within a certain time (ms)
50% 1
66% 2
75% 2
80% 2
90% 2
95% 2
98% 2
99% 8
100% 8 (longest request)

3.2 ab -n 1000 -c 100

swoole

Server Software:        swoole-http-server
Server Hostname: 127.0.0.1
Server Port: 9501 Document Path: /
Document Length: 12 bytes Concurrency Level: 100
Time taken for tests: 0.094 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 160000 bytes
HTML transferred: 12000 bytes
Requests per second: 10680.68 [#/sec] (mean)
Time per request: 9.363 [ms] (mean)
Time per request: 0.094 [ms] (mean, across all concurrent requests)
Transfer rate: 1668.86 [Kbytes/sec] received Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 2 1.2 2 6
Processing: 2 7 3.0 6 14
Waiting: 0 6 2.5 5 13
Total: 4 9 2.9 8 18 Percentage of the requests served within a certain time (ms)
50% 8
66% 9
75% 10
80% 11
90% 13
95% 14
98% 17
99% 17
100% 18 (longest request)

golang

Server Software:
Server Hostname: 127.0.0.1
Server Port: 9502 Document Path: /
Document Length: 12 bytes Concurrency Level: 100
Time taken for tests: 0.107 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 113000 bytes
HTML transferred: 12000 bytes
Requests per second: 9331.75 [#/sec] (mean)
Time per request: 10.716 [ms] (mean)
Time per request: 0.107 [ms] (mean, across all concurrent requests)
Transfer rate: 1029.77 [Kbytes/sec] received Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 1.4 1 6
Processing: 1 9 5.3 8 35
Waiting: 0 8 5.0 7 34
Total: 1 10 4.9 9 38 Percentage of the requests served within a certain time (ms)
50% 9
66% 11
75% 13
80% 14
90% 17
95% 18
98% 20
99% 25
100% 38 (longest request)

3.3 ab -n 10000 -c 1000

swoole

Server Software:        swoole-http-server
Server Hostname: 127.0.0.1
Server Port: 9501 Document Path: /
Document Length: 12 bytes Concurrency Level: 1000
Time taken for tests: 0.868 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 1600000 bytes
HTML transferred: 120000 bytes
Requests per second: 11515.25 [#/sec] (mean)
Time per request: 86.841 [ms] (mean)
Time per request: 0.087 [ms] (mean, across all concurrent requests)
Transfer rate: 1799.26 [Kbytes/sec] received Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 4 4.7 3 30
Processing: 3 11 5.0 10 216
Waiting: 0 9 4.7 9 214
Total: 6 15 7.1 14 239 Percentage of the requests served within a certain time (ms)
50% 14
66% 15
75% 16
80% 17
90% 20
95% 26
98% 41
99% 42
100% 239 (longest request)

golang

Document Path:          /
Document Length: 12 bytes Concurrency Level: 1000
Time taken for tests: 1.018 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 1130000 bytes
HTML transferred: 120000 bytes
Requests per second: 9823.25 [#/sec] (mean)
Time per request: 101.799 [ms] (mean)
Time per request: 0.102 [ms] (mean, across all concurrent requests)
Transfer rate: 1084.01 [Kbytes/sec] received Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 5 6.6 3 37
Processing: 0 13 9.3 12 209
Waiting: 0 11 8.2 10 205
Total: 0 18 13.5 15 210 Percentage of the requests served within a certain time (ms)
50% 15
66% 17
75% 19
80% 21
90% 33
95% 45
98% 66
99% 77
100% 210 (longest request)

3.4 ab -n 100000 -c 10000

swoole

Server Software:        swoole-http-server
Server Hostname: 127.0.0.1
Server Port: 9501 Document Path: /
Document Length: 12 bytes Concurrency Level: 10000
Time taken for tests: 9.582 seconds
Complete requests: 100000
Failed requests: 0
Write errors: 0
Total transferred: 16000000 bytes
HTML transferred: 1200000 bytes
Requests per second: 10436.61 [#/sec] (mean)
Time per request: 958.166 [ms] (mean)
Time per request: 0.096 [ms] (mean, across all concurrent requests)
Transfer rate: 1630.72 [Kbytes/sec] received Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 487 535.1 297 7133
Processing: 62 374 115.8 388 832
Waiting: 0 286 96.7 273 704
Total: 161 861 549.7 696 7350 Percentage of the requests served within a certain time (ms)
50% 696
66% 826
75% 912
80% 1225
90% 1607
95% 1739
98% 2005
99% 3442
100% 7350 (longest request)

golang

Document Path:          /
Document Length: 12 bytes Concurrency Level: 10000
Time taken for tests: 16.700 seconds
Complete requests: 100000
Failed requests: 0
Write errors: 0
Total transferred: 11300000 bytes
HTML transferred: 1200000 bytes
Requests per second: 5987.91 [#/sec] (mean)
Time per request: 1670.033 [ms] (mean)
Time per request: 0.167 [ms] (mean, across all concurrent requests)
Transfer rate: 660.77 [Kbytes/sec] received Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 709 1278.7 20 7048
Processing: 0 72 324.6 34 13554
Waiting: 0 66 324.3 27 13553
Total: 1 781 1357.7 64 16588 Percentage of the requests served within a certain time (ms)
50% 64
66% 1029
75% 1047
80% 1061
90% 3041
95% 3091
98% 7041
99% 7083
100% 16588 (longest request)

3.5 ab -n 200000 -c 20000

swoole

Server Software:        swoole-http-server
Server Hostname: 127.0.0.1
Server Port: 9501 Document Path: /
Document Length: 12 bytes Concurrency Level: 20000
Time taken for tests: 20.057 seconds
Complete requests: 200000
Failed requests: 0
Write errors: 0
Total transferred: 32000000 bytes
HTML transferred: 2400000 bytes
Requests per second: 9971.56 [#/sec] (mean)
Time per request: 2005.704 [ms] (mean)
Time per request: 0.100 [ms] (mean, across all concurrent requests)
Transfer rate: 1558.06 [Kbytes/sec] received Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 913 689.1 696 15748
Processing: 324 966 229.3 959 1970
Waiting: 0 736 189.6 743 1556
Total: 909 1879 716.9 1659 16114 Percentage of the requests served within a certain time (ms)
50% 1659
66% 1842
75% 2129
80% 2427
90% 2605
95% 2744
98% 4279
99% 4522
100% 16114 (longest request)

golang

Server Software:
Server Hostname: 127.0.0.1
Server Port: 9502 Document Path: /
Document Length: 12 bytes Concurrency Level: 20000
Time taken for tests: 34.083 seconds
Complete requests: 200000
Failed requests: 0
Write errors: 0
Total transferred: 22600000 bytes
HTML transferred: 2400000 bytes
Requests per second: 5868.07 [#/sec] (mean)
Time per request: 3408.274 [ms] (mean)
Time per request: 0.170 [ms] (mean, across all concurrent requests)
Transfer rate: 647.55 [Kbytes/sec] received Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1328 2378.8 466 15093
Processing: 0 171 1106.5 44 26576
Waiting: 0 163 1106.7 37 26573
Total: 0 1499 2775.8 709 33626 Percentage of the requests served within a certain time (ms)
50% 709
66% 1069
75% 1190
80% 3031
90% 3209
95% 7080
98% 8709
99% 15161
100% 33626 (longest request)

3.6 ab -n 300000 -c 20000

swoole

Server Software:        swoole-http-server
Server Hostname: 127.0.0.1
Server Port: 9501 Document Path: /
Document Length: 12 bytes Concurrency Level: 20000
Time taken for tests: 29.131 seconds
Complete requests: 300000
Failed requests: 0
Write errors: 0
Total transferred: 48000000 bytes
HTML transferred: 3600000 bytes
Requests per second: 10298.19 [#/sec] (mean)
Time per request: 1942.089 [ms] (mean)
Time per request: 0.097 [ms] (mean, across all concurrent requests)
Transfer rate: 1609.09 [Kbytes/sec] received Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 944 887.3 691 15919
Processing: 294 938 220.0 923 2056
Waiting: 0 743 203.4 717 1877
Total: 725 1882 922.0 1665 16908 Percentage of the requests served within a certain time (ms)
50% 1665
66% 1843
75% 2125
80% 2263
90% 2641
95% 2994
98% 4552
99% 4814
100% 16908 (longest request)

golang

已无法承受压力

3.7 ab -n 400000 -c 20000

swoole

Server Software:        swoole-http-server
Server Hostname: 127.0.0.1
Server Port: 9501 Document Path: /
Document Length: 12 bytes Concurrency Level: 20000
Time taken for tests: 39.223 seconds
Complete requests: 400000
Failed requests: 0
Write errors: 0
Total transferred: 64000000 bytes
HTML transferred: 4800000 bytes
Requests per second: 10197.99 [#/sec] (mean)
Time per request: 1961.170 [ms] (mean)
Time per request: 0.098 [ms] (mean, across all concurrent requests)
Transfer rate: 1593.44 [Kbytes/sec] received Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 930 717.2 722 15587
Processing: 360 975 198.0 962 2555
Waiting: 0 738 168.0 739 2344
Total: 740 1905 740.7 1732 16800 Percentage of the requests served within a certain time (ms)
50% 1732
66% 1894
75% 2015
80% 2263
90% 2623
95% 2836
98% 4397
99% 4623
100% 16800 (longest request)

golang

已无法承受压力

关于swoole 和golang 的压力测试结果的更多相关文章

  1. Golang 语言的单元测试和性能测试(也叫 压力测试)

    Golang单元测试对文件名和方法名,参数都有很严格的要求. 例如: 1.文件名必须以xx_test.go命名 2.方法必须是Test[^a-z]开头(T必须大写),func TestXxx (t * ...

  2. centos7.5 ab压力测试安装和swoole压力测试

    Apache Benchmark(简称ab) 是Apache安装包中自带的压力测试工具 ,简单易用 1.ab安装 yum -y install httpd-tools 2.ab参数详解,传送门:htt ...

  3. 开源API集成测试工具 Hitchhiker v0.2更新 - 压力测试

    Hitchhiker 是一款开源的 Restful Api 集成测试工具,支持Schedule, 数据对比,压力测试,可以轻松部署到本地,和你的team成员一起管理Api. 详细介绍请看: http: ...

  4. 使用 WRK 压力测试工具对 ASP.NET Core 的接口进行压力测试

    0. 简要介绍 WRK 是一款轻量且易用的 HTTP 压力测试工具,通过该工具我们可以方便地对我们所开发的 WebAPI 项目进行压力测试,并且针对测试的情况返回结果. PS:Wrk 并不能针对测试的 ...

  5. 在Centos下使用Siege对Django服务进行压力测试

    Siege是linux下的一个web系统的压力测试工具,支持多链接,支持get和post请求,可以对web系统进行多并发下持续请求的压力测试.今天我们就使用Siege来对Django进行一次压力测试, ...

  6. 在Centos7.3下使用Siege对Django服务进行压力测试

    原文转载自「刘悦的技术博客」https://v3u.cn/a_id_87 Siege是linux下的一个web系统的压力测试工具,支持多链接,支持get和post请求,可以对web系统进行多并发下持续 ...

  7. 使用SwingBench 对Oracle RAC DB性能 压力测试

    我们可以使用swingbench这个工具对数据库性能进行压力测试,得到一些性能指标作为参考. SwingBench下载: http://www.dominicgiles.com/downloads.h ...

  8. linux压力测试工具stress

    最近给PASS平台添加autoscaling的功能,根据服务器的负载情况autoscaling,为了测试这项功能用到了stress这个压力测试工具,这个工具相当好用了.具体安装方式就不说了.记录下这个 ...

  9. JMeter压力测试

    Apache JMeter是Apache组织开发的基于Java的压力测试工具.用于对软件做压力测试,它最初被设计用于Web应用测试但后来扩展到其他测试领域. 它可以用于测试静态和动态资源例如静态文件. ...

随机推荐

  1. codeforces 372 Complete the Word(双指针)

    codeforces 372 Complete the Word(双指针) 题链 题意:给出一个字符串,其中'?'代表这个字符是可变的,要求一个连续的26位长的串,其中每个字母都只出现一次 #incl ...

  2. BZOJ 3277 串 & BZOJ 3473 字符串 (广义后缀自动机、时间复杂度分析、启发式合并、线段树合并、主席树)

    标签那么长是因为做法太多了... 题目链接: (bzoj 3277) https://www.lydsy.com/JudgeOnline/problem.php?id=3277 (bzoj 3473) ...

  3. 九度oj 题目1053:互换最大最小数

    题目1053:互换最大最小数 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:7538 解决:3049 题目描述: 输入一个数n,然后输入n个数值各不相同,调换数组中最大和最小的两个数,然后 ...

  4. RMI分布式议程服务学习

    转自:http://6221123.blog.51cto.com/6211123/1112619 这里讲述的是基于JDK1.5的RMI程序搭建,更简单的说是一个 HelloWorld RMI. 1. ...

  5. 关于 Neo4j 属性个数的限制

    关于 Neo4j 属性个数的限制 目前累积统计它有34.4亿个节点,344亿的关系,和6870亿条属性. 社区版,Neo4j对 数据库内 节点.关系 上的属性名个数是有限制的.数据库中至多存在687亿 ...

  6. kendo grid Hierarchy

    Hierarchy grid中不能使用下面的这段代码,会造成传值传不过来,把下面的代码注释,不用models,直接用form表单传值就行,暂时没搞明白为什么 //parameterMap: funct ...

  7. Mac: 通过蓝牙用安卓手机向Mac发送文件

    1. 打开Mac蓝牙和手机蓝牙 2. 配对 3. mac 系统偏好设置>共享 勾蓝牙共享,选接受并存储 4. 手机发送文件

  8. Cocos2d-X中的菜单

    在Cocos2d-X实现显示菜单的方式比較特殊,首先须要使用CCMenu创建一个菜单,然后使用CCMenuItem创建一个菜单项,实际上程序中显示的菜单是使用CCMenu和CCMenuItemFont ...

  9. TransModeler 交通仿真软件

    1.系统概述 TransModeler是美国Caliper公司开发的一个功能强大而操作灵活的交通仿真软件包,广泛适用于各类交通规划和交通仿真建模任务.TransModeler独特之处在于它提供了宏观/ ...

  10. android开发艺术探索学习 之 结合Activity的生命周期了解Activity的LaunchMode

    转载请标明出处: http://blog.csdn.net/lxk_1993/article/details/50749728 本文出自:[lxk_1993的博客]: 首先还是先介绍下Activity ...