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 on Drupal 6, you should install the memcache module. For this post we used Ubuntu Server 10.04, but all commands should work on most Ubuntu editions.
First lets install the memcache binaries on Ubuntu. Doing this is as easy as executing the apt and pecl commands in your ubuntu server:
user@ubuntu:/$ sudo apt-get install memcached
user@ubuntu:/$ sudo pecl install Memcache
Also, we need to enable the memcache extension on php:
user@ubuntu:/$ sudo echo "extension=memcache.so" > /etc/php5/apache2/conf.d/memcache.ini
The next steps are pretty much following the installation instructions in the memcache module page.
Add the following line to your php.ini file.
You can add it anywhere in the file.
Put your site in offline-mode. You don't need to do this if your site is still under development.
Next you need to start an instance of memcache, you can start a daemon with the following command:
user@ubuntu:/$ 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';
If you have a cluster running your site, you need to make sure you configure the settings correctly by following the guideline in the memcache module page. All details are in the Servers section of that page.
The final step is to restart Apache and then switch your site back online if it was offline.
You are done! If you have any questions please post them here and I'd be happy to help!