nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
27.49k stars 4.08k forks source link

Consider "wasted memory" for OPcache setup checks #49438

Open MichaIng opened 18 hours ago

MichaIng commented 18 hours ago

How to use GitHub

Is your feature request related to a problem? Please describe.

We have a case there a Nextcloud AIO Docker container admin receives full OPcache warnings, despite size being raised to 256 MiB and JIT buffer reduced to 8 MiB, which was thought to be sufficient with larger margin: https://github.com/nextcloud/all-in-one/issues/5559 While the intransparent increase of the overall OPcache usage, when JIT is enabled (not transparently in dedicated JIT buffer) explains this case mostly, another part is a relatively high "wasted memory":

When scripts are updated and their OPcache entry is updated via common revalidation (not active invalidation), their old entry seems to remain, occupying OPcache as wasted memory. It is however freed (via engine restart) automatically, if additional memory is needed, and wasted memory does exceed 5% (default) of the overall OPcache size. The linked report at AIO indicates that the OPcache engine did not require more memory yet, as the wasted memory did exceed 5%, but was not cleared, obviously.

The Nextcloud admin panel checks do not consider wasted memory as potential free memory yet.

Describe the solution you'd like

Read out opcache.max_wasted_percentage value, and consider all wasted cache above this percentage was free memory, as it would be freed, as fast as the engine really requires it.

Describe alternatives you've considered

Simpler, but possible false negatives: Consider all wasted memory as free memory.

Additional context I will implement this, once I find time.