Swoole-src: Strange perfomace

Created on 10 Nov 2016  路  6Comments  路  Source: swoole/swoole-src

Hi. I run benchmark swoole.php and compared it with walkor/Workerman. My results:

Swoole

$serv = new swoole_server("127.0.0.1", 9502, SWOOLE_BASE);
$serv->set([
    'worker_num' => 4,
]);
$serv->on('receive', function (swoole_server $serv, $fd, $from_id, $data) {
    $serv->send($fd, "HTTP/1.1 200 OK\r\nConnection: keep-alive\r\nServer: workerman\r\nContent-Length: 5\r\n\r\nhello");
    //$serv->close($fd);
});
$serv->start();

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


Workerman

use Workerman\Worker;
require_once 'your/path/Workerman/Autoloader.php';

$worker = new Worker('tcp://0.0.0.0:1234');
$worker->count=4;
$worker->onMessage = function($connection, $data)
{
    $connection->send("HTTP/1.1 200 OK\r\nConnection: keep-alive\r\nServer: workerman\r\nContent-Length: 5\r\n\r\nhello");
};
Worker::runAll();

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


My machine

OS: Debian 8u3 32Bit
PHP: PHP 5.6.23-0+deb8u1
Swoole version: v1.8.13

PHP modules:

bcmath
bz2
calendar
Core
ctype
curl
date
dba
dom
ereg
event
exif
fileinfo
filter
ftp
gd
geoip
gettext
gmp
hash
http
iconv
imagick
imap
intl
json
libpuzzle
libxml
mbstring
mcrypt
mhash
murmurhash3
mysql
mysqli
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_pgsql
pgsql
phalcon
Phar
posix
propro
psr
raphf
readline
Reflection
sass
session
shmop
SimpleXML
soap
sockets
SPL
standard
swoole
sysvmsg
sysvsem
sysvshm
tidy
tokenizer
wddx
xdebug
xml
xmlreader
xmlrpc
xmlwriter
xsl
yaf
zip
zlib

I guess swoole must be more faster or it is OK? Can you compare swoole tcp benchmark with walkor/Workerman.

question

Most helpful comment

May be somebody this will be interesting.

swoole\http\server
Requests per second:    67213.61 [#/sec] (mean)
walkor/Workerman
Requests per second:    41669.86 [#/sec] (mean)

All 6 comments

The performance of this scenario is not very different. The advantages of swoole in protocol handling and data parsing.

You should compare swoole\http\server or swoole\websocket\server benchmark with walkor/Workerman http server.

good job!

yo,what's up,man....

鍥磋

@matyhtf ty for answer, i compare http servers.

May be somebody this will be interesting.

swoole\http\server
Requests per second:    67213.61 [#/sec] (mean)
walkor/Workerman
Requests per second:    41669.86 [#/sec] (mean)
Was this page helpful?
0 / 5 - 0 ratings

Related issues

sagesan picture sagesan  路  4Comments

pthreat picture pthreat  路  3Comments

AndyChanCode picture AndyChanCode  路  3Comments

chenye2017 picture chenye2017  路  3Comments

sshymko picture sshymko  路  3Comments