How to maintain cache update on different memcached servers?
cremes.devlist at mac.com
cremes.devlist at mac.com
Tue Oct 31 15:54:46 UTC 2006
On Oct 31, 2006, at 9:33 AM, howard chen wrote:
> On 10/31/06, Daniel Beckham <dbeckham-memcached at dealnews.com> wrote:
>> Hi,
>>
>> I don't think you will find much information in this area as it
>> tends to
>> fall outside of the normal usage of memcached. Although, it has been
>> discussed before in this list and some people are working towards a
>> solution for this.
>>
>> These links and others in this thread might be of use to you.
>>
>> http://lists.danga.com/pipermail/memcached/2006-October/002856.html
>> http://lists.danga.com/pipermail/memcached/2006-October/002891.html
>>
>> May I ask, why are you wanting to synchronize a group of memcached
>> servers?
>
> consider this suitation:
>
> Machine A
> MySQL Master A
> Memcached A
>
> Machine B
> MySQL Slave B
> Memcached B
>
>
> Support a user query a object thru complex SQL join statement from
> MySQL slave B, this object is cached using Memcached B, in order to
> offload the MySQL slave B
>
> Now, a row is being updated to MySQL master A, MySQL slave B get the
> update thru MySQL replication, but memcached B is still holding the
> old data
>
> How would you do in this suitation?
Howard,
you misunderstand how memcached works. It doesn't front-end the
database servers like you think it does. It works like this:
Memcache1 Memcache2
\ /
\ /
\ /
\ /
\ /
\ /
MySQL Master
MySQL Slave
There is NO replication between Memcache1 and Memcache2 because they
do not cache the same data. Memcache1 caches 50% of the data and
Memcache2 caches the other 50% of the data. There is no data overlap
so no synchronization is necessary.
If either memcached server fails, the application requesting the data
should "fall through" and hit the database server(s) directly.
Do you understand now?
cr
More information about the memcached
mailing list