Tuesday, October 8, 2013

Install Memcache in Ubuntu


Install Memcache in Ubuntu

About Memcache

Memcache is a system that works to speed up virtual private servers by caching server information. The program allows you to allocate a specific amount of the server ram toward caching recently queried data for a certain amount of time. Once the data is requested again, memcache speeds up the process of retrieving it by displaying the cached information instead of generating the result from the database.

To setup you require the user to have root privileges.

Step 1 : It is good to update apt-get to make sure that all of the packages we download are up to date.

sudo apt-get update

Step 2 : Installing memcache service

sudo apt-get install memcached

Now you are ready to start using Memcache.


Step 3 : Confirm Memcache and see stats

After mem-cache is downloaded, you can check that it has been installed by searching for it:

root@sanjeeva:/home/sanjeeva# ps -e|grep memcache
20484 ?        00:00:00 memcached

root@sanjeeva:/home/sanjeeva# ps aux | grep memcache
memcache 20347  0.0  0.0  47376  1072 ?        Sl   23:17   0:00 /usr/bin/memcached -m 64 -p 11211 -u memcache -l 127.0.0.1
root     20453  0.0  0.0   4384   840 pts/0    S+   23:22   0:00 grep --color=auto memcache


================================================================================
To Increase memory for memcache(d), open the /etc/memcached.conf and increase the -m parameter.

The default is 64M
# Start with a cap of 64 megs of memory. It's reasonable, and the daemon default
# Note that the daemon will grow to this size, but does not start out holding this much
# memory
-m 64
================================================================================

Step 4 : Stop / Start / Restart Memcache
#sudo service memcached stop
#sudo service memcached start
#sudo service memcached restart