Hazelcast

Hazelcast is default implementation for cache / memory-grid because

  • mature and feature-rich solution
  • not only for caching data but also for computation in clustered environment
  • offers first-class Spring support (Spring cache abstraction layer, Spring Boot support, Spring configuration in common)
  • does support management tools, like Hazelcast management center


Configuration in OpenHub

There is default Hazelcast configuration in the file config/ohf_hazelcast.xml

OpenHub framework uses Spring Boot Hazelcast support for auto-configuration. There is parameter spring.hazelcast.config which can change configuration file.



Hazelcast is configured in XML file by default because it's often necessary to change it for target environment - set how instances in the cluster will communicate, set specific data structures etc. That's why OpenHub framework prefer XML configuration to configuration in the code. Nevertheless projects have possibility to directly set-up com.hazelcast.config.Config (that has higher priority than XML configuration).

or use org.springframework.boot.autoconfigure.cache.CacheManagerCustomizer:

Data structures configuration

Regardless of sth configuration style (XML vs API) it's necessary to configure data structures which are used in OpenHub framework (or in the project).

The OpenHub framework uses the following data structures:

NameData structure typeUsageCommon parameters
throttlingmapthrottling counting

Distributed map for counting throttling.
Configuration has several interesting points - we need computation as fast as possible, accuracy is not crucial:

  • no backups
  • eviction-policy = Least Recently Used)
  • merge policy = entry with the latest update wins
config_paramsmapconfiguration parameters caching

Distributed map for caching configuration parameters.
Main parameters:

  • no backups
  • eviction-policy = Least Recently Used
  • time-to-live-seconds = 600 seconds (10 minutes)
  • max-idle-seconds = 3600 (1 hour)