. . .

Hazelcast

Hazelcast is used in ApiOmat to let the YAMBAS nodes communicate with each other in case a new node starting or going down or an application gets deployed. In detail, hazelcast takes care of the following tasks:

  • Notifys other nodes on module deploy

  • Handles execution on special timer tasks (Push Messages, Cron, ...) on one node only

  • Failover after node crash

  • Caching the application object in a multinode environment (ApiOmat >= 2.4.7)

Application object caching

In a single-node environment, Ehcache is used to cache the application object for performance improvement. You can change the default cache selection in the config using the yambas.cacheEngine key (see yaml example file)

Usually, hazelcast searches for other application server nodes using multicast, but this isn't possible under certain circumstances (e.g. firewall, etc.) . In order to let all nodes find each other, the hazelcast.xml configuration file has to be set up properly with all application server IPs added in the <tcp-ip> tag.

Additionally, the cache for the application object can be fine-tuned if necessary (see <map> tag)

hazelcast.xml
<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-basic.xsd"
xmlns="http://www.hazelcast.com/schema/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<group>
<name>dev</name>
<password>dev-pass17</password>
</group>
<network>
<join>
<multicast enabled="false">
<multicast-group>224.2.2.3</multicast-group>
<multicast-port>54327</multicast-port>
</multicast>
<tcp-ip enabled="true">
<interface>IP address of app server 1</interface>
<interface>IP address of app server 2</interface>
...
</tcp-ip>
</join>
</network>
<!-- configure near cache for app map; see http://docs.hazelcast.org/docs/3.5/manual/html/map-nearcache.html
for more information -->
<map name="AOMCache-com.apiomat.backend.model.core.Application">
<near-cache>
<in-memory-format>BINARY</in-memory-format>
<time-to-live-seconds>120</time-to-live-seconds>
<max-idle-seconds>60</max-idle-seconds>
<eviction-policy>LRU</eviction-policy>
<cache-local-entries>true</cache-local-entries>
</near-cache>
</map>
</hazelcast>

Then, the path to this file has to be provided in aom-yambas config file like:

...
JAVA_OPTS="${JAVA_OPTS} -Dhazelcast.config=/path/to/hazelcast.xml"
...

Hazelcast Configuration Tuning

In case you run into problems with the communication between the hazelcast nodes it's best practices to adjust the hazelcast.xml configuration.

Your first entry point is the offical reference manual of your hazelcast component here: https://hazelcast.org/documentation/ . Simply choose your hazelcast version and use either the navigation bar to begin your research or type specifc terms into the search bar.

E.g.: sometimes its helpful to increase the connection timeout between the nodes within the hazelcast network:

Increase Connection Timeout

The search bar of the official hazelcast documentation finally leads you to this artcle: http://docs.hazelcast.org/docs/3.8/manual/html-single/index.html#setting-connection-timeout .

The Connection timeout specifies the timeout value in milliseconds for members to accept connection requests within a hazelcast network. In the following configuration snippet the connection timeout is set to 5000 milliseconds:

hazelcast.xml
...
<network>
...
<connection-timeout>5000</connection-timeout>
...
</network>
...

If your configuration still doesn't fit your system requirements you may increase the connection attempt limit following this article http://docs.hazelcast.org/docs/3.8/manual/html-single/index.html#setting-connection-attempt-limit .

* link only available in Enterprise Documentation