Skip to content
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

Remove blocking I/O from ReactPHP implementation #8550

Merged

Conversation

lcobucci
Copy link
Contributor

The existing ReactPHP implementation doesn't leverage the async capabilities, creating wrong results when benchmarking things.

This optimises the ReactPHP app, allowing things to be a bit more comparable.

LibUv is the most optimised loop implementation for ReactPHP. This
alters the setup to allow us to properly compare things.

Signed-off-by: Luís Cobucci <lcobucci@gmail.com>
Signed-off-by: Luís Cobucci <lcobucci@gmail.com>
This just makes development more efficient as we avoid downloading
composer and all the dependencies when we only want to propagate updates
to the PHP files.

Signed-off-by: Luís Cobucci <lcobucci@gmail.com>
This makes us rely on the automatic execution of the Loop and removes
usage of deprecated classes.

Signed-off-by: Luís Cobucci <lcobucci@gmail.com>
@lcobucci
Copy link
Contributor Author

@WyriHaximus please feel free to correct things even further 👍

frameworks/PHP/reactphp/app.php Show resolved Hide resolved
frameworks/PHP/reactphp/server.php Outdated Show resolved Hide resolved
frameworks/PHP/reactphp/app.php Show resolved Hide resolved
frameworks/PHP/reactphp/reactphp.dockerfile Show resolved Hide resolved
Although this isn't a huge deal, it speeds up development as we don't
need to wait docker to trigger SIGKILL.

Signed-off-by: Luís Cobucci <lcobucci@gmail.com>
Just as AMPHP, ReactPHP requires asynchronous implementations for it to
work as expected. When using PDO we will block the process when
establishing the DB connection and sending queries.

This replaces the implementation with a fully async MySQL client, also
cleaning removing unnecessary extensions from the image.

Signed-off-by: Luís Cobucci <lcobucci@gmail.com>
@lcobucci lcobucci force-pushed the remove-blocking-io-from-reactphp branch from 2a52437 to 4f128f8 Compare November 18, 2023 22:05
@joanhey
Copy link
Contributor

joanhey commented Nov 29, 2023

Please update to PHP 8.3

@lcobucci
Copy link
Contributor Author

lcobucci commented Dec 2, 2023

Please update to PHP 8.3

Sure, will do around next week

Signed-off-by: Luís Cobucci <lcobucci@gmail.com>
@lcobucci
Copy link
Contributor Author

@joanhey a6657b7 handles the PHP 8.3 upgrade 👍

@NateBrady23 NateBrady23 merged commit c1a04f6 into TechEmpower:master Dec 11, 2023
3 checks passed
@lcobucci lcobucci deleted the remove-blocking-io-from-reactphp branch December 11, 2023 19:53
@joanhey
Copy link
Contributor

joanhey commented Jan 9, 2025

@lcobucci
Could you check ReactPHP, as it's failing for a long time.
https://tfb-status.techempower.com/unzip/results.2025-01-04-12-20-28-252.zip/reactphp

@WyriHaximus
Copy link

@joanhey Just checked those logs but don't see any obvious failures there. I will have a look at the code and docker file locally and see if I can spot what's wrong there.

@WyriHaximus
Copy link

@joanhey Do you remember when it started breaking? Because it's a MySQL related issue, so one of these 3 broke it; #8715, #9009, or #9183.

@joanhey
Copy link
Contributor

joanhey commented Jan 13, 2025

I can check when started to fail.
But it's more important, if anything fail than show the problem to the devs.

@joanhey
Copy link
Contributor

joanhey commented Jan 13, 2025

We update Mysql from 5.7 to 8.0 and now to 9.0,
Anybody can check in local this.
But for me, the worst think is than don't show where is the problem the framework.

@joanhey
Copy link
Contributor

joanhey commented Jan 13, 2025

If it fail for the Mysql, it's OK.
But why fail the tests without DB ?

@joanhey
Copy link
Contributor

joanhey commented Jan 13, 2025

Like I said, problems always exist, but the more important think is that the language or framework, show you where is the problem.

But now fail silently.

PD: sorry, but it's a good recommendation

@joanhey
Copy link
Contributor

joanhey commented Jan 13, 2025

Here started to fail:
May 7, 2024

image

I'll investigate what changed in the bench, but please also search what changed in ReactPHP !!

@joanhey
Copy link
Contributor

joanhey commented Jan 13, 2025

Changes in the toolset :
https://github.com/TechEmpower/FrameworkBenchmarks/commits/master/toolset

Changes in the benchmark code for ReactPHP:
https://github.com/TechEmpower/FrameworkBenchmarks/commits/master/frameworks/PHP/reactphp

PD: if you check the commits, you will see than I try my best, but it is not enough sometimes

@joanhey
Copy link
Contributor

joanhey commented Jan 13, 2025

The last run that work ReactPHP:
Here we show the last commits
https://github.com/TechEmpower/FrameworkBenchmarks/commits/39e29cb04e7d78074ee363aea1e8e2e3d738cbc9/

The next run that failed:
https://github.com/TechEmpower/FrameworkBenchmarks/commits/c3e4826cf93907ed0175c7d8fc09488ab1fb4167/
Or perhaps this one:
https://github.com/TechEmpower/FrameworkBenchmarks/commits/2a5c99b65ac7c877bd5320218072897d3e95bb18/
I don't see anything bad in the commits.
Please check it !!

PD: you can check using the IDs for test it locally

@joanhey
Copy link
Contributor

joanhey commented Jan 13, 2025

A good benchmark it isn't only for performance checks.
I use it to fix problems too.

Check: #9408

@WyriHaximus
Copy link

I can check when started to fail. But it's more important, if anything fail than show the problem to the devs.

Yes, which is why I just filed: #9527

@WyriHaximus
Copy link

Changes in the toolset : https://github.com/TechEmpower/FrameworkBenchmarks/commits/master/toolset

Changes in the benchmark code for ReactPHP: https://github.com/TechEmpower/FrameworkBenchmarks/commits/master/frameworks/PHP/reactphp

Yeah checked those, had to put in a crude version of #9527 to find the issue.

PD: if you check the commits, you will see than I try my best, but it is not enough sometimes

It's a lot, and we're thankful for that.

I'll investigate what changed in the bench, but please also search what changed in ReactPHP !!

Nothing actually, it was the MySQL upgrades to a version with the auth method ReactPHP currently supports enabled. (We need to add support for the never ones 😅 .)

@WyriHaximus
Copy link

If it fail for the Mysql, it's OK. But why fail the tests without DB ?

Because the connectivity test is done against the /db endpoint instead of /plaintext, not sure how to control that so filed #9528 as a step in the right direction. Because having this as out coming makes it a lot clearer where the problem might be:
image

@joanhey
Copy link
Contributor

joanhey commented Jan 13, 2025

You can test it locally
./tfb --mode verify --test reactphp

And if you want to test it directly calling the urls:
./tfb --mode debug --test reactphp

@joanhey
Copy link
Contributor

joanhey commented Jan 13, 2025

After add #9527

image

@joanhey
Copy link
Contributor

joanhey commented Jan 13, 2025

#9527 and #9528 never will be merged, as don't pass the tests.
You need to test it locally till fix the problem.

@joanhey
Copy link
Contributor

joanhey commented Jan 13, 2025

Plaintext and json work without problems.
If you want, we can disable temporally the db tests till fixed.

@WyriHaximus
Copy link

Plaintext and json work without problems. If you want, we can disable temporally the db tests till fixed.

Lets start there, will file a PR for that 👍

@WyriHaximus
Copy link

Given #8303 I've opened #9533

@WyriHaximus
Copy link

#9527 and #9528 never will be merged, as don't pass the tests. You need to test it locally till fix the problem.

FWIW: #8715, #9009, and #9183 all got merged with failing tests.

Plaintext and json work without problems. If you want, we can disable temporally the db tests till fixed.

Yup just filed #9534 for that, will rebase the others once that is passing and merged

@joanhey
Copy link
Contributor

joanhey commented Jan 14, 2025

I created #9529 yesterday, now it's duplicated.

About the Databases update, normally fail, because always exist frameworks that fail. Even frameworks than don't use the database.
With the Databases we test than run with the frameworks than normally work.

PD: the frameworks failing in the last run
https://tfb-status.techempower.com/results/924216cc-3d66-43a2-ad8b-4d423e968e3e

@WyriHaximus
Copy link

I created #9529 yesterday, now it's duplicated.

Missed that as it wasn't mentioned in the PR title, sorry.

About the Databases update, normally fail, because always exist frameworks that fail. Even frameworks than don't use the database. With the Databases we test than run with the frameworks than normally work.

As a maintainer I get it, especially something this big I get it. And I get that #9528 will never be merged, that thing was a discussion starter. However, #9527 is perfectly fine to merge as it doesn't impact the benchmark negatively and will actually positively aid in finding issues with it.

PD: the frameworks failing in the last run https://tfb-status.techempower.com/results/924216cc-3d66-43a2-ad8b-4d423e968e3e

Ow sweet thanks, it's kinda good to see we're not the only ones 😅 .

@joanhey
Copy link
Contributor

joanhey commented Jan 14, 2025

#9257 only show the error, but don't fix the problem.

The tests will fail, and no framework is merged if don't pass the tests in the PR.

@joanhey
Copy link
Contributor

joanhey commented Jan 14, 2025

I don't mentioned in the title, because the important thing is the update to PHP8.4.
But I comment it that it's necessary to disable the db tests to fix the broken run.

@WyriHaximus
Copy link

#9257 only show the error, but don't fix the problem.

The tests will fail, and no framework is merged if don't pass the tests in the PR.

#9538 will not fix the database issue, but at least respond with an error

@WyriHaximus
Copy link

I don't mentioned in the title, because the important thing is the update to PHP8.4. But I comment it that it's necessary to disable the db tests to fix the broken run.

Fair, I was just expecting it in it's own dedicated PR. But that's up to you as maintainer how you prefer to handle that :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants