BMO/Caching

From MozillaWiki
< BMO
Jump to: navigation, search

BMO Caching

Overview

Bugzilla's current caching mechanisms has many problems -- data and objects are cached by several methods in various locations, there's almost no cross-request caching, and zero intra-process or node caching.

In order to respond to requests as quickly as possible, Bugzilla needs to improve and extend its use of caches.

The Rough Plan

  • implement object serialisation using base key/values
  • use memcache instead of the database for base values
  • cache request and process cache to a static variable in the bugzilla class, and implement as classes
  • fix objects to use the request cache where appropriate
    • ensure that all data stored in the object is applicable to all requests, and isn't user-specific
    • user-specific data should be moved from the object to the request cache
  • make object caching the default
  • fix objects to use the object cache instead of keeping their own reference to the object
  • make new_from_list support reading from memcache
    • change the sort order from a database column to a perl sub
    • build the list from the cache and from the database, then sort in perl
  • change the object cache from per-request to per-process
  • extend objects to make use of memcahe for caching lazily loaded data
    • cache invalidation may be problematic in some instances

Caches

We'll need four cache classes:

Request Cache

Stores data and objects for the lifetime of the current request; it is cleared at the end of the request either implicitly under mod_cgi (by the process terminating) or explicitly under mod_perl.

Process Cache

Under mod_cgi, functions identically to the request cache. Under mod_perl, the contents of this cache are not cleared at the end of each request.

Object Cache

Wrapper around either the request or process caches to simplify caching of objects.

Data Cache

Backed by memcached, data in this cache can live for long durations, and be shared between processes and nodes.