Wednesday, 15 February 2012

php - Memcached request loop or cache stampede in WordPress -



php - Memcached request loop or cache stampede in WordPress -

i have clustered wordpress webapp using memcached cluster consisting of 6 nodes store wordpress's object cache, i'm seem experiencing sort of sporadic memcached set/replace loop or cache stampede causes single node in memcached cluster saturate memcached , database network link.

the set/replace loop or stampede seems caused lots of attempts trying “add” wordpress “wp_:options:alloptions” key memcached replies not_stored particular queries. while @ same time bulk of mysql queries this:

select option_name, option_value wp_options autoload = 'yes'

the alter i've made memcached object cache plugin (http://wordpress.org/extend/plugins/memcached/), default expiration setting.

#var $default_expiration = 0; //original var $default_expiration = 1800;

so far have been able mitigate problem increasing memcached daemon maximum connection limit. changed database storage engines myisam innodb, , increased apc shm_size 128m 1536m.

is object cache set/replace loop or stampede inevitable or consequence of current setup?

environment:

wordpress version 3.7.1 memcached 2.0.2 plugin http://wordpress.org/extend/plugins/memcached/

memcached 1.4.14-1

port="11211" user="nobody" maxconn="10240" cachesize="4096" options=""

php 5.3.28

memcache version 3.0.8 memcache back upwards => enabled memcache.allow_failover => 0 => 0 memcache.chunk_size => 32768 => 32768 memcache.compress_threshold => 20000 => 20000 memcache.default_port => 11211 => 11211 memcache.hash_function => fnv => fnv memcache.hash_strategy => consistent => consistent memcache.lock_timeout => 15 => 15 memcache.max_failover_attempts => 20 => 20 memcache.protocol => ascii => ascii memcache.redundancy => 1 => 1 memcache.session_redundancy => 2 => 2 registered save handlers => files user memcache

apc version => 3.1.9 apc debugging => disabled mmap back upwards => enabled mmap file mask => locking type => pthread mutex locks serialization back upwards => broken directive => local value => master value apc.cache_by_default => on => on apc.canonicalize => on => on apc.coredump_unmap => off => off apc.enable_cli => off => off apc.enabled => on => on apc.file_md5 => off => off apc.file_update_protection => 2 => 2 apc.filters => no value => no value apc.gc_ttl => 3600 => 3600 apc.include_once_override => off => off apc.lazy_classes => off => off apc.lazy_functions => off => off apc.max_file_size => 1m => 1m apc.mmap_file_mask => no value => no value apc.num_files_hint => 1000 => 1000 apc.preload_path => no value => no value apc.report_autofilter => off => off apc.rfc1867 => off => off apc.rfc1867_freq => 0 => 0 apc.rfc1867_name => apc_upload_progress => apc_upload_progress apc.rfc1867_prefix => upload_ => upload_ apc.rfc1867_ttl => 3600 => 3600 apc.serializer => default => default apc.shm_segments => 1 => 1 apc.shm_size => 1536m => 1536m apc.slam_defense => on => on apc.stat => on => on apc.stat_ctime => off => off apc.ttl => 0 => 0 apc.use_request_time => on => on apc.user_entries_hint => 4096 => 4096 apc.user_ttl => 0 => 0 apc.write_lock => on => on

matslindh right. add together random expiration options minimize number of entries expire @ same time. can minimize stampedes locks while 1st racer writes cache.

php mysql wordpress caching memcached

No comments:

Post a Comment