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

[PHP, Spiral/RoadRunner]: update Dockerfile to address RR v2024.x.x requirements #9021

Merged
merged 1 commit into from
May 16, 2024

Conversation

rustatian
Copy link
Contributor

Starting from the RR v2024.1.0 it requires protobuf and grpc extension installed. They used to improve the performance of parsing proto-requests.

Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
@joanhey
Copy link
Contributor

joanhey commented May 15, 2024

Help me with laravel and symfony with roadrunner.
I spend almost 1 week with Symfony runtime and roadrunner !!

Thank you !!

@rustatian
Copy link
Contributor Author

Hey @joanhey 👋

Have you tried this: https://github.com/php-runtime/roadrunner-symfony-nyholm ?

@joanhey
Copy link
Contributor

joanhey commented May 15, 2024

Symfony with Roadrunner
https://github.com/joanhey/FrameworkBenchmarks/actions/runs/9093103519/job/24991316667#step:9:1757
image

Files:
joanhey@19554eb

@rustatian Perhaps it's easy for you fix it !!

@rustatian
Copy link
Contributor Author

Ah, got u (I'm not a PHP dev btw, but I'll try to help you). You need to install the latest versions of the spiral/worker and spiral/roadrunner-http packages: https://docs.roadrunner.dev/general/compatibility#compatibility-with-roadrunner-php-packages

@joanhey
Copy link
Contributor

joanhey commented May 15, 2024

The php-runtime only use "spiral/roadrunner": "^2.0", so they need to fix it to work with rr v2024.
https://github.com/php-runtime/roadrunner-symfony-nyholm/blob/main/composer.json#L15C9-L15C37

For now working using RoadRunner v2023.3. #9024

Thank you @rustatian

@rustatian
Copy link
Contributor Author

You're welcome @joanhey 😃
I'll ask our PHP team to create a PR to fix RR support for the symfony runtime component.

@NateBrady23 NateBrady23 merged commit b2f23c5 into TechEmpower:master May 16, 2024
@rustatian rustatian deleted the chore/protobuf-rr branch May 16, 2024 18:29
@joanhey
Copy link
Contributor

joanhey commented May 16, 2024

This PR was merged without the tests and fail.
I'll fix it and clean the dockderfile.

@rustatian
Copy link
Contributor Author

Thanks @joanhey 👍 , feel free to ping me if you need any help with RR. I already asked our PHP team to send a PR to the symfony runtime, let's see how it goes 😃

@joanhey
Copy link
Contributor

joanhey commented May 16, 2024

Ping me when the symfony runtime is updated.

joanhey added a commit to joanhey/FrameworkBenchmarks that referenced this pull request May 16, 2024
@joanhey
Copy link
Contributor

joanhey commented May 16, 2024

I'll enable JIT also.

@joanhey
Copy link
Contributor

joanhey commented May 16, 2024

@rustatian
Copy link
Contributor Author

I've double checked, grpc ext can be excluded. Only protobuf is really required.

@rustatian
Copy link
Contributor Author

I can push a PR to exclude it

@joanhey
Copy link
Contributor

joanhey commented May 16, 2024

I'm changing more things in #9032
By default the php:8.3-cli don't include OPCache.

@joanhey
Copy link
Contributor

joanhey commented May 16, 2024

Without grpc the container is built in ~3 min, before ~12 min.

@joanhey
Copy link
Contributor

joanhey commented May 16, 2024

Still fail the update test. It was failing for a lot of time also.
I think that it is a problem with the ORM and cache.
I can help, but your team need to check it.

@joanhey
Copy link
Contributor

joanhey commented May 16, 2024

Well they need to check also, why it create so many db calls .
image

The update problem:
image

@rustatian
Copy link
Contributor Author

This is strange... You mean, that after adding the protobuf extension, tests start to fail?

@joanhey
Copy link
Contributor

joanhey commented May 16, 2024

@rustatian
Copy link
Contributor Author

rustatian commented May 16, 2024

Ok, this is some problem in Spiral Framework, right?

EDIT: ORM, ok, got u. Will send these results to our PHP team.

@joanhey
Copy link
Contributor

joanhey commented May 16, 2024

The problems are from the ORM.

@joanhey
Copy link
Contributor

joanhey commented May 16, 2024

Your PHP team can contact me, if they need it.

@joanhey
Copy link
Contributor

joanhey commented May 16, 2024

Today I send a private message in Slack to Dunglas for the very bad results of FrankenPHP with laravel.
Only 200 req/s 😞 , and asked him to check the PR, still waiting for a response. But for me the PR is correct.

@rustatian
Copy link
Contributor Author

Oh, 200req/s is a very bad result. Hope he'll find the reason.

@joanhey
Copy link
Contributor

joanhey commented May 16, 2024

Just checked the changes in the new PR.
And OPCache and JIT are enabled for Spiral.

image

@joanhey
Copy link
Contributor

joanhey commented May 16, 2024

But after very reloads, still show:
Cache hits => 0
So for any reason it isn't using the OPCache.

@joanhey
Copy link
Contributor

joanhey commented May 16, 2024

If you open a new PHP-CLI each time for each child.
The OPCache never will be reused !!

@rustatian
Copy link
Contributor Author

rustatian commented May 16, 2024

OPCache will be used per CLI process, since it is an SHM region related to a current PHP process. In FPM for example, in a fork (not TSRM) mode, they share single SHM region for all workers (since FPM fork the ptr to it). Thus they can benefit from that.
But RR still benefit from OPCache, but in the other ways.
Also, on Windows (for example), all PHP CLI processes can share the singe SHM region.

@joanhey
Copy link
Contributor

joanhey commented May 16, 2024

Actually it isn't using the opcache, only generate the opcodes but are never reused.
Test yourself, and the hits show always 0.

@joanhey
Copy link
Contributor

joanhey commented May 16, 2024

I'll try later with only 1 worker.

EDIT: tested with 1 worker, always Cache hits => 0

@rustatian
Copy link
Contributor Author

You need to enable opcache cli option.

@joanhey
Copy link
Contributor

joanhey commented May 16, 2024

It's enabled

image

EDIT: with 1 woker only, to avoid workers without initialization

@rustatian
Copy link
Contributor Author

You may try to use opcache.cli directive directly in the server.command. However, it is correct, that applications like RR benefit minimal from OPCache, since everything already in memory.
Unlike FPM, we don't need to use request_startup/shutdown (RINIT) on every request, unloading the script entirely.

@rustatian
Copy link
Contributor Author

Or you may add opcache.enable_cli=1 to your php.ini. Based on your PR, I see only JIT related option enabled.

@joanhey
Copy link
Contributor

joanhey commented May 16, 2024

I understand persistent php, and still benefit a lot of the OPCache.
But RR is the contrary use the time to create the opcodes, but never reuse it.
It's enabled in the php.ini, and the screen capture is from the Spiral running in local.

./tfb --mode debug --test spiral

image

image

I'll try to add in the server.command. But I think that will have the same effect.

@joanhey
Copy link
Contributor

joanhey commented May 16, 2024

Show the info() method that I added in local to the controller.
image

NateBrady23 pushed a commit that referenced this pull request May 23, 2024
* Fix #9021 fail to build grpc

* Add OPCache, JIT, clean dockerfile

* Move Pecl build up
for faster local builds when only change the code
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.

None yet

3 participants