Archive

Archive for December, 2014

OPcache

December 20, 2014 Leave a comment

OPcache is bundled with PHP 5.5.0 and later, and is available in PECL for lower PHP version.
OPcache improves PHP performance. OPcache stores precompiled script bytecode in shared memory on first request. When next request comes then PHP does not compile that script, it uses precompiled script from OPcache.
cache opcache_reset() OPcache offers a function to reset.
pcache_invalidate ( string $script [, boolean $force = FALSE ] ) This function invalidate a script.

Enable OPcache on linux: To enable OPcache on linux uncommment or add this line in php.ini zend_extension=opcache.so if this not enable OPcache on server then put full path of opcache.so

OPcache configuration: You can change OPcache configuration from php.ini. Some important configuration setting are
1. opcache.revalidate_freq=60
Here 60 is seconds. OPcache validate cache after given seconds.

2. opcache.max_accelerated_files=7000
This is number of script sotre in OPcache. You can change this number as you needed.

To see OPcache configuratin and status you need a script on same server. Opcache-gui is the good script.

Resources:
PHP.net
Scaling PHP Book
Appdynamics

Advertisements
Categories: php Tags: , , , , , , ,
%d bloggers like this: