21 Jun 2010 @ 8:19 AM 

Memcache is a very simple caching system that uses memory to store objects. As you may already know, memory is faster to read than hard drive. A site will take a lot less time to read a database result cached in memory. To make the best use of memcache, you should install the memcached module. For this post we used Ubuntu Server 10.04, but all commands should work on most Ubuntu editions.

I have chosen to use memcached, rather than memcache. Have a look here to view a comparison

First, install the memcached package, php-pear (required for pecl), php5-dev (required for phpize) and libmemcached-dev

sudo apt-get install memcached
sudo apt-get install php-pear
sudo apt-get install php5-dev
sudo apt-get install libmemcached-dev

next, install memcached using pecl

sudo pecl install Memcache

Also, we need to enable the memcache extension on php:

sudo echo "extension=memcache.so" > /etc/php5/apache2/conf.d/memcache.ini

Add the following line to your php.ini file.

memcache.hash_strategy="consistent"

You can add it anywhere in the file.

Next you need to start an instance of memcache, you can start a daemon with the following command:

memcached -d -m 2048 -l 10.0.0.40 -p 11211

If you are only using a single server, then you only need to include this line to your site’s settings.php file.

$conf['cache_inc'] = '/sites/all/modules/memcache/memcache.inc';

The final step is to restart apache and then switch your site back online if it was offline.

Posted By: Zayin
Last Edit: 21 Jun 2010 @ 08:34 AM

EmailPermalink
Tags
Tags: ,
Categories: linux, php


 

Responses to this post » (3 Total)

 
  1. zayinkrige says:

    New Blog Post -> Installing memcached on ubuntu 10.04 – http://www.zayinkrige.com/installing-mem

  2. ehcache.net says:

    Installing memcached on ubuntu 10.04…

    Memcache is a very simple caching system that uses memory to store objects. As you may already know, memory is faster to read than hard drive. A site will take a lot less time to read a database result cached in memory. To make the best use of memcache…

  3. [...] http://www.zayinkrige.com/installing-memcached-on-ubuntu-10-04/ Share this:TwitterFacebookLike this:LikeBe the first to like this. Leave a Comment [...]

Post a Comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.


 Last 50 Posts
 Back
Change Theme...
  • Users » 1
  • Posts/Pages » 40
  • Comments » 64
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight

Links



    No Child Pages.

Portfolio



    No Child Pages.