PaymentOn a virtual hosting service is paid daily with personal balance, on the businesshosting included in the fare.
OPcache is designed to cache compiled PHP scripts bytecode in RAM. Its use allows to some extent speed up the work of site scripts and reduce the load they create on the web server. OPcache can be used on any site, no special site support is required.
- Maximum allocated memory:
- On shared hosting - 2 GB.
- On business hosting — 1/4 of the amount of RAM of the tariff, but not more than 2 GB.
- Determine in advance the amount of memory for OPcache that the site will need, unfortunately, impossible. You can find out a specific figure only experimentally, by activating the service and studying the collected statistics. Most sites rarely need more than 32MB.
- Allocate the required amount of memory in the block «OPcache»:
- Wait approximately 15 minutes for the service to activate.
- Customize OPcache for the right sites.
Power on and setup
- The amount of memory for OPcache in the PHP settings of individual sites cannot exceed volume dedicated memory. For example, if you allocate 32 MB and specify this amount in the PHP settings for one site, then you won’t be able to specify memory for OPcache for the second site - you will either need to reduce the amount for the first site, or allocate more memory.
- Too little memory for OPcache can cause error 503. This is not about filling the cache storage by 100%, but about specifying an insufficient amount in the PHP settings for the site.
- You can only use OPcache for sites with PHP version not lower than 5.5.
- OPcache Preloading is not supported due to an insecure setup and the need to update in-memory loaded scripts, which can only be updated when the PHP service is restarted.
- Openup PHP settings.
- Enable the option «OPcache caching », specify the amount of memory allocated to the site in the field «Memory for OPcache» and save the changes:
Parameter «Change check frequency» (opcache.revalidate_freq) is zero by default. This means that with each request it will be checked whether the script has changed and whether it can still be taken from the cache or needs to be called again. It makes sense to use a value greater than zero if the site receives a large number of requests and its files are not edited. This will give some performance boost by reducing the number of disk operations.
- A fully filled OPcache storage will not create errors in the site, but this may be one of the signs that you need to increase the amount of memory allocated for caching.
- When the storage is 100% full, unpopular and old data will be overwritten by more popular ones, there is no need to worry about the efficiency of caching.
- To access statistics, the site must be available via HTTP and in .htaccess there should be no directives that interfere with direct access to files of the form
opcache-stat-XXxxxXxXXXXXX.phpin root directory site.
- In the block «Sites with OPcache enabled» in the line with the desired site, click «Statistics »:
The following information is available in the statistics:
- The version of the module being used.
- Diagram «Percentage of total volume»where you can see:
- The percentage of used memory.
- Free memory percentage.
- Percentage of wasted memory. Lost memory — this is memory that is already occupied by obsolete, irrelevant data. It appears due to changes in scripts or the inability to use current data for them. Such memory is cleared automatically when a certain percentage of the maximum of the total memory is reached, so manual cleaning is not required. This approach makes OPcache run faster.
- Diagram «Percentage of all requests»where you can see:
- Hits — statistics of requests to scripts that were in the cache, and the result was provided without executing the source code.
- Misses — statistics of requests to scripts that not were in the cache and were executed.
- Configuration — a list of OPcache options. All options can be found in documentation.
Clearing the cache
- In the block «Sites with OPcache enabled» in the line with the desired site, click «Clear cache»:
- From the bot menu select «Hosting → Sites → select site → Clear OPcache cache».
For all sites hosting account:
- From the bot menu select «Hosting → Hosting account → choose hosting account → Clear cache → Clear OPcache cache».