Skip to content

Add ngx-php to opcache supported sapis #11013

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

Merged
merged 1 commit into from
Apr 4, 2023
Merged

Conversation

joanhey
Copy link
Contributor

@joanhey joanhey commented Apr 4, 2023

Now we are using the cli-server.
But it's time to use our name in the SAPI.

This SAPI embed PHP in Nginx server.
https://github.com/rryqszq4/ngx-php

And in the Techempower benchmarks, it's the fastest PHP SAPI. https://www.techempower.com/benchmarks/#section=data-r20

Thank you.

Now we are using the cli-server.
But it's time to use our name in the SAPI.

This SAPI embed PHP in Nginx server.
https://github.com/rryqszq4/ngx-php

And in the Techempower benchmarks, it's the fastest PHP SAPI.
https://www.techempower.com/benchmarks/#section=data-r20

Thank you.
@joanhey
Copy link
Contributor Author

joanhey commented Apr 4, 2023

Welcome any help to this SAPI :)

@joanhey
Copy link
Contributor Author

joanhey commented Apr 4, 2023

Perhaps will be good to facilitate to new SAPIs, to use the OPcache.
Anyway any SAPI can use it, with the cli-server SAPI. We do it now, and also the php module in nginx-unit.

Copy link
Member

@iluuu1994 iluuu1994 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the future, it might make more sense for the SAPI to opt into opcache rather than opcache opting into SAPIs. But this looks ok to me for what we have now.

@iluuu1994 iluuu1994 merged commit 9e86142 into php:master Apr 4, 2023
@dstogov
Copy link
Member

dstogov commented Apr 4, 2023

hi @joanhey, I suspect ngx-php is not going to be fully compatible with opcache.
Do it run php code for different requests in context of a single multiplexing process?
In this case opcache itself won't make speed improvement, but it enables Optimizer and JIT that may help.

It's not a big problem to merge this commit, but it's better to implement @iluuu1994 idea (add some SAPI flag).

@joanhey
Copy link
Contributor Author

joanhey commented Apr 4, 2023

It's multi-process and one thread in per-process, because nginx use multi-process . So php handle request one by one in pre-process of nginx.
So every ngx-php is a fork, and only process 1 req at a time.

But we can also include php files outside of the init worker, and without the OPcache the performance is not very good.

@joanhey
Copy link
Contributor Author

joanhey commented Apr 4, 2023

image

This graph is without OPcache.
With opcache we have the same performance, with the code inline or included from file.

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

Successfully merging this pull request may close these issues.

3 participants