Memcached is a Unix daemon written in C that exposes a specified amount of memory space as a hash table on the network using a dedicated text or binary protocol. The protocol allows a limited set of operations such as set, get, and delete, and also some more complex atomic operations such as cas (compare and set), incr, decr, and append.
The process itself is absolutely unaware of any distribution and partitioning logic, thus making it extremely simple, fast, and robust. All the complexity is actually pushed to the client that is responsible for routing requests to the correct Memcached instance. A very common use of Memcached is to partition data on each instance, without replication.
This strategy is valid when the amount of instance N is big as a loss of one instance will involve loss of 1 / N of data, which is acceptable in most cases for caching. In situations where such data loss isn’t acceptable, replication is possible as the client can simply send its requests to 2 Memcached instances in parallel.
At the time of writing, it is widely used in production in large organizations. Clients are available for all major languages, including C/C++, Java, Python, Ruby, and C#.
To install memcached on a Virtual Private Server(VPS) or a dedicated server follow the below mentioned steps-
mkdir -p /root/source
rpm -ivh rpmforge-release-0.3.6-1.el5.rf.i386.rpm
yum -y install libevent* ( required for memcached binary )
yum -y install memcached* ( memcached binary required for libmemcached )
gem source -a http://gems.github.com
* combination of libmemcached-0.25.14 and memcached-0.13 gem is found to be a working stable combination, so we will be sticking to this combination for now.
tar -xzvf libmemcached-0.25.14.tar.gz
./configure && make && make install
gem install memcached-0.13.gem
gem install memcache-client –version=1.6.3
RailsCarma has been working on Ruby on Rails framework from its nascent stage and has handled over 250 RoR projects. With a team of over 100+ RoR developers well-versed with latest techniques and tools, RailsCarma is well suited to help you with all your development needs. If you have any doubt or any query, feel free to contact us through our Contact Us page
Read other related articles :