Hazelcast Storage Best Practices
This topic describes the Hazelcast server-side configurations that work best with the . You must make these changes manually, as the Gateway is unable to do so since it is behaving only as a client.
This topic describes the Hazelcast server-side configurations that work best with the
Layer7 API Gateway. You must make these changes manually, as the Gateway is unable to do so since it is behaving only as a client.
Instructions on configuring the Gateway to use Hazelcast is described in Connect to an External Hazelcast Datastore. That topic also describes which Hazelcast client configurations are supported by the Gateway (not all configurations are supported).
Configuration for Hazelcast Map Data Structure
The Gateway uses the key value store implemented by the External Hazelcast Storage. Use these configuration options for the Hazelcast map data structure.
Enable Backup Reads
When the Gateway connects to an External Hazelcast Cluster, each request should have a multiple copies over the Hazelcast cluster nodes to avoid data loss. You can configure this one of two ways:
- backup-count:1, which means it backs up to one other node. Setting this to2backs up a map entry to two other Hazelcast nodes. The maximum backup count is6. The backup occurs synchronously, so the backup has priority and will block other operations.You can disable backups by settingbackup-countto0(zero). This is not recommended, but it may be necessary if performance is more important than backups. You must disablebackup-countif you choose to enableasync-backup-count.
- async-backup-count: This is the same thing asbackup-count,except that backups occur asynchronously and do not block other operations. The default value is0, which means asynchronous backups are disabled by default. Set this to another value depending on the number of nodes that you wish to back up to. Be sure to setbackup-count=0if you enableasync-backup-count.
The "default" map settings use these settings:
These defaults are used whether or not a
<map name="default">section is explicitly stated in
To set your own mapping, add a
<map name="newMapName">section to
hazelcast-client.xmlas shown below:
<?xml version="1.0" encoding="UTF-8"?> <hazelcast xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.hazelcast.com/schema/config http://www.hazelcast.com/schema/config/hazelcast-config-3.10.xsd" xmlns="http://www.hazelcast.com/schema/config"> <map name="myMapName"> <backup-count>0</backup-count> <async-backup-count>2</async-backup-count> </map> </hazelcast>
In the example above synchronous backup is disabled, while asynchronous backup is set to back up to two Hazelcast nodes.
The Gateway controls the life cycle of all key value pair and data entries. Do not configure expiration of data entries in Hazelcast. Do not configure these settings in