-
Notifications
You must be signed in to change notification settings - Fork 405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flight work with Adapterman (Workerman) #613
Comments
Hey @joanhey long time no see :) So one thing that may be worth noting is I'm pretty sure that the techempower benchmarks are using Flight v2 and the framework is now at Flight v3. Have you tried with v3 of the framework with any luck? |
Hi @n0nag0n ✋ I'll update the benchmark to use Flight v3, I only needed to change the plaintext code. Flight v3 with Adapterman:
It's very similar to v2. |
The good think of use Request - Response is that it can be used with only one initial bootstrap and have faster runtime as persistent app. PD: if the first url don't exist, return a 404, but later all the urls return a 404 |
Ahh ok, I think I know what's going on. Flight really was built for only "regular" PHP event handling. In another discussion I did get it to work with Swoole with some customizations and some of these customizations might make sense to you. I've never worked with workerman, but I assume the same rule applies to Workerman as it does to Swoole. Basically, you need to handle the headers by hand and deregister/register the request and response objects as they are static in the framework. I have another project for the flightphp org to get async working with swoole and I have it all working, but there is a memory leak somewhere and eventually the swoole server has to be restarted as it runs out of memory. I'm not sure where the leak is as it's basically impossible to track variable sizes in swoole servers without xdebug or any type of friendly debug. Hopefully this points you in a direction. I know you want Adapterman out of the box, and maybe it still can, but it looks like it may need a little help. |
You don't need to touch any app code with Adapterman. PD: actually it isn't so because the framework repeat the requests, even when change. |
And please, later try with swoole, frankenphp, ... all are slow compared with Adapterman !! |
Remember to separate the code that is configuration, and never change, with a new Request that create the router. |
I found an interesting information when i asked Perplexity AI, here is its answer : In analyzing the FlightPHP core source code and its potential issues with FrankenPHP's worker mode, several areas could lead to buggy behavior, especially concerning shared data across requests: |
Some of that problems don't affect in Adapterman. Adapterman use Swoole and FrankenPHP (Worker mode) use |
The only change is here: https://github.com/flightphp/core/blob/master/flight/Engine.php#L475-L481 public function _start(): void
{
$dispatched = false;
$self = $this;
$request = $this->request();
$response = $this->response();
$router = $this->router(); The The framework will be as fast as before, because the first time create a new instance, but subsequent calls return the same instanced Request and Response. PD: perhaps with only a new instance for $request will be enough. |
Another problem with persistent applications is to avoid |
Sorry I haven't gotten to this til now. I appreciate your help with figuring this out! I have seen the same problems and I would need to alter the core, without breaking past functionality to get it working correctly. I'll pin this in the todo list to see if I can get it working sometime soon cause I would be interested to get this working with some type of async handler. |
Is your feature request related to a problem? Please describe.
I'm trying that this framework work with Adapterman, but only work the first URL.
I'm using the Techempower benchmark to test the frameworks with the async event driven Workerman, that it's working with similar frameworks.
Describe the solution you'd like
I want that work when we bootstrap the app only 1 time, not only for Adapterman but for any platform (swoole, php-runtime,...).
Also I can help to have better performance when it's used like a persistent app.
I write here because one user send me a issue to Adapterman: joanhey/AdapterMan#87
Describe alternatives you've considered
As work the first URL call, and only fail the next URL calls, it seems that it's not cleared the routes or other property of the framework.
Additional context
As you run also the Techempower benchmark, i'll send you the files to reproduce.
Actually
The files that I use:
index.php
server.php
flight-workerman.dockerfile
It'll be easier for you to find the problem. As the bench don't report any error, only empty response.
I'm at your disposition for any extra info or help.
Thank you.
The text was updated successfully, but these errors were encountered: