NF1.0 Distributed Cache
Feature: Distributed Cache
Sponsor: Trek Global
iDempiere have build in support for distributed cache for a load balance environment. The distributed cache is implemented using the opensource Hazelcast library.
From functional perspective it means for example that changes made on server are seen automatically by swing clients (or other servers) and viceversa. No need to reset cache to refresh the changes done on other instances.
Download the default configuration from https://bitbucket.org/idempiere/idempiere/downloads/hazelcast.xml and copy it to your iDempiere home folder. The first changes you should make to the default configuration is to assigned it a unique group name ( see http://www.hazelcast.com/docs/1.9.4/manual/multi_html/ch11s03.html ). For other configuration options, please refer to the official Hazelcast documentation at http://www.hazelcast.com/docs/1.9.4/manual/multi_html/ch11.html
Since iDempiere 3.x (IDEMPIERE-2245) you don't have to set the hazelcast group anymore because there is a sufficient default value set by the installation process.
Three constructor have been added to CCache:
public CCache (String name, int initialCapacity, int expireMinutes, boolean distributed)
public CCache (String tableName, String name, int initialCapacity, boolean distributed)
public CCache (String tableName, String name, int initialCapacity, int expireMinutes, boolean distributed)
Pass true for the distributed parameter to allocate distributed cache instance.
org.idempiere.hazelcast.service is the bundle that implement the distributed cache service. If you disable or stop this bundle, the system will fallback to local, non-distributed cache.
Technical Info: IDEMPIERE-491
Using separate instances
If you have several server instances on one machine or in one lan they will distribute their caches through the hazelcast. If you do not want that behaviour, e.g. because you use different instances for production and testing you better use different hazelcast groups. To do that you have to create a hazelcast.xml file (you can use the link up on this page for an example) and set a name in the <group> element. (See meeting minutes from 2014-06-25)