php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #57780 Option to update all caches in pool
Submitted: 2007-08-10 09:03 UTC Modified: 2007-08-14 03:46 UTC
From: fredrik dot rambris at it dot cdon dot com Assigned:
Status: Not a bug Package: memcache (PECL)
PHP Version: 4.3.9 OS: Linux
Private report: No CVE-ID: None
 [2007-08-10 09:03 UTC] fredrik dot rambris at it dot cdon dot com
Description:
------------
We are in the process of moving local disk based cache (store blocks of generated HTML on each webservers disk) to a cluster of memcached instances. However when content is updated or deleted we would like to have it done on all servers in the pool. Then the pages would have to be generated only once. The reading, ofcause, should be reads distributed across servers in the pool.

What do you think of this and how would it be best implemented  ? I have no problem implementing it myself, I just want to do it in a way that could benefit more than ourselves.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-08-14 03:35 UTC] mikael at synd dot info
Hi,

When using a memcached pool each value (in your case an html chunk) is mapped, using a hash of its key, to a single server in the pool. No values are ever written to multiple servers (see http://pecl.php.net/bugs/bug.php?id=11637 though) and load balancing is achieved by having different keys (ie. html chunks) residing on different servers.

When content is updated or deleted you will therefore only have to update it once on the specific server that handles that html chunk. But since pecl/memcache handles the mapping all you need to do is add all servers to the pool and call $memcache->set('some_html_chunk', 'new value') from one of the webservers.

Does this answer your question or am I missing something?

//Mikael
 [2007-08-14 03:46 UTC] fredrik dot rambris at it dot cdon dot com
I get it. When I tried to analyze which servers got used in the pool there was a spooky kind of intelligence and I suspected that the hash was the force behind it although I didn't analyze it more.

So, yes. That answers my question. Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 08:02:42 2024 UTC