Skip to content

[php] Laravel with RoadRunner #10041

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

joanhey
Copy link
Contributor

@joanhey joanhey commented Aug 8, 2025

Added protobuf extension for faster performance. Thanks @roxblnfk .

Tried with octane:start but it was easier with rr serve directly, to add the Server Header without a middleware.

Update to Laravel 12 and PHP8.4.

Added config/octane.php to set max-request=10000 for all platforms using Octane, that is better for a benchmark.

#9408

PD: ready to be merged.
Laravel-s is fixed in #9950

@joanhey joanhey marked this pull request as draft August 8, 2025 08:12
@joanhey
Copy link
Contributor Author

joanhey commented Aug 8, 2025

@roxblnfk could you help to add the Server Header globally and any optimization ?

It's working OK, but need the Server Header.
And I think it's better than RoadRunner add it globally, without an extra Laravel middelware.

@roxblnfk
Copy link
Contributor

roxblnfk commented Aug 8, 2025

Try to add this declaration with http middleware

http:
 headers:
    response:
      Server: "RoadRunner"

Oh, I see it's here yet

@joanhey
Copy link
Contributor Author

joanhey commented Aug 8, 2025

@roxblnfk
Copy link
Contributor

roxblnfk commented Aug 8, 2025

I think Octane just overrides RR config. We can use https://github.com/roadrunner-php/laravel-bridge that more predictable and respects rr.yaml

@joanhey
Copy link
Contributor Author

joanhey commented Aug 8, 2025

Added the yaml file to Laravel Octane:

ENTRYPOINT ["php", "artisan", "octane:roadrunner", "--host=0.0.0.0", "--port=8080", "--rr-config=/laravel/deploy/roadrunner/.rr.yaml"]

And It's loading the file.

Why rr don't return a Server Header by default ??
And we don't need extra work to add it.

PD: by default all servers add the Server Header, and they only add an option to disable it.

@roxblnfk
Copy link
Contributor

roxblnfk commented Aug 8, 2025

Octane overrides middleware set there:
https://github.com/laravel/octane/blob/4a46a6c4886ea42e4fff4aa781497121083d5e46/src/Commands/StartRoadRunnerCommand.php#L92

Now need to understand how to set config octane.roadrunner.http_middleware

Why rr don't return a Server Header by default ??

Security policy

@roxblnfk
Copy link
Contributor

roxblnfk commented Aug 8, 2025

Also note there is max-requests option. It's bad option BTW, reloading workers like this may decrease performance

Also it doesn't use pipes.
Also debug log-level is very slow, make sure it set to warn or error
logs.output should be stderr. I have no idea how to configure it

@joanhey
Copy link
Contributor Author

joanhey commented Aug 8, 2025

Yes I need to change max-requests as I did with Swoole.
"--max-requests=10000"

@joanhey
Copy link
Contributor Author

joanhey commented Aug 8, 2025

I added the log level in the .rr.yaml file, but perhaps Octane override it.

https://github.com/TechEmpower/FrameworkBenchmarks/pull/10041/files#diff-ded17ef494703a5082d5b4388ca0133e8271495276405936e1b9ccad939ad1a8R10-R12

image

PD: and yes it's better to show the errors in stderr, so we can see it in the runs.

@roxblnfk
Copy link
Contributor

roxblnfk commented Aug 8, 2025

Have you reconsidered using roadrunner-php/laravel-bridge 😄? This bridge has a redesigned worker startup process, but under the hood, it uses Octane to reset state.

@joanhey
Copy link
Contributor Author

joanhey commented Aug 8, 2025

Bypass octane:start and use rr serve directly.
So It's working OK and pass all the tests.

image

@roxblnfk feel free to add or suggest any change in .rr.yaml

https://github.com/TechEmpower/FrameworkBenchmarks/blob/95546ab43b892a7c1ae28a2fedeb5e51f1a40186/frameworks/PHP/laravel/deploy/roadrunner/.rr.yaml

@joanhey joanhey changed the title [php] Laravel Octane with RoadRunner [php] Laravel with RoadRunner Aug 8, 2025
@joanhey joanhey marked this pull request as ready for review August 8, 2025 09:43
@roxblnfk
Copy link
Contributor

roxblnfk commented Aug 8, 2025

feel free to add or suggest any change in .rr.yaml

the same recommendations as before.

Additionally, depending on the nature of the load (CPU/IO), you could try adding gzip middleware: less load on IO, more on CPU.

@joanhey
Copy link
Contributor Author

joanhey commented Aug 8, 2025

Debug level is now:

logs:
  mode: production
  level: error
  output: stdout
  #encoding: json

I don't know how to change the max-requests in .rr.yaml.

This bench requirements:
https://github.com/TechEmpower/FrameworkBenchmarks/wiki/Project-Information-Framework-Tests-Overview#requirements

gzip compression is not permitted.

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.

2 participants