-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Enhance and complement OPcache setup checks #27403
Conversation
987434c
to
6f02aa0
Compare
6f02aa0
to
13f493e
Compare
All checks and functional tests passed: Probably the output lines can be a little enhanced, e.g. showing config key and value on a separate line, or making them fat? Also we could recommend the next power of two for the interned strings buffer, as smaller increments can lead to even a reduced resulting cache size: https://stackoverflow.com/q/67853338 In case of max accelerated files we could recommend the next effective value, as e.g. raising the config from 10000 to 16000 has zero effect, as in both cases 16229 is the resulting value: https://www.php.net/manual/opcache.configuration.php#ini.opcache.max-accelerated-files But also too much magic is probably not great and instead it could make more sense to mention such details in the docs, and re-add the docs URL for further details. The docs should be adjusted then as well, I'll open a companion docs PR when this one is generally accepted. Ah and the And finally, as alternative to |
2e19c83
to
9dc17be
Compare
Thanks for your pull request 👍 Code looks good. The recommendations make sense to me. In serverinfo we have an additional check for the module I prefer #27301 because it does not call opcache_get_status and just check for the minimum values. We should have a short section in our documentation that opcache needs to adjusted for the actual use case and give some examples and references to the php documentation. We have to take into account the people hate the setup checks. Especially when they are not able to fix it. What do you think about writing an app for Nextcloud to monitor the opcache usage, give recommendations how to optimize and maybe take over the opcache api from serverinfo? |
d712f7f
to
dbab0bd
Compare
Whoops, sorry for the long text 😄...
You mean
which then also simplified the evaluation in
Yes, definitely, and this is what I'll do when this PR is accepted. But most users do not read every section of the docs, I suppose, and OPcache is critical for access performance, so doing as good as possible recommendations, that match the actual usage on the particular system, IMO is important. Otherwise users might complain about bad Nextcloud performance (compared to other applications with less OPcache usage), while raising max buffer values could fix it.
Exactly, we regularly receive reports of users who want to have all admin panel recommendations/warnings resolved, regardless if it can be sometimes well argued that they can/should be ignored in a particular case. In most cases the recommended values are too high currently, so this change will reduce the warnings in most cases. If the usage indeed exceeds the currently applied value too often, e.g. because PHP internally handles those differently or Nextcloud grows, it could be discussed whether to have the specifically affected value removed from the test and refer to the documentation instead. But for now I'm 100% sure that this PR helps reducing the warning.
If someone has time to write it, why not. But actually the change and check here is quite simple and preserves what the admin panel checks are intended for, including the IMO quite important performance aspect, that is part of the checks headline for a reason. There are other checks which are IMO way less relevant or should be part of a discussion to have them removed and addressed differently instead, like the case of the Imagick module or these. So when it's about reducing the amount of warnings, then I'd personally not start with OPcache. To have some more overview over OPcache usage in general, allow manual invalidation etc, what I aim to add to the docs is a hint about https://github.com/amnuts/opcache-gui. |
56cd048
to
33a1ee0
Compare
33a1ee0
to
eeaefbd
Compare
eeaefbd
to
a67cc46
Compare
Thanks. Makes sense to checks this as well before calling it then. Since this only means the checks cannot be done, while it does not affect Nextcloud directly (like EDIT: For now I added it a way that the checks are skipped silently. This preserves the previous behaviour when it was not checked but All green again, ready for review from my end. |
2a68067
to
4115c8d
Compare
7473fa8
to
ec8b268
Compare
ec8b268
to
caadeb0
Compare
8248b51
to
17e6f70
Compare
The current OPcache recommendations match the PHP defaults, but the values are much higher than required to run Nextcloud, even with a high number of installed apps. On the other hand, when other applications use the same OPcache instance, the recommended values might not be sufficient. Accurate recommendations need to take into account actual OPcache usage. With this commit, recommendations are shown to raise the config value if more than 90% of max cache size or number of keys is used. The checks whether the module is loaded and whether the OPcache is properly configured have been merged into a single function. This allowed to reduce the overhead of OPcache configuration checks when the module is not loaded. A check has been added whether Nextcloud is permitted to use the OPcache API. Without this, inconsistencies during core or app upgrades may cause errors and OPcache usage cannot be determined for the new usage based checks. OPcache usage based checks are skipped when Nextcloud is not permitted to use the API. Signed-off-by: MichaIng <[email protected]>
17e6f70
to
82c1bea
Compare
I retested all combinations of OPcache and whether the warnings show up as expected, once on master and once on Nextcloud 23, which both works well. |
/backport to stable23 |
Remove the settings block which matches PHP defaults anyway. The Nextcloud admin panel will now show warnings based on actual OPcache usage, when any limit is closely reached: nextcloud/server#27403 Add info about how to enhance performance by reducing or disabling OPcache revalidation. Remove link to outdated blog post, which contains no additional helpful information and the invalid "opcache.fast_shutdown" setting which was removed with PHP7.2 already. Instead, add a link to "opcache-gui", a web interface to monitor and control the OPcache. Signed-off-by: MichaIng <[email protected]>
Related documentation update is proposed here: nextcloud/documentation#7859 |
Remove the settings block which matches PHP defaults anyway. The Nextcloud admin panel will now show warnings based on actual OPcache usage, when any limit is closely reached: nextcloud/server#27403 Add info about how to enhance performance by reducing or disabling OPcache revalidation. Remove link to outdated blog post, which contains no additional helpful information and the invalid "opcache.fast_shutdown" setting which was removed with PHP7.2 already. Instead, add a link to "opcache-gui", a web interface to monitor and control the OPcache. Signed-off-by: MichaIng <[email protected]>
The current OPcache recommendations match the PHP defaults, but the values are much higher than required to run Nextcloud, even with a high number of installed apps. On the other hand, when other applications use the same OPcache instance, the recommended values might not be sufficient. Accurate recommendations need to take into account actual OPcache usage.
With this commit, recommendations are shown to raise the config value if more than 90% of max cache size or number of keys is used.
The checks whether the module is loaded and whether the OPcache is properly configured have been merged into a single function. This allowed to reduce the overhead of OPcache configuration checks when the module is not loaded.
A check has been added whether Nextcloud is permitted to use the OPcache API. Without this, inconsistencies during core or app upgrades may cause errors and OPcache usage cannot be determined for the new usage based checks.
OPcache usage based checks are skipped when Nextcloud is not permitted to use the API, or when the
opcache_get_status
function has been explicitly disabled: see below