froscon2007 - 0.96

FrOSCon
Free and Open Source Software Conference

Speakers
Robert Douglass
Schedule
Day 2
Room HS6
Start time 11:15
Duration 01:00
Info
ID 120
Event type Lecture
Track Drupal
Language English
Feedback

Caching strategies in Drupal

How Drupal's cache API can lead to blazing fast websites

Drupal has a caching mechanism that prevents redundant data processing. Contributed modules can leverage this mechanism by using the caching API. This lecture introduces the API and shows two modules, the advcache and memcache modules, which offer extended advanced caching to Drupal sites, allowing them to run as much as 50 times faster than normal Drupal sites.

Drupal is able to handle high traffic websites in no small part due to its use of caching. Several elements of any Drupal site are cached, including menus, variables and chunks of rendered HTML. Furthermore, a built-in page caching mechanism can cache entire rendered pages for serving to anonymous users. This caching is vital to any Drupal site and is provided by core Drupal.

An API for using Drupal's cache mechanism is also provided by core Drupal, which allows contributed modules to leverage caching in the same way as the core modules. This API will be explained and an example of its usage will be demonstrated.

The cache API is based on database caching, but it is designed to be pluggable. This means that alternate caching mechanisms can be applied. Such strategies usually include file or memory based caching. One such alternate caching mechanism is memcache which allows cached objects to be stored in memory. The Drupal memcache module will be demonstrated which replaces Drupal's database caching mechanism with memcache.

Most existing caching is geared towards anonymous users. Sites which wish to boost performance for authenticated users should consider using the advcache module which adds caching to several Drupal subsystems that normally have no caching. These include the node, comment, path, search and taxonomy systems. There will demonstration of the advcache module and discussion of its use in conjunction with the memcache module.

The use of memcache and advcache has shown the number of requests per second that a server can handle to increase by as many as fifty times. These are essential technologies for high traffic sites that wish to retain the flexibility with Drupal and still deliver fast page load times.