Skip to content

Add ngx-php to opcache supported sapis#11013

Merged
iluuu1994 merged 1 commit into
php:masterfrom
joanhey:patch-1
Apr 4, 2023
Merged

Add ngx-php to opcache supported sapis#11013
iluuu1994 merged 1 commit into
php:masterfrom
joanhey:patch-1

Conversation

@joanhey

@joanhey joanhey commented Apr 4, 2023

Copy link
Copy Markdown
Contributor

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

joanhey commented Apr 4, 2023

Copy link
Copy Markdown
Contributor Author

Welcome any help to this SAPI :)

@joanhey

joanhey commented Apr 4, 2023

Copy link
Copy Markdown
Contributor Author

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.

@iluuu1994 iluuu1994 left a comment

Copy link
Copy Markdown
Member

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

dstogov commented Apr 4, 2023

Copy link
Copy Markdown
Member

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

joanhey commented Apr 4, 2023

Copy link
Copy Markdown
Contributor Author

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

joanhey commented Apr 4, 2023

Copy link
Copy Markdown
Contributor Author

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