Upgrading or changing memcahe client without invalidating the memcache.

6 views
Skip to first unread message

memcached-user

unread,
Jun 17, 2011, 12:30:00 PM6/17/11
to memc...@googlegroups.com
Hello.
 We wanted to change the hashing strategy of the memcache (memcache.hash_strategy) from "standard" to 
"consistent". Is there a easier way to do this without invalidating all of the memcache?

If we do change it on the run, All the key will be a miss and the load on db will increase. 


 

Matt Ingenthron

unread,
Jun 17, 2011, 7:49:16 PM6/17/11
to memc...@googlegroups.com, memcached-user

No, you'll likely have a large set of misses when you make the change.
Best to find a time when the workload is as low as possible.

Good luck,

Matt

memcacheduser

unread,
Jun 17, 2011, 9:44:47 PM6/17/11
to memc...@googlegroups.com
We have come up with a Not so elegant solution. 

1. Install php-memcached, Now you have 2 clients side by side. 
2. Write with both the client, php-memcache(cA) and php-memcached(cB), cB will have a certain prefix. Read from cA.
3. After cache is warmed up.  start reading from cB. 
4. upgrade/change hash to cA. 
5. Let the cache warm up.
6. Start reading from cA. 
7. retire cB. 

But this would guarantee that the memcache is always available. 
 
Reply all
Reply to author
Forward
0 new messages