In Django, to cluster memcached nodes, a very simple method is used. Simply list all node address in the settings.py file of all your django servers like so:
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': [
'xxx.xxx.xxx.240:11211',
'xxx.xxx.xxx.242:11211',
...,
]
}
}
Obviously editing the setting.py file of each instance whenever an instance drops out or a new one is added would be painful, how would you go about automagically managing the addition of new nodes to the cluster?
Possible non-answers:
Note: I use memcached to prevent celeryd workers from accessing the same resources, but its ok if occasionally a resource is double accessed. And my tokens have a short lifespan (less than 15 seconds). So loosing memcached nodes is not a big deal as long as it doesn't happen too frequently.
If your cache data really is very small, maybe you'd be interested in a non-amazon hosted cache service like redistogo.com. They have a free version if your data is small enough and the pricing scales very very reasonably.
This doesn't answer your question at all, but since you mentioned elasticache but balked at the price, maybe it will fit your needs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With