nodejs 和 swoole 简单测试

Server Software:        
Server Hostname:        127.0.0.1
Server Port:            8888

Document Path:          /
Document Length:        1 bytes

Concurrency Level:      100
Time taken for tests:   0.109 seconds
Complete requests:      1000
Failed requests:        0
Total transferred:      76000 bytes
HTML transferred:       1000 bytes
Requests per second:    9181.98 [#/sec] (mean)
Time per request:       10.891 [ms] (mean)
Time per request:       0.109 [ms] (mean, across all concurrent requests)
Transfer rate:          681.47 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.7      0       3
Processing:     1   10   2.2     10      13
Waiting:        1   10   2.2     10      13
Total:          5   10   1.7     10      13

Percentage of the requests served within a certain time (ms)
  50%     10
  66%     11
  75%     11
  80%     11
  90%     12
  95%     13
  98%     13
  99%     13
 100%     13 (longest request)
jiam@jiam-Hi-Fi-A88ZN:~$ sudo ab -n1000 -c 100 http://127.0.0.1:8888/

Server Software:        swoole-http-server
Server Hostname:        127.0.0.1
Server Port:            9510

Document Path:          /
Document Length:        1 bytes

Concurrency Level:      100
Time taken for tests:   0.046 seconds
Complete requests:      1000
Failed requests:        0
Total transferred:      148000 bytes
HTML transferred:       1000 bytes
Requests per second:    21696.21 [#/sec] (mean)
Time per request:       4.609 [ms] (mean)
Time per request:       0.046 [ms] (mean, across all concurrent requests)
Transfer rate:          3135.78 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    1   0.4      1       2
Processing:     1    3   0.7      3       6
Waiting:        1    3   0.7      3       6
Total:          2    4   0.7      4       7

Percentage of the requests served within a certain time (ms)
  50%      4
  66%      4
  75%      4
  80%      4
  90%      5
  95%      6
  98%      7
  99%      7
 100%      7 (longest request)
jiam@jiam-Hi-Fi-A88ZN:~$ sudo ab -n1000 -c 100 http://127.0.0.1:9510/
jiam@jiam-Hi-Fi-A88ZN:~$ node -v
v6.9.2

let http = require('http');
http.createServer(function (request, response) {
    response.end('a');
}).listen(8888);
jiam@jiam-Hi-Fi-A88ZN:~$ php -v
PHP 7.1.0 (cli) (built: Jan  1 2017 17:14:13) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies

<?php
$http = new swoole_http_server("0.0.0.0", 9510);
$http->set([
    'worker_num' => 1,
    'daemonize' => false,
    'max_request' => 5120,
    'dispatch_mode' => 2,
    'open_cpu_affinity' => true,
    'open_tcp_nodelay' => true
]);
$http->on('Request', function ($request, $response) {
    $response->end('a');
});
$http->start();

首先说下这只是一个简单的并发测试和实际的运行环境 还是很不同的
但我的直观的感觉是 swoole的性能真的很好 而且 测试下来 的测试数据也更稳定
node的相比会有更大的波动。。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值