php
AWS Elasticache Auto
Discovery
You may be using Amazon Web Services' ElastiCache as your memcached solution. It provides metrics via CloudWatch and provides opportunities for auto scaling nodes in your cluster.
But let's say you do scale your cluster, either manually or automatically, how will you contend with registering each of the servers in your memcache object?
ElastiCache Auto Discovery Example
Amazon's ElastiCache Auto Discovery client extends the memcache object to register all of the nodes in your cluster. Here is an example of how simple it can be:
$server_endpoint = 'myhost.bacdea.cfg.use1.cache.amazonaws.com';
$server_port = 11211;
$ec = new Memcached();
$ec->setOption(Memcached::OPT_CLIENT_MODE, Memcached::DYNAMIC_CLIENT_MODE);
$ec->addServer($server_endpoint, $server_port);
$out = $ec->set('joe', 'momma', 60);
echo 'joe is your: '.$ec->get('mykey');
Be sure to read how to setup auto discovery as well as read others' comments on the costs and benefits of ElastiCache vs rolling your own memcached solution.
Last Updated: 2013-08-08 19:48:13