Fine Tuning OPcache

The performance improvement gained by letting the OPcache run out-of-the-box can be further enhanced with fine-tuning. These are advanced settings that need to be evaluated based on your environments usage specifications and performance requirements.

Note:

These are only recommendations, in most cases, such fine-tuning should not be necessary.

Disabling Code Change Auto-Detection

In the User Interface, to view the specific directives for OPcache, go to Configurations | Zend Components and select the OPcache component from the Components list.  

In the Directives list, look for the "zend_opcache.validate_timestamps" directive and set the value to Off.
This speeds up the server, but also requires that you restart the server if you deploy new versions of existing files.

When to change: If your PHP code is rarely updated/changed or if you are capable of manually restarting your PHP on every code update.

When not to change: If you are in development and you are frequently changing code, or if you do not have control over the code update process.

Decreasing Code Validation Frequency

In the User Interface, to view the specific directives for OPcache, go to Configurations | Zend Components and select the OPcache component from the Components list.  

In the Directives list, look for the "zend_opcache.revalidate_freq" directive, and set the value to 30 (seconds). Zend Server is now set to check PHP file changes every 30 seconds.

When to change: If you do not change PHP files often and some delay between file update and site update is acceptable, you may set it even higher.

When not to change: If you have frequently changing files and you need the changes to take effect immediately.