Archive Ensembl HomeArchive Ensembl Home
Home > Help & Documentation

How to enable memcached caching in EnsEMBL

Enabling memcached caching for your EnsEMBL website installation is quite easy.
The only hard bit you have to do is compile and install our version of memcached server, which could be found either here
or in public-plugins/memcached/src

Basic memcached server installation instruction:

cd [/to/your/src/of/memcached-tags.1.2.6/]
./configure --prefix=[/where/you/want/to/put/binaries]
make install

If anything goes wrong with the installation, please refer to memcached wiki page for complete installation instructions.

Once that's done you can start memcached server, e.g.:
[/where/you/have/installed/]bin/memcached -p [PORT] &

and test it:
telnet localhost [PORT]
Connected to localhost.
Escape character is '^]'.
VERSION 1.2.6.tags
Connection closed by foreign host.

Once you have memcached server(s) up and running you need to configure EnsEMBL website.
Include public memcached plugin to your plugins list: in [ensembl root]/conf/
  'EnsEMBL::Memcached' => $SiteDefs::ENSEMBL_SERVERROOT.'/public-plugins/memcached',

and configure memcached plugin (especially SERVER(s) and PORT(s)) in [ensembl root]/public-plugins/memcached/conf/
package EnsEMBL::Memcached::SiteDefs;
use strict;

sub update_conf {
    servers => [ qw(SERVER1:PORT1 SERVER2:PORT2) ],
    flags   => [ qw(
    ) ],

    ## This setting switches cpan Cache::Memcached debug option,
    ## ... which is a bit useless
    debug   => 0,

  ## Use flags to enable what you would like to cache:
  ## PLUGGABLE_PATHS       - paths to pluggable scripts and static files
  ## STATIC_PAGES_CONTENT  - .html pages content, any pages which SendDecPafe handler is responsible for
  ## WEBSITE_DB_DATA       - website db data queries results
  ## USER_DB_DATA          - user and group db data queries results (records, etc.)
  ## DYNAMIC_PAGES_CONTENT - all dynamic ajax responses
  ## TMP_IMAGES            - temporary images (the one you see actual genomic data on) and their image-maps
  ## ORDERED_TREE          - navigation tree
  ## OBJECTS_COUNTS        - different counts for objects like gene, transcript, location, etc...
  ## IMAGE_CONFIG          - Image configurations

  ## Use this to switch on ensembl caching debug messages: