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的相比会有更大的波动。。