Feature Wiki

Information about planned and released features

Tabs

Memory Caching Service

1 Requirements

Some ILIAS tables have mostly static content that rarely be changed, but at each page view must be read.
By using memcache the data can be read directly from the memory and reduce the data base load.

1.1 Summary of the requiments after SIG Performance Meeting

1.1.1 ilGlobalCache Service

A new Service for ILIAS should be implemented, which supports the following requirements:

  • Support multiple Caching-APIs such as xCache, APC and Memcached
  • Fallback to Static PHP-Class-Cache
  • Methods to be implemented: set($key, $value, $ttl = NULL), get($key), exists($key), delete($key) $ttl = Time To Live
  • An expiration time can be set for a value (Time to Live)
  • Namespaces for components (e.g. lng for Language)
  • Flush a Namespace
Additional requirements (may be implemented in a future release)
  • Dependencies
  • Support for Flushing of Multiple Webservers with xCache or APC (Memcached already supports flushing of several Servers).

1.1.2 Administration Settings

In Administration a new Menu 'Global Cache' will be implemented:

  • Activate Caching for individual Components (Language, Ctrl-Flow, ...)
  • Choose Caching-API for each Component
  • Flush Components
  • Flush APIs
  • Configure APIs (if possible). E.g. add several servers for memcached

1.2 Implementation in Classes

The Caching-Service needs to be implemented in each class, which want to use it. First of all, static components can be implemented in the following classes to reduce access to the tables listed:

  • ilLanguage: lng_data and lng_modules (Flush on reload or modification)
  • ilComponent: il_obj_subobj, il_obj_def (Flush on StructureReload)
  • ilCtrl: ctrl_calls, ctrl_classfile, ctrl_structure (Flush on StructureReload)

1.3 Information of Development-Status

An implementation of the GlobalCaching-Service has been developed by studer + raimann ag (Infomation : fs@studer-raimann.ch). With the implementation in ilLanguage, ilSettings (not recommended) and ilComponent there's a significant performance impovement:

ApacheBenchmark-Test with 10'000 connections, 100 concurrent
ApacheBenchmark-Test with 10'000 connections, 100 concurrent
Responsetime of single page, 10 measurements

2 Status

3 Additional Information

Contact the following persons if you want to know more about this feature, its implementation or funding:

  • Information about concept: fs@studer-raimann.ch
  • Information about funding: fs@studer-raimann.ch
  • Information about implementation: fs@studer-raimann.ch

4 Discussion

FS - sr.solutions,  2014-07-02: We have a fully functional service GlobalCache which supports Memcached, xCache and APC. The service can be implemented in several classes (we implemented the GlobalCache Service in ilLanguage, ilComponent and ilPlugin).

FS, MS - sr.solutions, 2014-07-31: It would be possible to implement this already for ILIAS 4.5. Optionally we would like to implement also a template enginge cache.
 
Procedure

  • Implement the global caching service
  • Do changes in the following classes
    • ilCtrl
    • ilLanguage (After checkup by Alex Killing)
    • ilTemplate
    • ilComponent

JF 6 Aug 2014: We highly appreciate this improvement and schedule it as a usability/performance improvement for 4.5. Please add at least a general memcache activation option in the setup under "Tools".

JF 15 Sep 2014: Funding is currently not settled yet, so focus will be on APC. All parts that can be tested during the beta phase may be added before stable.

FS sr.solutions 02. Feb 2015: The following points are open for development in ILIAS 5.1:

  • Caching more component (such as ilTemplate)
  • Supporting more Caching-Services (Memcached for Multi-Server-Environments, xCache)
  • Administration for Caching Services
  • Administration for cached Components (activate only some components such as langauge, ...)

Killing, Alexander [alex], 19 Aug 2015: I am confused about the status of this request/development for 5.1. Support for "templates" is not part of the feature description, it is just mentioned in the comments. Additionally we now have settings for "Events" on edge and there seems to be a cache implementation within the RBAC(?). Has any Jour Fixe discussion for 5.1 taken place for these extensions? On this page there isn't any JF decision for 5.1, how/when has this been scheduled?

JourFixe, ILIAS [jourfixe], August 31, 2015: The Jour Fixe recommends to add a time-out for all cached templates. The value should be edited in the ilias.ini file. An additional text should be added to the setup. The status of the implementation for 5.1 has to be completed in the Implementation section below!

5 Implementation

5.1 Setup

Using APC
In Setup the Global-Cache-Serice can be activated. At the moment only APC is supported.
APC needs at least the following configuration:
 
apc.enabled = 1
apc.shm_size = 128M
apc.shm_segments = 1

Using Memcached
Install Memcached-Server and PHP-Memcached:

$ apt-get update
$ apt get install php5-memcached memcached

Setup at least one Memcached-Server, e.g. on localhost:11211. Add this Server in ILIAS-Setup using "Add Memcached node":

5.2 ilGlobalCache-Service

The ilGlobalCache-Service is implemented in /Services/GlobalCache:

The Caching-Service can be accessed by getting an instance with ilGlobalCache::getInstance($component_name); which requires a registred $component_name. At the moment the following components are registred:

  • clng (cached-Language)
  • obj_def
  • ilctrl
  • comp
  • events
  • tpl (HTML)
  • tpl_blocks (Template-Block-Data)
  • tpl_variables (Template-Variables-Data)

5.3 (De-) Activate Components

In ILIAS-Setup you can (de-)activate Components, change the Caching-Service and manage Memcached nodes (if memcached is set up as Caching-Service):

5.4 Test Cases

Memory Caching Service is a cross section functionality and is therefore covered by all other test cases.

Last edited: 15. Dec 2021, 09:09, Schmid, Fabian [fschmid]