Open joanhey opened 1 year ago
It looks amazing. I thought it was impossible to finish the work, but you solved it easily. Thank you so much for your efforts. 👍
Still fixing small details with the session.
The blog work without any problem. Only the admin area, have small problems with the sessions.
Symfony demo with Workerman, an user authenticated :
Laravel Orchid admin panel with Workerman, with Laravel the login is working
Drupal with Workerman, but still fail the login with symfony.
Laravel and Symfony login working !!!
That great ! 👍
Now I'll create a docker with the symfony-demo. In port 8080 with Workerman and in 8081 with php-fpm.
Symfony initialization 0ms. And half time per request, once loaded the first time.
https://user-images.githubusercontent.com/249085/197398802-fb2bc1e4-ec3d-4a2b-9187-4e40585e5ddc.mp4
Working with CakePHP too
The first results from the bench Without touch a line of code and full ORM.
Fw | Plaintext | Json | Single query | Multiple query | Updates | Fortunes |
---|---|---|---|---|---|---|
Laravel | 14,799 | 14,770 | 9,263 | 3,247 | 1,452 | 8,354 |
Laravel Roadrunner | 482 | 478 | 474 | 375 | 359 | 472 |
Laravel Swoole | 38,824 | 37,439 | 21,687 | 3,958 | 1,588 | 16,035 |
Laravel Laravel s | 54,617 | 49,372 | 23,677 | 2,917 | 1,255 | 16,696 |
Laravel Workerman | 103,004 | 99,891 | 46,001 | 5,828 | 1,666 | 27,158 |
Laravel with Workerman % gain | 596.02% | 576.31% | 396.61% | 79.489% | 14.738% | 225.09% |
In 2 days Symfony. The next week: Laravel 9, Lumen 9, Cakephp and Slim.
Very good. It seems that the performance improvement is significant. 👍
Yes, it's very significant. And here the results are bad, for using the very slow Laravel ORM.
The next week, we will see the Slim with raw db and optimized db for workerman.
I don't know any PHP ORM optimised for persistent apps.
And later, we will check the memory used. Kumbiaphp use half the memory using Workerman. We will have better numbers with other fws.
700% faster in the Fortunes
Fw | Plaintext | Json | Single query | Multiple query | Updates | Fortunes |
---|---|---|---|---|---|---|
Symfony | 38,231 | 37,557 | 12,578 | 10,741 | 3,420 | 10,741 |
Symfony Workerman | 210,796 | 197,059 | 107,050 | 13,401 | 4,062 | 71,092 |
With CakePHP we have worst results with Workerman. :( I'll investigate if it's an error or directly a problem with CakePHP
I think that I found the problem, It's related to Cakephp. Changes passed, and in 7 days we have the new results. https://github.com/TechEmpower/FrameworkBenchmarks/pull/7680
Looking the cakephp bootstrap, it check if is CLI SAPI, and load a cli bootstrap.
Laravel 9 have the same numbers than version 8.
Fw | Plaintext | Json | Single query | Multiple query | Updates | Fortunes |
---|---|---|---|---|---|---|
Lumen | 18,998 | 18,616 | 10,791 | 3,496 | 1,461 | 9,223 |
Lumen Swoole | 44,861 | 43,598 | 24,255 | 4,178 | 1,599 | 16,854 |
Lumen Laravel s | 93,335 | 82,745 | 31,567 | 3,030 | 1,282 | 21,130 |
Lumen Workerman | 185,126 | 177,667 | 58,729 | 5,857 | 1,662 | 31,430 |
Very similar numbers to Laravel.
Trying now with Codeigniter4
Slim3 vs Slim4 without ORM Framework | JSON | 1-query | 20-query | Fortunes | Updates | Plaintext |
---|---|---|---|---|---|---|
Slim 3 | 35,588 | 29,529 | 12,579 | 28,211 | 1,999 | 36,247 |
Slim 4 | 38,305 | 34,272 | 12,579 | 32,634 | 2,097 | 35,251 |
:+1:
Without ORM Framework | JSON | 1-query | 20-query | Fortunes | Updates | Plaintext |
---|---|---|---|---|---|---|
Slim 4 | 38,305 | 34,272 | 12,579 | 32,634 | 2,097 | 35,251 |
Slim 4 Workerman | 129,393 | 81,889 | 15,803 | 73,212 | 2,456 | 134,531 |
Slim 4 Workerman pgsql * | 102,926 | 19,637 | 92,752 | 14,875 |
CakePHP still slower. Asking for help in the Cakephp slack.
I'm updating all fw to php 8.2, in the bencmark.
But Workerman 3.5 have problems with dynamic properties. And fail in some frameworks.
Can we move it from 3.5 to v4, as another protocol ? So we also could optimize it for php 7.
In the mean time, you or me can add
To the Worker class and Connection interface.
In the mean time, you or me can add
[\AllowDynamicProperties]
To the Worker class and Connection interface.
Done
Walkor, open a twitter for Workerman (and Webman).
Hi joanhey, here are the twitter accounts.
https://twitter.com/workermanphp https://twitter.com/webmanphp
Lumen v9 600% faster
Great 👍
When you have a moment, Could we talk in private ? Thank you
Ok, my email walkor@workerman.net .
The Symfony people ask me to add the new FrankenPHP. So I added Swoole and FrankenPHP using the phpruntime too.
The symfony results are ready:
So we'll show the json and single query:
Json
Latency
Single query Latency
The link to visualize the results: https://www.techempower.com/benchmarks/#section=test&runid=124fd2af-3030-4315-8876-e1db1fa91193&test=json&f=zik0zj-zik0zj-zik0zj-zik0zj-zik0zj-zik0zj-zik0zj-zik0zj-zik0zj-zik0zj-v2qiv3-zik0zj-zik0zj-cn3
Testing Adapterman, without worker mode. Directly including file.php in the fork. And for now it's OK. When I make more tests, I'll send you the info.
Hmmm, Could you add https://github.com/joanhey/AdapterMan in https://www.workerman.net/related_projects We need more marketing and hands.
Done. And I published an article in the community about your project. https://www.workerman.net/q/9831
nice
niubility
wonderful
👍
Some people ask me, that fail to serve statics files.
Only to clarify this: Initially Adapterman want to be an APP SERVER not a web server.
The idea is change the php-fpm with Adapterman + Workerman. Also like do now Laravel Octane.
Of course, we are open to ideas to add a web server. But I think that will be not scalable.
I'll add this to the README, and also add a Nginx config example.
Easy examle, to show the execution time. But useful to debug anything.
$http_worker->onMessage = static function ($connection, $request) {
$start = microtime(true);
$connection->send(run());
// Here you can check anything
Worker::safeEcho($_SERVER['REQUEST_METHOD'] ."\t". $_SERVER['REQUEST_URI'] ."\t". round((microtime(1) - $start) * 1000, 4) . ' ms' . PHP_EOL); // . print_r($_SESSION);
};
Workerman without worker mode, including the .php file in each request, from the plain php benchmark.
Using your exec_php_file()
function exec_php_file($file)
{
ob_start();
// Try to include php file.
try {
include $file;
} catch (\Exception $e) {
echo $e;
}
return ob_get_clean();
}
I need to change the catch Exception to catch Throwable.
https://github.com/TechEmpower/FrameworkBenchmarks/pull/7798
Bench in my local PC, with the json.php
test without worker mode.
With 100 concurrent connections.
Great solution
Looks like an interesting solution and I'm very interested in trying it out.
Shared Nothing mode, like with PHP-FPM. Using the same .php files.
Framework | JSON | 1-query | Multiple queries | Fortunes | Updates | Plaintext |
---|---|---|---|---|---|---|
php php-fpm | 187,747 | 97,658 | 12,784 | 79,309 | 2,010 | 195,283 |
php workerman | 822,930 | 134,475 | 15,648 | 124,923 | 4,683 | 1,161,016 |
We need to add the protocol to Workerman v4.2 and/or 5
So we can work together with the new session, add more adapters and functionalities.
The problem is: the name of the protocol ? phphttp, php, phpruntime(not recommended), ....
The new session still use a random GC, that affect the performance of n requests.
We need to change it, to use a Timer to clean the expired sessions. Like do debian/ubuntu.
They use by default session.gc_probability=0
, and use a cron or a systemd.timer to run phpcleansession
https://www.getpagespeed.com/server-setup/php/cleanup-php-sessions-like-a-pro
`
Hi Walkor,
I was using a lib internally for more than 2 years, for my legacy apps to run with Workerman v3.5. https://github.com/joanhey/AdapterMan
This week I tested with frameworks, and It's working perfectly, without touch 1 line of code in the fw or app.
We only need an small change to the Front Controller and PHP 8 as minimum.
Tested with:
Now I'm creating PRs in the Techempower benchmark. https://github.com/TechEmpower/FrameworkBenchmarks/pull/7627 https://github.com/TechEmpower/FrameworkBenchmarks/pull/7626 Later I will push Slim and more fws.
I think that this lib will be useful for more people.
If time permits, I'll try to add documentation and upgrade to Workerman v4