Change Log Caches

Both of the Live Center web services' change logs (editorial and presentation) are cached in order to reduce load on the server and database. Clients poll the change logs frequently in order to ensure that the live blogs are indeed "live" – that they update as soon as any changes are published. With large numbers of clients, this can result in many thousands of requests per second. Without caching, every change log request would also result in a database request, and the system would very quickly be overloaded.

For both web services, caching is performed at two levels:

  • Internal caching, with a default lifetime of 250 milliseconds

  • External caching, with a default lifetime of 2 seconds for non-empty responses.

  • External caching, with a default lifetime of 0 seconds for empty responses.

The external caching depends upon the use of Varnish or some other external cache system: all Live Center does is to add a cache header to change log responses. If the response to a change log request is empty – that is, nothing has changed and there are no new entries to return – then max-age is set to zero in the cache header by default. This means requests will be handled by the back-end server rather than the cache server. If there has been a change, and the response therefore has some content, then max-age is set to 2 seconds by default. This means that for the next 2 seconds (or whatever time you specify), all requests will be handled by the external cache, which will return the cached response.

For empty/no change responses, the internal cache takes over, caching for a shorter period in order to maintain acceptably fast response times. If you want to add external caching for empty responses you can achieve that by overriding the default value.

You can modify the caching parameters for both the internal and external caches, and you can modify them separately for each web service (editorial and presentation). The specific effects of changes in cache settings is dependent on many different variables, but in general, increasing cache lifetimes reduces system load at the cost of increased latency and decreasing cache lifetimes does the opposite: decreases latency at the cost of increased system load.

To modify the editorial change log cache settings:

  1. Copy CacheConfig.properties from the plug-in installation into your Live Center webapp configuration layer (not the common configuration layer):

    $ cp /opt/escenic/engine/plugins/live-center/misc/siteconfig/webapp/com/escenic/livecenter/changelog/cache/CacheConfig.properties
            >/etc/escenic/engine/webapp/live-center-editorial/com/escenic/livecenter/changelog/cache/CacheConfig.properties
  2. Open the copied file for editing and set the properties described in CacheConfig.properties as required:

To modify the presentation change log cache settings:

  1. Copy CacheConfig.properties from the plug-in installation into your Live Center webapp configuration layer (not the common configuration layer):

    $ cp /opt/escenic/engine/plugins/live-center/misc/siteconfig/webapp/com/escenic/livecenter/changelog/cache/CacheConfig.properties
            >/etc/escenic/engine/webapp/live-center-presentation-webservice/com/escenic/livecenter/changelog/cache/CacheConfig.properties
  2. Open the copied file for editing and set the properties described in CacheConfig.properties as required: