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

Allow tuning of PHP8 JIT settings (opcache.jit options in php.ini) #197

Closed
NathanAdhitya opened this issue Apr 15, 2023 · 4 comments
Closed

Comments

@NathanAdhitya
Copy link

NathanAdhitya commented Apr 15, 2023

Issue

SlickStack seems to now support PHP8
PHP8 has a new JIT feature, but an option to tweak was not found in ss-config.
https://php.watch/versions/8.0/JIT

@jessuppi
Copy link
Member

jessuppi commented Mar 29, 2024

Thanks @NathanAdhitya

opcache.enable=1 ;; ss = 1
opcache.enable_cli=1 ;; ss = 1

These are both hardcode enabled in SlickStack by default in the php.ini

https://github.com/littlebizzy/slickstack/blob/master/modules/php-fpm/8.1/php-ini.txt

However I'm not sure where this opcache.jit_buffer_size=256M option comes from because I didn't see it in the default php.ini files on the Ubuntu 22.04 boxes that I reviewed during 2022, so that's strange.

They also mention opcode.jit flags but not sure what that key/value is...

...okay actually, I just found this: https://php.watch/versions/8.4/opcache-jit-ini-default-changes

Prior to PHP 8.4, the default INI configuration values for PHP were:

opcache.jit=tracing
opcache.jit_buffer_size=0

So perhaps these options are "hidden" in PHP 8.1 which is what SlickStack currently uses (the Ubuntu 22.04 default). He goes on to say the following:

In PHP 8.4, the default values for the two configuration options are changed as follows. JIT continues to be disabled by default in PHP 8.4. The only difference is that the default values for INI values have changed.

opcache.jit=disable
opcache.jit_buffer_size=64M

Note that even with the default value changes, JIT is disabled by default.

@jessuppi
Copy link
Member

Unless I made a mistake and forgot to includes those entries in our php.ini boilerplate for PHP 8.1, I think probably at this point we should wait until PHP 8.3 (Ubuntu 24.04) before we add those options to SlickStack.

Ref: https://medium.com/@edouard.courty/make-your-php-8-apps-twice-as-fast-opcache-jit-8d3542276595
Ref: https://stitcher.io/blog/php-8-jit-setup
Ref: https://stackoverflow.com/questions/75609964/choosing-the-best-opcache-jit-buffer-size-value-in-php8-jit

Looks very exciting though...

@jessuppi jessuppi changed the title Allow tuning of PHP's JIT Allow tuning of PHP8 JIT settings (opcache.jit options in php.ini) Mar 29, 2024
@jessuppi
Copy link
Member

A bit messy, I guess we needed a new boilerplate for /etc/php/8.3/mods-available/opcache.ini

New: https://github.com/littlebizzy/slickstack/blob/master/modules/php-fpm/8.3/opcache-ini.txt

Hopefully we can combine more of the opcache settings from php.ini into opcache.ini to keep it cleaner, but need to make sure it causes no issues first.

For now, JIT should be supported with 2 new options in ss-config below:

OPCACHE_JIT_CRTO="1255"
OPCACHE_JIT_BUFFER_SIZE=""

As seen above, the buffer size is blank by default (the same as PHP core) which effectively disables JIT. To enable it simply choose a buffer size like 64M or 100M or larger if your server has a lot of RAM...

Testing and feedback desired, will close this for now, thanks!

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

No branches or pull requests

2 participants