php ab压力测试,Swoole 与 纯 PHP ab 压力测试

服务器配置

操作系统CentOS 7.2 64位

CPU1 核

内存2 GB

公网带宽1 Mbps

Swoole  2.1.2-alpha

$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/plain");

$response->end("Hello World\n");

});

$http->start();

ab -c100 -n100000 http://127.0.0.1:9501/

56a8abb44da35b2ef202eb2d28c25826.png

Server Software: nginx

Server Hostname: 127.0.0.1

Server Port: 80

Document Path: /helloworld.php

Document Length: 11 bytes

Concurrency Level: 100

Time taken for tests: 20.609 seconds

Complete requests: 100000

Failed requests: 0

Write errors: 0

Total transferred: 18900000 bytes

HTML transferred: 1100000 bytes

Requests per second: 4852.13 [#/sec] (mean)

Time per request: 20.609 [ms] (mean)

Time per request: 0.206 [ms] (mean, across all concurrent requests)

Transfer rate: 895.56 [Kbytes/sec] received

Connection Times (ms)

min mean[+/-sd] median max

Connect: 0 0 0.1 0 3

Processing: 3 20 6.3 20 153

Waiting: 1 20 6.3 20 153

Total: 3 21 6.3 20 154

PHP 7.2.3

echo 'hello world';

ab -c100 -n100000 http://127.0.0.1/helloworld.php

11aaffe660057ac2478385a51f216925.png

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: 5.758 seconds

Complete requests: 100000

Failed requests: 0

Write errors: 0

Total transferred: 16100000 bytes

HTML transferred: 1200000 bytes

Requests per second: 17368.14 [#/sec] (mean)

Time per request: 5.758 [ms] (mean)

Time per request: 0.058 [ms] (mean, across all concurrent requests)

Transfer rate: 2730.73 [Kbytes/sec] received

Connection Times (ms)

min mean[+/-sd] median max

Connect: 0 1 0.4 1 4

Processing: 3 4 0.9 4 54

Waiting: 2 3 0.6 3 52

Total: 4 6 0.9 5 54

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值