Stack Matrix Hub (10)
OPcache Sizing for Moodle 4.x Codebase & Interned Strings
Prevent OPcache full-cache eviction storms across Moodle 4.x 15,000+ PHP files by sizing opcache.memory_consumption and interned_strings_buffer.
256-384 MB OPcache · 32-64 MB interned_strings · max_accelerated_files=32531
Counting Moodle 4.x Core + Plugin PHP Files
A clean Moodle 4.4 tree exceeds 14,000 PHP files, and adding H5P, BigBlueButton, attendance, and custom themes pushes total compiled scripts past 22,000 files. PHP default max_accelerated_files=10000 causes silent cache misses and CPU spikes.
Fixing Interned Strings Exhaustion Under PHP 8.2/8.3
Leaving opcache.interned_strings_buffer at 8 MB triggers full OPcache resets every few hours on active Moodle sites. Set opcache.memory_consumption=320, opcache.interned_strings_buffer=48, and opcache.max_accelerated_files=32531 inside php-fpm.conf.
Measured Thresholds & Configuration
| Moodle Codebase Profile | memory_consumption | interned_strings_buffer | max_accelerated_files |
|---|---|---|---|
| Moodle 4.3 Core | 256 MB | 32 MB | 20000 |
| Moodle 4.4/4.5 Mixed | 320 MB | 48 MB | 32531 |
| Moodle 4.5 + Heavy Plugins | 384 MB | 64 MB | 65407 |