Software Design:Caching

MediaWiki has it's own elaborate cache system. In addition, the Registry cgi software and the Users and Groups system are being designed to provide cached access.

There are two possible approaches:

CCache
A cache based on files and the Apache rewrite system
DBCache
A cache system holding the cache data in a database

Cgi Cache

The CCache system has many goals:

  • To improve the speed of access to certain Registry data. A specific example is part tables.
  • To reduce the load on our computer resources.
  • To allow JSON and Ajax - style access to more of the data. This will allow cross-site access of data between the iGEM wikis and the Registry part collections.
  • To allow much more use of the <tag>part or data reference</tag> extension system of mediawiki and to establish

an equivalent for the cgi code.

In the simple case, the CCache works like this:

  1. A web page includes a tagged reference to a Registry table.
  2. The extension system converts this (locally) to
    • A reference to javascript code
    • A reference to a CCache file entry
    • An empty structure (e.g. a DIV) that will hold the rendered table
  3. The Apache web server rewrite rules recognize the file entry, and converts it to a file name. If that file exists, the contents are returned by the Apache server. If the file does not exist, an appropriate cgi script is called from the appropriate directory.
  4. The cgi script both creates the appropriate file and returns the contents via the Apache server.
  5. The next reference finds the new file and returns the response immediately.

Cache Consistency

As with all caching systems, specific actions must be taken to invalidate cache entries when the contents of the cache change. Also, it may be necessary to deal with collisions when two users try to access cached data during any of the possible cache states.

We assume that the extra cost of creating the cache file is low and the cost of invalidating (deleting) a cache file is also low. The Unix memory caching of files will keep the access cost low, but the need to write changes and new files back to the disk may lead us to eventually implement and in-memory system. Apache has some modules that may help with this.

Layout

DataBase Cache