Replicate memc_* calls?

35 views
Skip to first unread message

Ludek Dolejsky

unread,
May 4, 2012, 4:09:17 AM5/4/12
to codersh...@googlegroups.com
Hi all,

I'm using the multi master replication (fantastic piece of software btw., thanks!!!) and have installed memcached_functions_mysql functions that allow to talk to a memcached daemon directly from within MySQL using UDFs, i.e.:

SELECT memc_set('myid', 'myvalue');  --- to set value for given key

SELECT memc_get('myid'); --- to get value for given key

SELECT memc_delete('myid'); --- to delete key/value pair


It would be fantastic if one could replicate these calls (or triggers utilizing these functions) across the cluster to be able to invalidate local caches. It is my understanding that with ROW based bin log, only INSERTs and UPDATEs are replicated, not the actual trigger calls.


Imagine that every cluster node has its own memcached instance (nodes are across continents) and this could be used to invalidate cached data across continents too.


Any ideas? Thanks.

Seppo Jaakola

unread,
May 7, 2012, 3:54:56 AM5/7/12
to codership
What is the point of having node local memcaches? Would it not be more
effective to have shared cache for whole cluster?

Technically it would be quite straightforward to replicate these UDF
calls. UDF replication could go through same pipeline as we use for
MyISAM replication now. Only challenge is in identifying which calls
to replicate, and to make the replication generic enough. Maybe there
should be a list of to-be-replicated UDFs, like:

wsrep_replicate_UDFs='memc_set,memc_delete'

...and these could be caught in parser.

-seppo

Henrik Ingo

unread,
May 7, 2012, 7:15:13 AM5/7/12
to Seppo Jaakola, codership
Wouldn't they get replicated already if instead of SELECT you use
UPDATE and a MyISAM table:


UPDATE myisamtable SET foo=memc_set(...)

henrik
> --
> You received this message because you are subscribed to the Google Groups "codership" group.
> To post to this group, send email to codersh...@googlegroups.com.
> To unsubscribe from this group, send email to codership-tea...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/codership-team?hl=en.
>



--
henri...@avoinelama.fi
+358-40-8211286 skype: henrik.ingo irc: hingo
www.openlife.cc

My LinkedIn profile: http://www.linkedin.com/profile/view?id=9522559

seppo....@codership.com

unread,
May 7, 2012, 7:21:52 AM5/7/12
to codersh...@googlegroups.com
Yes, they indeed would. However, with the expense of table level
locking on the myisamtable.

-seppo
Message has been deleted

Henrik Ingo

unread,
May 7, 2012, 8:18:07 AM5/7/12
to seppo....@codership.com, codersh...@googlegroups.com
Well, but the table is just bogus anyway. You could just create
table1, table2, ... table100 and update one of them at random.

henrik

On Mon, May 7, 2012 at 2:22 PM, <seppo....@codership.com> wrote:
> http://www.codership.com  seppo....@codership.com
> tel: +358 40 510 5938 skype: seppo_jaakola

Ludek Dolejsky

unread,
May 7, 2012, 9:49:38 AM5/7/12
to codersh...@googlegroups.com, seppo....@codership.com, henri...@avoinelama.fi
Hi,

thanks for input.

Having local memcached(s) makes lot of sense as nodes are located on different continents with quite some latency (typically >200 ms) between them.

Using MyISAM tables is an interesting idea, but I'm using Percona Cluster (should have mentioned that) which only replicates changes in InnoDB tables... I might try installing pure galera and check that out.

Thanks
L.
>>> To post to this group, send email to codership-team@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> For more options, visit this group at
>>> http://groups.google.com/group/codership-team?hl=en.
>>>
>>
>>
>>
>> --
>> henri...@avoinelama.fi
>> +358-40-8211286 skype: henrik.ingo irc: hingo
>> www.openlife.cc
>>
>> My LinkedIn profile: http://www.linkedin.com/profile/view?id=9522559
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "codership" group.
>> To post to this group, send email to codership-team@googlegroups.com.
>> To unsubscribe from this group, send email to
>> For more options, visit this group at
>> http://groups.google.com/group/codership-team?hl=en.
>
>
>
> --
> http://www.codership.com  seppo....@codership.com
> tel: +358 40 510 5938 skype: seppo_jaakola
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "codership" group.
> To post to this group, send email to codership-team@googlegroups.com.
> To unsubscribe from this group, send email to
Reply all
Reply to author
Forward
0 new messages