Configuring Ehcache

From AgileApps Support Wiki

Ehcache is a high-performance and distributed-object caching system that minimizes user response time by storing metadata and application information required by programs running on an application server.

The platform uses Ehcache to store metadata and metadata can be retrieved from the cache without accessing database. For example, object and field definitions, layout definitions, data policies, and so on. However, customer’s transaction data is not stored in Ehcache and it is retrieved from the database.

The data is stored in Ehcache using lazy loading mechanism. For more information on lazy loading, see [1]. When the metadata is required, the platform checks the availability in Ehcache. The information is retrieved if information is available in Ehcache. If the information is not available in Ehcache, a database read is performed. If the information is available from database, information is then loaded and stored in Ehcache for further uses, making the search easier and faster. When the metadata is modified due to configuration changes, the modified entry is removed from Ehcache.

Configuring Ehcache

Select Ehcache while installing AgileApps. Ehcache can be configured only after the AgileApps installation is complete. To configure Ehcache, use ehcache.xml file located in {install_dir}/profiles/LJP/configuration/tomcat/conf/RN.

New custom cache can be configured with a unique name. Once the custom cache is configured, the CacheName parameter in {install_dir}/tomcat/conf/RN directory/networking.properties must be set to this custom name of the cache.

For more information on Configuring Ehcache using Terracotta Server Array, see [2].

Notepad.png

Note: It is mandatory to select Ehcache or Memcached during AgileApps installation.

ehcache.xml

ehcache.xml is the file used to configure Ehcache in AgileApps. It can be modified manually. In case of distributed environment:

  1. Modification should be made to the ehcache.xml file for all servers.
  2. Shut down all the servers before applying modifications.
  3. Restart the servers.

Warn.png

Important:

  • Install all instances of AgileApps with same version if AgileApps is running on a distributed environment.
  • Caches do not synchronize if Ehcache configuration is different for different instances.
  • Changing the Ehcache configuration requires a restart of all application servers.
Frequently asked questions
  1. How are the contents of the cache restored if AgileApps servers are intentionally shut down or the caches crash?
    • If the AgileApps servers are shut down, the cached data is stored on a Terracotta Server Array provided the setup and cache is on a distributed environment.
  2. How do I flush Ehcache to refresh the cached data?
    • Restart the application server if AgileApps is running on a stand-alone setup or on a non-distributed setup.
    • Restart the application server and the Terracotta Server Array if AgileApps is running on a distributed setup.
  3. What are the use cases of Terracotta Server Array?
    • If AgileApps platform is on a distributed setup, metadata resides in the caches and the caches are backed by Terracotta Server Array. If the caches do not synchronize, then a particular node of AgileApps platform is working on stale data.
    • Terracotta Server Array provides distributed caching functionality to the Case Collision use case or an advanced use case as Case Collision use case requires cache shared with the application servers.
    • The session management for failovers depends on distributed cache. Terracotta Server Array provides support to the caching mechanism.
  4. Does the cache contain metadata of applications and metadata of application’s business instance data?
    • It is largely the metadata of applications and not any transaction data or application’s business instance data.
  5. Are the cache managers using strong consistency or eventual consistency? Is there a custom eviction policy implemented?
    • Strong consistency is used, as application metadata and the user or team information does not change at a fast rate.
    • There is no custom eviction policy implemented. Least Recently Used is used. For more information on Least Recently Used, see Least Recently Used. These are configurable through the configuration XMLs from terracotta.
  6. Are there any off-heap requirements for EHCache in AgileApps?
    • The Ehcache.xml provided during AgileApps installation does not have off-heap configuration and none are required.