Ehcache Configuration for DXP 7.x

This article documents how to implement distributed caching on Liferay DXP 7.x and how to deploy custom tuning configurations. For cache tuning and finding optimal settings for a particular environment, please see the Ehcache website for documentation and support.

Resolution

How to Configure Distributed Caching

Liferay's Cluster Link replication is available in DXP 7.x.

Set the following in portal-ext.properties: cluster.link.enabled=true

How to Deploy the Cache Tuning Configurations to DXP 7.x

There are specific files that you would need to deploy in order for your hibernate, multivm, or singlevm caches tuning configurations to be read by the system.

In DXP 7.0, caches should be tuned via deployable plugins if you use cluster link replication (the benefit is you don't need to restart the server for the settings to take effect). Create a plugin and specify a file and path through the following properties in portlet.properties:

  • ehcache.multi.vm.config.location=
  • ehcache.single.vm.config.location=

One suggested location to place the configuration XML files is the liferay home directory. The XML files have sample configuration settings which can be modified appropriately for your requirements (for example: Number of elements in cache, Expiry time for cache, Whether cache overflows to disk, etc). Be sure to specify the path to the custom xml file in the above settings (the custom xml should be located within the plugin's directory structure). The system will load the files and configure the designated caches on deployment of the plugin. More information about this cache tuning in User Guide's Modifying the Ehcache Settings With a Plugin paragraph.

If users do not wish to deploy a plugin, users can configure DXP 7.x directly by setting their portal-ext.properties. Avoid making any direct changes to the portal.properties file.

In DXP 7.x, specify a file and path through the following in portal-ext.properties:

  • ehcache.multi.vm.config.location=
  • ehcache.single.vm.config.location=

One suggested location to place the configuration XML files is the liferay home directory. The XML files have sample configuration settings which can be modified appropriately for your specific requirements (for example: Number of elements in cache, Expiry time for cache, Whether cache overflows to disk, etc).

Be sure to specify the path to the custom .xml file in the above settings (the custom .xml files should be located in a location accessible by the system). The system will load the files and configure the designated caches on startup. More information about this cache tuning in User Guide's Modifying the Ehcache settings directly paragraph.

Additional Information

This article is an extension of what is found in the Liferay User Guide:

Tuning the cache is essential in leveraging the most out of Ehcache's benefits. Please refer to Ehcache's documentation for all the benefits and details about HOW TO tune the cache: Ehcache 3.4 Documentation Overview.

Also, there is more information on setting up and tuning your environment in our whitepaper for Liferay Digital Experience Platform Performance.

这篇文章有帮助吗?
1 人中有 1 人觉得有帮助