Phalcon Micro + Swoole HTTP Server

Hi, I just create an environment that running Phalcon on top of Swoole. I have a script that I upload on Github Gist, here is my script:

I have to test with a heavy compute request, and the result has good enough. On AMD A9 dual-core processor with each 3.6GHz (turbo on), it can reach 3532 requests per second (Swoole HTTP) with 0 error, 5922 requests per second (Swoole on Unix socket + Nginx) with 0 error, and with Nginx + PHP-FPM it just reach 1385 requests per second. And of course, there is no memory leak, I have tested it too.

Here is my code using Nginx + PHP-FPM:

use Swoole\Http\Server;
use Phalcon\Mvc\Micro;
use Phalcon\Di\FactoryDefault;
// Load factory default dependencies
$di = new FactoryDefault();
// Load application based on dependency injection
$app = new Micro($di);
// Set response while path not found
$app->notFound(function() {
    return ['not found'];
// Set response for path '/'. This is default response (like index.php)
$app->get('/', function() {
    return ['Hello world!'];
echo json_encode(['message' => $app->handle()]);

My bottleneck is I don't know how to make an HTTP request adapter in Phalcon that maybe make this method better. I hope in the future someone makes an HTTP request adapter that supports the Swoole HTTP request interface.

edited Nov '19

you can try manaphp[] framework ,it suports fpm and swoole coroutine.

you can try manaphp[] framework ,it suports fpm and swoole coroutine.

But the documentation is Chinese. I can't read that.