Nextcloud 23.02 OPcache interned strings buffer

You cannot run this in console, since you want to measure the webserver’s PHP OPcache instance/handler and not the (empty) PHP OPcache instance built by the PHP CLI command :wink:. Put this code into a .php file inside your webroot and open it in browser to get the info.

1 Like

Thank you for clarifying. Now if only I can stop NC from redirecting when a different file is specified… ie https://nc.domain.com/opcache.php still directs to …/apps/files.

Edit: a few edits in .htaccess fixed this. Can now see it.

Ah right, I forgot Nextcloud’s redirect rules (I have it in a subdirectory). You can trick it by using a known excluded directory. Create the following directory inside the Nextcloud dir and put the script inside:

.well-known/acme-challenge

Point your browser to the respective path.

my settings in php 7.4 to get :white_check_mark: All checks passed :sunglasses: in overview

memory_limit = 512M
upload_max_filesize = 200M
max_execution_time = 360
post_max_size = 200M
date.timezone = Europe/Paris
opcache.enable=1
opcache.interned_strings_buffer=64
opcache.max_accelerated_files=50000
opcache.memory_consumption=128 ou 512
opcache.save_comments=1
opcache.revalidate_freq=1
opcache.max_wasted_percentage=15
opcache.validate_timestamps=0
opcache.revalidate_freq=0
opcache.fast_shutdown=1
opcache.fast_shutdown=1
opcache.mmap_base=0x20000000
opcache.file_cache_fallback=1

add in config/config.php
‘memcache.local’ => ‘\OC\Memcache\APCu’,

For a small instance with a single server the recommended configuration is APCu for local memcache and Redis for everything else!

install APCu: debian 11 / nextcloud 23.02

sudo apt install php8.0-apcu

APCu is disabled by default on CLI which could cause issues with Nextcloud’s cron jobs. Make sure to set apc.enable_cli to 1 on /etc/php/8.0/cli/php.ini or append --define apc.enable_cli=1 to the cron job command.
re-enabled the memcache in the nextcloud config and this executes without error message:

https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/caching_configuration.html#id1

sudo -u www-data php --define apc.enable_cli=1 -f /var/www/nextcloud/cron.php

this fix the OPcache interned strings buffer is nearly fullMemory Caching

konki

edit:
this solution was effective only at the implementation, the warning reappeared. I finally installed and configured Redis and uninstalled apcu, no more OPcache errors

https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/caching_configuration.html#id2

Don’t forget to restart apache2/nginx, Redis and absolutely php-fmp

Nginx php8.0 debian11
sudo systemctl restart nginx php8.0-fpm

Optimization could be the subject of a topic on the forum, there are many tools that give information on the functioning of the web server, up to the database (GitHub - amnuts/opcache-gui: A clean, effective and responsive interface for Zend OPcache, PHP-FPM Process Caluculator https://pgtune.leopard.in.ua/ and many others.

Someone is in charge of it?

1 Like

I had opcache.interned_strings_bufferalready set to ugly huge numbers like 272 - and the warning came back anyway after few days. Restarting PHP-FPM service “solves” this (warning disappears) for some time, just a workaround at best.

It really doesn’t matter what (huge value) is set, the root issue - and if it’s only NC misleadingly complaining about it - must be another thing.

1 Like

Another easy way to see the currently used memory values is to navigate to

https://YOUR-NEXTCLOUD.com/ocs/v2.php/apps/serverinfo/api/v1/info

(Got the link from the bottom of the admin system page)

You have to be logged in as admin in your browser for this link to work.

Output is like this:

[...]
<interned_strings_usage>
<buffer_size>12582464</buffer_size>
<used_memory>4779120</used_memory>
<free_memory>7803344</free_memory>
<number_of_strings>75022</number_of_strings>
</interned_strings_usage>
[...]

Then refresh the page to see the changes you made in e.g:
/etc/php/7.4/apache2/conf.d/10-opcache.ini

If you are on a shared server, or multiple websites are running, this warning is normal.
Opcache is by default shared per PHP version. You get this warning also when you have Redis activated. I’ve had 4GB Opcache that had effect for a little time.
You can try to set parameters for the Opcache, but tose have no effect. Only on serverlevel per PHP settings work is my experience.
On github you can find a little tool (php script) to see what is in the Opcache.

No, my own plain baremetal Debian/Raspberry Pi OS.

This warning keeps being annoying. For now I deciced to actively ignore it after every NC update until it magically solves itself by a fix in an update. Just a waste of time for 1,5 years now.

In our case the message is gone by changing /usr/local/directadmin/custombuild/custom/opcache/opcache.ini
| Enabled | Yes |
| Cache full | No |
| Restart pending | No |
| Restart in progress | No |

After this, rebuild opcache.
Perhaps this helps.

How? Did you stare at it for 1.5 years?

Sorry could not help it :wink:

1 Like

Yes I did. I did not try to do what the message says after every NC update for 1,5 years. Now I try to just stare at your profile for another 1,5 years. :upside_down_face:

1 Like

So this seems to basically just silence this message completely.

Are there any downsides to this? What if the cache will really be filled some day, should Nextcloud be aware of that?

For now it looks like a neat workaround. Will look into that one, thank you.

We have Redis enabled on the server. Each user has a unique Redis container that can hold up to 15 databases:
‘memcache.local’ => ‘\OC\Memcache\Redis’,
‘memcache.locking’ => ‘\OC\Memcache\Redis’,
‘redis’ =>
array (
‘host’ => ‘/home/username/.redis/redis.sock’,
‘port’ => 0,
‘dbindex’ => 3,
‘timeout’ => 1.5,
),
That works fine.

The Opcache is not needed as far as I know. But to answer your question: it will always be filled competely after some time and if default settings are used, it wil auto refresh contents. Have a look at PHP: Runtime Configuration - Manual to see the runtime configuration options for Opcache.

That’s exactly what I use too (REDIS). How to get rid of the OPcache stuff so this warning is a thing of the past?

I only have a /etc/php/8.1/fpm/conf.d/10-opcache.ini and that looks different and I know nothing bout rebuilding.

Server tuning — Nextcloud latest Administration Manual latest documentation states it’s basically a good thing.

I think I will continue to just ignore this dumb useless warning still seen on NC v25.0.5.1.

Try using php8.0-fcgi instead of fpm. Resolved issues for us after we updated to 25.0.5

What exactly do you mean when you say “using php8.0-fcgi instead”?

FPM is short for FastCGI Process Manager and the corresponding package is called php-fpm, respectively php8.0-fpm in most Linux distributions. There is no php-fcgi package, at least not in the distributions I know.

Sorry if it was a bit unclear. We have a GUI where we can change PHP Versions. Those include a package called php8.0-fpm as well as php8.0-fcgi. The correct package name in the distros would just be php8.0-cgi

what is the equivalent setting of opcache.interned_strings_buffer when using nginx?

1 Like

should be the same i guess. you should find it in the php.ini of your nginx

1 Like