diff --git a/aerys/v0.8/composer.lock b/aerys/v0.8/composer.lock index 562bab4..5632885 100644 --- a/aerys/v0.8/composer.lock +++ b/aerys/v0.8/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "amphp/amp", - "version": "v2.0.7", + "version": "v2.1.1", "source": { "type": "git", "url": "https://github.com/amphp/amp.git", - "reference": "d561cc9736bc18dd94a2fc9cdae98b616bd92c43" + "reference": "7075ef7d74dbd32626bfd31c976b23055c3ade6a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/amp/zipball/d561cc9736bc18dd94a2fc9cdae98b616bd92c43", - "reference": "d561cc9736bc18dd94a2fc9cdae98b616bd92c43", + "url": "https://api.github.com/repos/amphp/amp/zipball/7075ef7d74dbd32626bfd31c976b23055c3ade6a", + "reference": "7075ef7d74dbd32626bfd31c976b23055c3ade6a", "shasum": "" }, "require": { @@ -80,28 +80,30 @@ "non-blocking", "promise" ], - "time": "2018-04-30T20:49:57+00:00" + "time": "2018-12-11T10:31:37+00:00" }, { "name": "amphp/byte-stream", - "version": "v1.3.1", + "version": "v1.5.1", "source": { "type": "git", "url": "https://github.com/amphp/byte-stream.git", - "reference": "1b75b122e6f069e7d102eef065dc192119d99ca7" + "reference": "6bbfcb6f47e92577e739586ba0c87e867be70a23" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/byte-stream/zipball/1b75b122e6f069e7d102eef065dc192119d99ca7", - "reference": "1b75b122e6f069e7d102eef065dc192119d99ca7", + "url": "https://api.github.com/repos/amphp/byte-stream/zipball/6bbfcb6f47e92577e739586ba0c87e867be70a23", + "reference": "6bbfcb6f47e92577e739586ba0c87e867be70a23", "shasum": "" }, "require": { "amphp/amp": "^2" }, "require-dev": { + "amphp/php-cs-fixer-config": "dev-master", "amphp/phpunit-util": "^1", "friendsofphp/php-cs-fixer": "^2.3", + "infection/infection": "^0.9.3", "phpunit/phpunit": "^6" }, "type": "library", @@ -137,7 +139,7 @@ "non-blocking", "stream" ], - "time": "2018-04-04T05:33:09+00:00" + "time": "2018-12-27T18:08:06+00:00" }, { "name": "amphp/cache", @@ -191,20 +193,20 @@ "source": { "type": "git", "url": "https://github.com/amphp/cluster.git", - "reference": "54f3d336769c2028b7afb7384937d15155c822ab" + "reference": "7d73ef57fe06784fec9e118526824446f9213f09" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/cluster/zipball/54f3d336769c2028b7afb7384937d15155c822ab", - "reference": "54f3d336769c2028b7afb7384937d15155c822ab", + "url": "https://api.github.com/repos/amphp/cluster/zipball/7d73ef57fe06784fec9e118526824446f9213f09", + "reference": "7d73ef57fe06784fec9e118526824446f9213f09", "shasum": "" }, "require": { "amphp/amp": "^2", - "amphp/byte-stream": "^1.3", + "amphp/byte-stream": "^1.5", "amphp/file": "^0.3", "amphp/log": "^1", - "amphp/parallel": "^0.2.4", + "amphp/parallel": "^1", "amphp/socket": "^0.10.8", "league/climate": "^3", "monolog/monolog": "^1.23", @@ -212,8 +214,8 @@ "psr/log": "^1" }, "require-dev": { + "amphp/php-cs-fixer-config": "dev-master", "amphp/phpunit-util": "^1", - "friendsofphp/php-cs-fixer": "^2.3", "infection/infection": "^0.7.1", "phpunit/phpunit": "^6" }, @@ -264,7 +266,7 @@ "non-blocking", "parallel" ], - "time": "2018-05-03T01:41:26+00:00" + "time": "2018-11-07T05:07:50+00:00" }, { "name": "amphp/dns", @@ -346,26 +348,26 @@ }, { "name": "amphp/file", - "version": "v0.3.1", + "version": "v0.3.3", "source": { "type": "git", "url": "https://github.com/amphp/file.git", - "reference": "7bb476921b67cd7da361cf0d6bf9d80ec130421d" + "reference": "25d8ef6e67b95d5249e0af7a80adce77657d16bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/file/zipball/7bb476921b67cd7da361cf0d6bf9d80ec130421d", - "reference": "7bb476921b67cd7da361cf0d6bf9d80ec130421d", + "url": "https://api.github.com/repos/amphp/file/zipball/25d8ef6e67b95d5249e0af7a80adce77657d16bb", + "reference": "25d8ef6e67b95d5249e0af7a80adce77657d16bb", "shasum": "" }, "require": { "amphp/amp": "^2", "amphp/byte-stream": "^1", - "amphp/parallel": "^0.2" + "amphp/parallel": "^1" }, "require-dev": { + "amphp/php-cs-fixer-config": "dev-master", "amphp/phpunit-util": "^1", - "friendsofphp/php-cs-fixer": "^2.3", "phpunit/phpunit": "^6" }, "type": "library", @@ -408,20 +410,20 @@ "non-blocking", "static" ], - "time": "2018-03-17T12:24:35+00:00" + "time": "2018-10-28T14:38:35+00:00" }, { "name": "amphp/hpack", - "version": "v1.0.0", + "version": "v1.0.1", "source": { "type": "git", "url": "https://github.com/amphp/hpack.git", - "reference": "f2b2dbfb5e6221bc9fe9350512e4971959b10ae6" + "reference": "f6f95e015baa54aa3c0fdbe3ad142fbd18a835e6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/hpack/zipball/f2b2dbfb5e6221bc9fe9350512e4971959b10ae6", - "reference": "f2b2dbfb5e6221bc9fe9350512e4971959b10ae6", + "url": "https://api.github.com/repos/amphp/hpack/zipball/f6f95e015baa54aa3c0fdbe3ad142fbd18a835e6", + "reference": "f6f95e015baa54aa3c0fdbe3ad142fbd18a835e6", "shasum": "" }, "require": { @@ -466,7 +468,7 @@ "hpack", "http-2" ], - "time": "2018-03-13T14:40:49+00:00" + "time": "2018-03-16T14:31:41+00:00" }, { "name": "amphp/http", @@ -649,28 +651,28 @@ }, { "name": "amphp/parallel", - "version": "v0.2.5", + "version": "v1.0.1", "source": { "type": "git", "url": "https://github.com/amphp/parallel.git", - "reference": "732694688461936bec02c0ccf020dfee10c4f7ee" + "reference": "4c3c93e46a0108f04990352b0d084ded2ec2cc17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/parallel/zipball/732694688461936bec02c0ccf020dfee10c4f7ee", - "reference": "732694688461936bec02c0ccf020dfee10c4f7ee", + "url": "https://api.github.com/repos/amphp/parallel/zipball/4c3c93e46a0108f04990352b0d084ded2ec2cc17", + "reference": "4c3c93e46a0108f04990352b0d084ded2ec2cc17", "shasum": "" }, "require": { "amphp/amp": "^2", - "amphp/byte-stream": "^1.2", + "amphp/byte-stream": "^1.5", "amphp/parser": "^1", - "amphp/process": "^0.2 || ^0.3", + "amphp/process": "^1", "amphp/sync": "^1.0.1" }, "require-dev": { + "amphp/php-cs-fixer-config": "dev-master", "amphp/phpunit-util": "^1", - "friendsofphp/php-cs-fixer": "^2.3", "phpunit/phpunit": "^6" }, "suggest": { @@ -708,7 +710,7 @@ "multi-processing", "multi-threading" ], - "time": "2018-03-21T14:37:51+00:00" + "time": "2018-10-27T16:19:01+00:00" }, { "name": "amphp/parser", @@ -763,26 +765,26 @@ }, { "name": "amphp/process", - "version": "v0.3.3", + "version": "v1.0.2", "source": { "type": "git", "url": "https://github.com/amphp/process.git", - "reference": "b795d20a7f6d5a0637128a02be613f520f1705fc" + "reference": "90f3f31cbd0eee7fa5ae03ce588b1fc8f122997c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/process/zipball/b795d20a7f6d5a0637128a02be613f520f1705fc", - "reference": "b795d20a7f6d5a0637128a02be613f520f1705fc", + "url": "https://api.github.com/repos/amphp/process/zipball/90f3f31cbd0eee7fa5ae03ce588b1fc8f122997c", + "reference": "90f3f31cbd0eee7fa5ae03ce588b1fc8f122997c", "shasum": "" }, "require": { "amphp/amp": "^2", - "amphp/byte-stream": "^1", + "amphp/byte-stream": "^1.4", "php": ">=7" }, "require-dev": { + "amphp/php-cs-fixer-config": "dev-master", "amphp/phpunit-util": "^1", - "friendsofphp/php-cs-fixer": "^2.3", "phpunit/phpunit": "^6" }, "type": "library", @@ -814,20 +816,20 @@ ], "description": "Asynchronous process manager.", "homepage": "https://github.com/amphp/process", - "time": "2018-04-08T18:55:42+00:00" + "time": "2018-11-09T00:02:00+00:00" }, { "name": "amphp/socket", - "version": "v0.10.9", + "version": "v0.10.11", "source": { "type": "git", "url": "https://github.com/amphp/socket.git", - "reference": "6e9686b62b87c2cad235139a44be5121fe34edbb" + "reference": "2cb9d0ef823cfd1de4cfbd0e680c58841367f727" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/socket/zipball/6e9686b62b87c2cad235139a44be5121fe34edbb", - "reference": "6e9686b62b87c2cad235139a44be5121fe34edbb", + "url": "https://api.github.com/repos/amphp/socket/zipball/2cb9d0ef823cfd1de4cfbd0e680c58841367f727", + "reference": "2cb9d0ef823cfd1de4cfbd0e680c58841367f727", "shasum": "" }, "require": { @@ -881,7 +883,7 @@ "tcp", "tls" ], - "time": "2018-05-01T21:14:10+00:00" + "time": "2018-10-17T16:53:02+00:00" }, { "name": "amphp/sync", @@ -985,24 +987,25 @@ }, { "name": "amphp/windows-registry", - "version": "v0.3.1", + "version": "v0.3.2", "source": { "type": "git", "url": "https://github.com/amphp/windows-registry.git", - "reference": "46ba1463dfffc8081b4b483fac05d3f51ecb1d87" + "reference": "834af7a30ad7c006b0326ccd2686ddc6e6943366" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/windows-registry/zipball/46ba1463dfffc8081b4b483fac05d3f51ecb1d87", - "reference": "46ba1463dfffc8081b4b483fac05d3f51ecb1d87", + "url": "https://api.github.com/repos/amphp/windows-registry/zipball/834af7a30ad7c006b0326ccd2686ddc6e6943366", + "reference": "834af7a30ad7c006b0326ccd2686ddc6e6943366", "shasum": "" }, "require": { "amphp/amp": "^2", - "amphp/process": "^0.2 || ^0.3" + "amphp/byte-stream": "^1.4", + "amphp/process": "^1" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^2.3" + "amphp/php-cs-fixer-config": "dev-master" }, "type": "library", "autoload": { @@ -1021,7 +1024,7 @@ } ], "description": "Windows Registry Reader.", - "time": "2017-12-11T08:35:51+00:00" + "time": "2018-10-24T03:34:54+00:00" }, { "name": "cash/lrucache", @@ -1167,16 +1170,16 @@ }, { "name": "league/uri-interfaces", - "version": "1.1.0", + "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/thephpleague/uri-interfaces.git", - "reference": "b5063ffb8b129923c8988f1d4061fdeea53b47b9" + "reference": "081760c53a4ce76c9935a755a21353610f5495f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/b5063ffb8b129923c8988f1d4061fdeea53b47b9", - "reference": "b5063ffb8b129923c8988f1d4061fdeea53b47b9", + "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/081760c53a4ce76c9935a755a21353610f5495f6", + "reference": "081760c53a4ce76c9935a755a21353610f5495f6", "shasum": "" }, "require": { @@ -1215,20 +1218,20 @@ "uri", "url" ], - "time": "2018-05-22T12:10:22+00:00" + "time": "2018-11-05T14:00:06+00:00" }, { "name": "league/uri-parser", - "version": "1.4.0", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/thephpleague/uri-parser.git", - "reference": "8beb28540744a5ad728aee7060100002f9196f46" + "reference": "671548427e4c932352d9b9279fdfa345bf63fa00" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/uri-parser/zipball/8beb28540744a5ad728aee7060100002f9196f46", - "reference": "8beb28540744a5ad728aee7060100002f9196f46", + "url": "https://api.github.com/repos/thephpleague/uri-parser/zipball/671548427e4c932352d9b9279fdfa345bf63fa00", + "reference": "671548427e4c932352d9b9279fdfa345bf63fa00", "shasum": "" }, "require": { @@ -1280,25 +1283,25 @@ "uri", "url" ], - "time": "2018-03-13T21:13:33+00:00" + "time": "2018-11-22T07:55:51+00:00" }, { "name": "league/uri-schemes", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/thephpleague/uri-schemes.git", - "reference": "c26aedac0f60d1ce915aa309e1d08a4b09c7d708" + "reference": "f821a444785724bcc9bc244b1173b9d6ca4d71e6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/uri-schemes/zipball/c26aedac0f60d1ce915aa309e1d08a4b09c7d708", - "reference": "c26aedac0f60d1ce915aa309e1d08a4b09c7d708", + "url": "https://api.github.com/repos/thephpleague/uri-schemes/zipball/f821a444785724bcc9bc244b1173b9d6ca4d71e6", + "reference": "f821a444785724bcc9bc244b1173b9d6ca4d71e6", "shasum": "" }, "require": { "ext-fileinfo": "*", - "league/uri-interfaces": "^1.0", + "league/uri-interfaces": "^1.1", "league/uri-parser": "^1.4.0", "php": ">=7.0.13", "psr/http-message": "^1.0" @@ -1317,7 +1320,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.x-dev" } }, "autoload": { @@ -1355,20 +1358,20 @@ "ws", "wss" ], - "time": "2018-03-14T08:33:20+00:00" + "time": "2018-11-26T08:09:30+00:00" }, { "name": "monolog/monolog", - "version": "1.23.0", + "version": "1.24.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4" + "reference": "bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd8c787753b3a2ad11bc60c063cff1358a32a3b4", - "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266", + "reference": "bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266", "shasum": "" }, "require": { @@ -1433,7 +1436,7 @@ "logging", "psr-3" ], - "time": "2017-06-19T01:22:40+00:00" + "time": "2018-11-05T09:00:11+00:00" }, { "name": "psr/http-message", @@ -1487,16 +1490,16 @@ }, { "name": "psr/log", - "version": "1.0.2", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", + "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", "shasum": "" }, "require": { @@ -1530,7 +1533,7 @@ "psr", "psr-3" ], - "time": "2016-10-10T12:19:37+00:00" + "time": "2018-11-20T15:27:04+00:00" }, { "name": "seld/cli-prompt", diff --git a/aerys/v0.8/server-super-tiny.php b/aerys/v0.8/server-super-tiny.php new file mode 100644 index 0000000..b1436f7 --- /dev/null +++ b/aerys/v0.8/server-super-tiny.php @@ -0,0 +1,43 @@ +getRemoteAddress()); + + $buffer = ''; + while (($chunk = yield $socket->read()) !== null) { + $buffer .= $chunk; + if (\substr($buffer, -4, 4) === "\r\n\r\n") { + $date = \gmdate("D, d M Y H:i:s", \time()) . " GMT"; + $body = "Hello world!"; + $bodyLength = \strlen($body); + yield $socket->write("HTTP/1.1 200 OK\r\nContent-Type: text/plain; Charset=utf-8\r\nX-Powered-By: AerysServer\r\nConnection: keep-alive\r\nContent-Length: ${bodyLength}\r\nKeep-Alive: timeout=10000\r\nDate: ${date}\r\n\r\n${body}\r\n\r\n\r\n\r\n"); + } + } + }); + + $server = Amp\Socket\listen("0.0.0.0:8080"); + + echo "Listening for new connections on " . $server->getAddress() . " ..." . PHP_EOL; + + while ($socket = yield $server->accept()) { + $clientHandler($socket); + } +}); diff --git a/build/install-local.sh b/build/install-local.sh index 0bd0023..476af18 100644 --- a/build/install-local.sh +++ b/build/install-local.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \ -&& php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" \ +&& php -r "if (hash_file('SHA384', 'composer-setup.php') === '93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" \ && php composer-setup.php \ && php -r "unlink('composer-setup.php');" \ && php composer.phar install -o -d ./aerys/v0.5.0 \ diff --git a/build/install.sh b/build/install.sh index 1210396..4b7f8a1 100644 --- a/build/install.sh +++ b/build/install.sh @@ -25,7 +25,7 @@ apt-get update \ && docker-php-ext-install sockets \ && docker-php-source extract \ && pecl channel-update pecl.php.net \ -&& printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n" | pecl install ev-1.0.4 event-2.3.0 swoole-4.2.1 \ +&& printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n" | pecl install swoole-4.2.9 \ && git clone https://github.com/bwoebi/php-uv.git && cd ./php-uv \ && phpize && ./configure && make && make install && cd .. && rm -rf ./php-uv \ && docker-php-source delete \ diff --git a/php/default-opcache-swoole.ini b/php/default-opcache-swoole.ini index 056bea8..b85be04 100644 --- a/php/default-opcache-swoole.ini +++ b/php/default-opcache-swoole.ini @@ -18,3 +18,4 @@ extension="pcntl.so" [swoole] extension="swoole.so" +swoole.aio_thread_num=1 diff --git a/react-php/composer.lock b/react-php/composer.lock index a108e28..8dfa697 100644 --- a/react-php/composer.lock +++ b/react-php/composer.lock @@ -229,16 +229,16 @@ }, { "name": "react/http", - "version": "v0.8.1", + "version": "v0.8.3", "source": { "type": "git", "url": "https://github.com/reactphp/http.git", - "reference": "92deba861d5a1320584450cfa61622a2969b00ef" + "reference": "f8bcdab2dc0ecd94f35ff9657a263028b96f0c46" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/http/zipball/92deba861d5a1320584450cfa61622a2969b00ef", - "reference": "92deba861d5a1320584450cfa61622a2969b00ef", + "url": "https://api.github.com/repos/reactphp/http/zipball/f8bcdab2dc0ecd94f35ff9657a263028b96f0c46", + "reference": "f8bcdab2dc0ecd94f35ff9657a263028b96f0c46", "shasum": "" }, "require": { @@ -273,7 +273,7 @@ "server", "streaming" ], - "time": "2018-01-05T15:30:50+00:00" + "time": "2018-04-11T15:03:27+00:00" }, { "name": "react/promise", diff --git a/start_benchmark.sh b/start_benchmark.sh index bb26280..170f5cc 100755 --- a/start_benchmark.sh +++ b/start_benchmark.sh @@ -10,6 +10,7 @@ AERYS1_WO_KEEP_ALIVE_COMMAND="./aerys/v0.5.0/vendor/bin/aerys -w 1 -c ./aerys/v0 #AERYS_COMMAND="./aerys2/vendor/bin/aerys -w 1 -c ./aerys2/server.php --worker-args=\"-n\"" AERYS_COMMAND="./aerys/version/server-tiny.php" AERYS_TINY_COMMAND="./aerys/version/server-tiny.php" +AERYS_SUPER_TINY_COMMAND="./aerys/version/server-super-tiny.php" AERYS_CURRENT_VERSION="v0.8" SWOOLE_COMMAND="./swoole/server.php" @@ -51,8 +52,8 @@ function checkPhpConfiguration { printf "\n${INFO}Check PHP configuration: ${END}" eval "${PHP_COMMAND} -c ./php/default.ini -i | grep 'zend.assertions => -1 => -1' 1>/dev/null" || { printf "${WARNING}Zend assertion isn't disabled!${END}\n"; exit 1; } eval "${PHP_COMMAND} -c ./php/default-opcache.ini -i | grep 'opcache.enable => On => On' 1>/dev/null" || { printf "${WARNING}OpCache isn't loaded!${END}\n"; exit 1; } - eval "${PHP_COMMAND} -c ./php/default-opcache-ev.ini -i | grep '^ev$' 1>/dev/null" || { printf "${WARNING}EV isn't loaded!${END}\n"; exit 1; } - eval "${PHP_COMMAND} -c ./php/default-opcache-event.ini -i | grep '^event$' 1>/dev/null" || { printf "${WARNING}Libevent isn't enabled!${END}\n"; exit 1; } +# eval "${PHP_COMMAND} -c ./php/default-opcache-ev.ini -i | grep '^ev$' 1>/dev/null" || { printf "${WARNING}EV isn't loaded!${END}\n"; exit 1; } +# eval "${PHP_COMMAND} -c ./php/default-opcache-event.ini -i | grep '^event$' 1>/dev/null" || { printf "${WARNING}Libevent isn't enabled!${END}\n"; exit 1; } eval "${PHP_COMMAND} -c ./php/default-opcache-uv.ini -i | grep '^uv$' 1>/dev/null" || { printf "${WARNING}Libuv isn't enabled!${END}\n"; exit 1; } printf "OK\n" } @@ -77,12 +78,13 @@ php -n -c ./php/default-opcache.ini -i | grep "opcache.jit" 1>/dev/null \ && start_benchmark "Benchmarking Aerys v0.7.4 (keep-alive + OPCache + w/o JIT)" "${PHP_COMMAND} -c ./php/default-opcache-nojit.ini ${AERYS_COMMAND//version/v0.7.4}" start_benchmark "Benchmarking Aerys ${AERYS_CURRENT_VERSION} (keep-alive + OPCache)" "${PHP_COMMAND} -c ./php/default-opcache.ini ${AERYS_COMMAND//version/${AERYS_CURRENT_VERSION}}" start_benchmark "Benchmarking Aerys ${AERYS_CURRENT_VERSION} tiny (keep-alive + OPCache)" "${PHP_COMMAND} -c ./php/default-opcache.ini ${AERYS_TINY_COMMAND//version/${AERYS_CURRENT_VERSION}}" +start_benchmark "Benchmarking Aerys ${AERYS_CURRENT_VERSION} super tiny (keep-alive + OPCache)" "${PHP_COMMAND} -c ./php/default-opcache.ini ${AERYS_SUPER_TINY_COMMAND//version/${AERYS_CURRENT_VERSION}}" php -n -c ./php/default-opcache.ini -i | grep "opcache.jit" 1>/dev/null \ && start_benchmark "Benchmarking Aerys ${AERYS_CURRENT_VERSION} (keep-alive + OPCache + w/o JIT)" "${PHP_COMMAND} -c ./php/default-opcache-nojit.ini ${AERYS_COMMAND//version/${AERYS_CURRENT_VERSION}}" # TODO: Aerys doesn't work with EV extension on PHP 7.3 -php -v | egrep -q "^PHP 7.(1|2)" \ -&& start_benchmark "Benchmarking Aerys ${AERYS_CURRENT_VERSION} (keep-alive + OPCache + ev)" "${PHP_COMMAND} -c ./php/default-opcache-ev.ini ${AERYS_COMMAND//version/${AERYS_CURRENT_VERSION}}" -start_benchmark "Benchmarking Aerys ${AERYS_CURRENT_VERSION} (keep-alive + OPCache + event)" "${PHP_COMMAND} -c ./php/default-opcache-event.ini ${AERYS_COMMAND//version/${AERYS_CURRENT_VERSION}}" +#php -v | egrep -q "^PHP 7.(1|2)" \ +#&& start_benchmark "Benchmarking Aerys ${AERYS_CURRENT_VERSION} (keep-alive + OPCache + ev)" "${PHP_COMMAND} -c ./php/default-opcache-ev.ini ${AERYS_COMMAND//version/${AERYS_CURRENT_VERSION}}" +#start_benchmark "Benchmarking Aerys ${AERYS_CURRENT_VERSION} (keep-alive + OPCache + event)" "${PHP_COMMAND} -c ./php/default-opcache-event.ini ${AERYS_COMMAND//version/${AERYS_CURRENT_VERSION}}" start_benchmark "Benchmarking Aerys ${AERYS_CURRENT_VERSION} (keep-alive + OPCache + uv)" "${PHP_COMMAND} -c ./php/default-opcache-uv.ini ${AERYS_COMMAND//version/${AERYS_CURRENT_VERSION}}" # Benchmark swoole diff --git a/swoole/server.php b/swoole/server.php index 619234c..cb1e7f7 100644 --- a/swoole/server.php +++ b/swoole/server.php @@ -9,7 +9,13 @@ use Swoole\Http\{Server, Request, Response}; $server = new Server('0.0.0.0', 8080); - +// API docs: https://rawgit.com/tchiotludo/swoole-ide-helper/english/docs/classes/swoole_server.html#method_set +$server->set(array( + # https://github.com/swoole/swoole-docs/blob/master/modules/swoole-server/configuration/worker_num.md + 'worker_num' => 1, + # https://github.com/swoole/swoole-docs/blob/master/modules/swoole-server/configuration/reactor_num.md + 'reactor_num' => 1, +)); $server->on('request', function(Request $request, Response $response) { if ($request->server['request_uri'] === '/') { $response->status(200);