0

I have created a memcached cluster in the Elasticache tool of AWS.

My program in every call sets keys with some data in cache and every time that I call the server it updates the data. However while testing it with the cluster I found that it seems that is changing the node where the key is located or it is erasing it, so the moment it changes the node /or erase the key, I lose my previous information.As Im only calling to one end point for all the cluster, shouldnt it keep the consistancy of the key over the cluster and not delete the content of the key or restart the key somewhere else ?

Is there any configuration parameter of memcached cluster to force it not to change the reference node for a key?

Now Im using the default configuration parameters of the AWS file default.memcached1.4..and I took a look to the configuration parameters at http://docs.aws.amazon.com/AmazonElastiCache/latest/UserGuide/ParameterGroups.Memcached.html and I dont find any information giving me tips related to how to solve this issue. (Pd. When I directly point my program to a specific node everything works fine)

chuseuiti
  • 783
  • 1
  • 9
  • 32

1 Answers1

2

That is the way it's supposed to be.

The following diagram illustrates a typical Memcached and a typical Redis cluster. Memcached clusters contain from 1 to 20 nodes across which you can horizontally partition your data. Redis

From http://docs.aws.amazon.com/AmazonElastiCache/latest/UserGuide/Clusters.html

The django documentation says something similar.

One excellent feature of Memcached is its ability to share a cache over multiple servers. This means you can run Memcached daemons on multiple machines, and the program will treat the group of machines as a single cache, without the need to duplicate cache values on each machine

In other words, you cannot directly request data from any given node in the cluster. You have to let django's cache api figure out for you how to retrieve the data.

With redis the behaviour is the opposite. Once you write to the cluster you can query any node in the cluster for the data because it will be replicated to them all. Where as in memcache, it's sharded.

e4c5
  • 52,766
  • 11
  • 101
  • 134
  • But I was expecting memcached to keep the consistancy of the same key..even if it is sharding the information of the same key over different nodes..shouldnt it gives me back one unique key and not keep different references of the same key in different nodes? Regarding Redis: Then a redis cluster is only replicating the data and not scaling the size of the cache for writing proposes? – chuseuiti May 12 '16 at 00:15
  • That is correct. If you have 10 1GB redis caches clustered together, your total storage capacity is 1GB. IF you have 10 memcached caches clustered together your storage is 10GB - with different caches holding differnt keys. You are not supposed to go directly to any one cache but supposed to let the top level api decide for you which cache to goto. – e4c5 May 12 '16 at 00:22