-
-
Save molotovbliss/a95736ef12ef06d1a9052a1930a610b3 to your computer and use it in GitHub Desktop.
Optimal PHP OPCache for Magento 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Since Magento 2 has even 2x the stack traces, means more OP code to cache in memory and avoid | |
# disk I/O scans with autoloaders without classmapping. | |
### TOOL | |
# Identify number of possible PHP files to consider | |
# view/manage OPcache in a single PHP file | |
`wget https://github.com/rlerdorf/opcache-status/raw/master/opcache.php` | |
# estimate number of max files to run at root of magento | |
`find . -type f -print | xargs grep "<?php" | wc -l` | |
# output returned from the command above, should set max_accelerated_files | |
# with padding (example: 60k php files found, +5-10k for a buffer) | |
# note: 65406 | |
`opcache.max_accelerated_files=65406` | |
*Production ini* | |
``` | |
[opcache] | |
opcache.validate_timestamps=0 | |
opcache.revalidate_freq=0 | |
opcache.max_accelerated_files=65536 | |
opcache.memory_consumption=192 | |
opcache.interned_strings_buffer=16 | |
opcache.fast_shutdown=1 | |
``` | |
*Development/Local ini* | |
``` | |
[opcache] | |
opcache.validate_timestamps=1 | |
opcache.max_accelerated_files=65536 | |
opcache.memory_consumption=192 | |
opcache.interned_strings_buffer=16 | |
opcache.fast_shutdown=1 | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* https://www.scalingphpbook.com/blog/2014/02/14/best-zend-opcache-settings.html | |
* https://magento.stackexchange.com/questions/95058/opcache-recommended-configuration-for-magento2 | |
* http://devdocs.magento.com/guides/v2.1/install-gde/prereq/php-settings.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment