I use this in a single server environment.Zend Opcache + Memcached
Why did you replace xCache?I use this in a single server environment.
Because I'm running PHP 5.5 and ZendOpcache works really well. I've not ran Xcache since moving to 5.5.Why did you replace xCache?
Well = faster? Have you tried to compare?Because I'm running PHP 5.5 and ZendOpcache works really well. I've not ran Xcache since moving to 5.5.
Main reason I replaced it was the OPCode cache is now a built in option for PHP... memcached because I have 5 VPS's that it's distributed across.Why did you replace xCache?
On that matter xCache is superior (if we compare only the two) because it's also a variable cache.Main reason I replaced it was the OPCode cache is now a built in option for PHP..
Would you mind sharing your config.php and opcache/memcache settings?No noticeable difference in my usage example.
Nothing specialWould you mind sharing your config.php and opcache/memcache settings?
Thanks.
$config['cache']['enabled'] = true;
$config['cache']['frontend'] = 'Core';
$config['cache']['frontendOptions']['cache_id_prefix'] = 'mattw_';
$config['cache']['frontendOptions']['automatic_serialization'] = true;
$config['cache']['cacheSessions'] = true;
$config['cache']['backend']='Libmemcached';
$config['cache']['backendOptions']=array(
'compression'=>false,
'servers' => array(
array(
'host'=>'127.0.0.1',
'port'=>'11211',
'persistent' => 'true'
)
)
);
; Enable OPcache extension module
zend_extension = opcache.so
[opcache]
; Enables the opcode cache.
; The default is Off.
opcache.enable = On
; Enables the opcode cache for the CLI version of PHP.
; The default is Off.
;opcache.enable_cli = Off
; Size of the shared memory storage used by OPcache, in megabytes.
; The default is 64.
opcache.memory_consumption = 1024
; Amount of memory used to store interned strings, in megabytes.
; The default is 4.
opcache.interned_strings_buffer = 8
; Maximum number of keys in the OPcache hash table.
; Only numbers between 200 and 100000 are allowed.
; The default is 2000.
;opcache.max_accelerated_files = 2000
; Maximum percentage of wasted memory until a restart is scheduled.
; The default is 5.
opcache.max_wasted_percentage = 5
; If enabled, OPcache appends the current working directory to the script key,
; thereby eliminating possible collisions between files with the same base name.
; The default is On.
opcache.use_cwd = On
; If enabled, OPcache will check for updated scripts every revalidate_freq
; seconds. When this directive is disabled, you must reset OPcache manually
; via opcache_reset(), opcache_invalidate() or by restarting the Web server
; for changes to the filesystem to take effect.
; The default is On.
opcache.validate_timestamps = On
; How often to check script timestamps for updates, in seconds.
; 0 will result in OPcache checking for updates on every request.
; The default is 2.
opcache.revalidate_freq = 60
; If disabled, existing cached files using the same include_path will be reused.
; If a file with same name is elsewhere in the include_path, it won't be found.
; The default is Off.
;opcache.revalidate_path = Off
; If disabled, all documentation comments will be discarded from opcode cache
; to reduce the size of the optimised code. Disabling this directive may break
; applications and frameworks that rely on comment parsing for annotations,
; including Doctrine, Zend Framework 2 and PHPUnit.
; The default is On.
;opcache.save_comments = On
; If disabled, documentation comments won't be loaded from opcode cache even if
; they exist. This can be used with opcache.save_comments to only load comments
; for applications that require them.
; The default is On.
;opcache.load_comments = On
; If enabled, a fast shutdown sequence is used that doesn't free each allocated
; block, but relies on the Zend Engine memory manager to deallocate the entire
; set of request variables en masse.
; The default is Off.
opcache.fast_shutdown = On
; When enabled, the opcode cache will be checked for whether a file has already
; been cached when file_exists(), is_file() and is_readable() are called.
; This may increase performance in applications that check the existence
; and readability of PHP scripts, but risks returning stale data if
; opcache.validate_timestamps is disabled.
; The default is Off.
opcache.enable_file_override = On
; Bitmask controling which optimisation passes are executed.
; The default is 0xffffffff.
;opcache.optimization_level = 0xffffffff
; This configuration directive should only be enabled to work around the
; 'Cannot redeclare class' errors.
; The default is Off.
;opcache.dups_fix = Off
; Location of the OPcache blacklist file.
; A blacklist file is a text file containing the names of files that should
; not be accelerated, one per line. Wildcards are allowed, and prefixes can also
; be provided. Lines starting with a semi-colon are ignored as comments.
;opcache.blacklist_filename = "/etc/php.d/opcache*.blacklist"
; Maximum file size that will be cached, in bytes.
; If this is 0, all files will be cached.
; The default is 0.
;opcache.max_file_size = 0
; If non-zero, OPcache will verify the cache checksum every N requests,
; where N is the value of this configuration directive. This should only be
; enabled when debugging, as it will impair performance.
; The default is 0.
;opcache.consistency_checks = 0
; Length of time to wait for a scheduled restart, in seconds.
; If the timeout is hit, then OPcache assumes that something is wrong and will
; kill the processes holding locks on the cache to permit a restart.
; The default is 180.
;opcache.force_restart_timeout = 180
; Error log for OPcache errors.
; An empty string is treated the same as stderr, and will result in logs being
; sent to standard error, which will be the Web server error log in most cases.
;opcache.error_log = ""
; Log verbosity level.
; By default, only fatal errors (level 0) and errors (level 1) are logged.
; Other levels available are warnings (level 2), information messages (level 3)
; and debug messages (level 4).
; The default is 1.
;opcache.log_verbosity_level = 1
; Preferred memory model. Possible values: mmap, shm, posix
; If left empty, OPcache will choose the most appropriate model, which is the
; correct behaviour in virtually all cases.
;opcache.preferred_memory_model = ""
; Protects shared memory from unexpected writes while executing scripts.
; This is useful for internal debugging only.
; The default is Off.
;opcache.protect_memory = Off
Why did you exclude this one?;opcache.max_accelerated_files = 2000
Because 2000 is the default value, and I'm not caching more than that on the server. I'll increase it if needed at a later date.Thanks.
Why did you exclude this one?
Are you using any particular UI for Zend_Opcache/Memcached?Because 2000 is the default value, and I'm not caching more than that on the server. I'll increase it if needed at a later date.
Well = faster? Have you tried to compare?
; If enabled, OPcache will check for updated scripts every revalidate_freq
; seconds. When this directive is disabled, you must reset OPcache manually
; via opcache_reset(), opcache_invalidate() or by restarting the Web server
; for changes to the filesystem to take effect.
; The default is On.
opcache.validate_timestamps = On
; How often to check script timestamps for updates, in seconds.
; 0 will result in OPcache checking for updates on every request.
; The default is 2.
opcache.revalidate_freq = 60
When I enable it, it says in the UI for Zend OPcache (by Carlos Buenosvinos):that is the primary reason we moved to opcache, saves us tons of stat() calls to our (remote) storage, we're using 10 seconds timeout btw.Code:; If enabled, OPcache will check for updated scripts every revalidate_freq ; seconds. When this directive is disabled, you must reset OPcache manually ; via opcache_reset(), opcache_invalidate() or by restarting the Web server ; for changes to the filesystem to take effect. ; The default is On. opcache.validate_timestamps = On ; How often to check script timestamps for updates, in seconds. ; 0 will result in OPcache checking for updates on every request. ; The default is 2. opcache.revalidate_freq = 60
When I enable it, it says in the UI for Zend OPcache (by Carlos Buenosvinos):
opcache.validate_timestamps - true:
"If you are in a production environment you should disabled it"
I would not recommend having opcache.fast_shutdown = On until some issues in the Zend Opcache are fixed. I have noticed that when this setting is enabled on an SSL server with SPDY enabled and PHP is running as a FastCGI process, PHP will randomly (must be a race condition) perform the fast-shutdown before the browser has finished downloading all the response data and drop the FCGI connection between PHP and the web server. This results in the client not receiving all the packets in the response and the browser displays a partially rendered page. The SPDY connection reports as failed, and many browsers will disable SPDY support for all future connections to the site until the browser is restarted.opcache.fast_shutdown = On
strange never experienced that before myself - using CentOS 6.5 64bit with source compiled Nginx 1.7.4 SPDY/3.1 SSL + ngx_pagespeed with source compiled PHP-FPM 5.5.16 Zend Opcache 7.04-dev and fast shutdown enabled https://community.centminmod.com/I would not recommend having opcache.fast_shutdown = On until some issues in the Zend Opcache are fixed. I have noticed that when this setting is enabled on an SSL server with SPDY enabled and PHP is running as a FastCGI process, PHP will randomly (must be a race condition) perform the fast-shutdown before the browser has finished downloading all the response data and drop the FCGI connection between PHP and the web server. This results in the client not receiving all the packets in the response and the browser displays a partially rendered page. The SPDY connection reports as failed, and many browsers will disable SPDY support for all future connections to the site until the browser is restarted.
It took me 2 weeks of staring at logs wondering why the heck this was happening until I randomly decided to toggle the opcache settings one by one.
Could you paste some relevant log lines? so I know what to look for in the logsIt took me 2 weeks of staring at logs wondering why the heck this was happening until I randomly decided to toggle the opcache settings one by one.
We use essential cookies to make this site work, and optional cookies to enhance your experience.