Currently Hazelcast is configured to have 3 synchronous backups
and 3 asynchronous backups. These are separate, meaning there will
be 7 copies in the cluster (1 original + 3 sync + 3 async backups).
Even if only 1 instance of CPS/NCMP is running, it will have 7 copies
in memory.
Given that CPS/NCMP is typically only deployed using 1 or 2 instances,
the settings are changed to 1 synchronous backup (same as Hazelcast's
default configuration). This change has been tested and shown to reduce
heap usage by around 100MB during 20K CM-handle registration.
Issue-ID: CPS-2146
Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech>
Change-Id: I4a5f6d83bc35e2c13cfb32002e38dc365da34c8e
def dataSyncSemaphoresConfig = Hazelcast.getHazelcastInstanceByName('dataSyncSemaphores').config
def dataSyncSemaphoresMapConfig = dataSyncSemaphoresConfig.mapConfigs.get('dataSyncSemaphoresConfig')
expect: 'system created instance with correct config of Module Sync Work Queue'
def dataSyncSemaphoresConfig = Hazelcast.getHazelcastInstanceByName('dataSyncSemaphores').config
def dataSyncSemaphoresMapConfig = dataSyncSemaphoresConfig.mapConfigs.get('dataSyncSemaphoresConfig')
expect: 'system created instance with correct config of Module Sync Work Queue'
- assert moduleSyncDefaultWorkQueueConfig.backupCount == 3
- assert moduleSyncDefaultWorkQueueConfig.asyncBackupCount == 3
+ assert moduleSyncDefaultWorkQueueConfig.backupCount == 1
+ assert moduleSyncDefaultWorkQueueConfig.asyncBackupCount == 0
and: 'Module Sync Started Cm Handle Map has the correct settings'
and: 'Module Sync Started Cm Handle Map has the correct settings'
- assert moduleSyncStartedOnCmHandlesMapConfig.backupCount == 3
- assert moduleSyncStartedOnCmHandlesMapConfig.asyncBackupCount == 3
+ assert moduleSyncStartedOnCmHandlesMapConfig.backupCount == 1
+ assert moduleSyncStartedOnCmHandlesMapConfig.asyncBackupCount == 0
and: 'Data Sync Semaphore Map has the correct settings'
and: 'Data Sync Semaphore Map has the correct settings'
- assert dataSyncSemaphoresMapConfig.backupCount == 3
- assert dataSyncSemaphoresMapConfig.asyncBackupCount == 3
+ assert dataSyncSemaphoresMapConfig.backupCount == 1
+ assert dataSyncSemaphoresMapConfig.asyncBackupCount == 0
and: 'all instances are part of same cluster'
def testClusterName = 'cps-and-ncmp-test-caches'
assert moduleSyncWorkQueueConfig.clusterName == testClusterName
and: 'all instances are part of same cluster'
def testClusterName = 'cps-and-ncmp-test-caches'
assert moduleSyncWorkQueueConfig.clusterName == testClusterName
when: 'retrieving the map config for trustLevel'
def mapConfig = cacheConfig.mapConfigs.get(hazelcastMapConfigName)
then: 'the map config has the correct backup counts'
when: 'retrieving the map config for trustLevel'
def mapConfig = cacheConfig.mapConfigs.get(hazelcastMapConfigName)
then: 'the map config has the correct backup counts'
- assert mapConfig.backupCount == 3
- assert mapConfig.asyncBackupCount == 3
+ assert mapConfig.backupCount == 1
+ assert mapConfig.asyncBackupCount == 0
where: 'the following caches are used'
scenario | hazelcastInstanceName | hazelcastMapConfigName
'cmhandle map' | 'hazelcastInstanceTrustLevelPerCmHandleMap' | 'trustLevelPerCmHandleCacheConfig'
where: 'the following caches are used'
scenario | hazelcastInstanceName | hazelcastMapConfigName
'cmhandle map' | 'hazelcastInstanceTrustLevelPerCmHandleMap' | 'trustLevelPerCmHandleCacheConfig'
/*
* ============LICENSE_START========================================================
/*
* ============LICENSE_START========================================================
- * Copyright (C) 2023 Nordix Foundation
+ * Copyright (C) 2023-2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
protected static MapConfig createMapConfig(final String configName) {
final MapConfig mapConfig = new MapConfig(configName);
protected static MapConfig createMapConfig(final String configName) {
final MapConfig mapConfig = new MapConfig(configName);
- mapConfig.setBackupCount(3);
- mapConfig.setAsyncBackupCount(3);
+ mapConfig.setBackupCount(1);
return mapConfig;
}
protected static QueueConfig createQueueConfig(final String configName) {
final QueueConfig commonQueueConfig = new QueueConfig(configName);
return mapConfig;
}
protected static QueueConfig createQueueConfig(final String configName) {
final QueueConfig commonQueueConfig = new QueueConfig(configName);
- commonQueueConfig.setBackupCount(3);
- commonQueueConfig.setAsyncBackupCount(3);
+ commonQueueConfig.setBackupCount(1);
return commonQueueConfig;
}
protected static SetConfig createSetConfig(final String configName) {
final SetConfig commonSetConfig = new SetConfig(configName);
commonSetConfig.setBackupCount(1);
return commonQueueConfig;
}
protected static SetConfig createSetConfig(final String configName) {
final SetConfig commonSetConfig = new SetConfig(configName);
commonSetConfig.setBackupCount(1);
- commonSetConfig.setAsyncBackupCount(1);
return commonSetConfig;
}
return commonSetConfig;
}
def anchorDataCacheMapConfig = anchorDataCacheConfig.mapConfigs.get('anchorDataCacheMapConfig')
expect: 'system created instance with correct config'
assert anchorDataCacheConfig.clusterName == 'cps-and-ncmp-test-caches'
def anchorDataCacheMapConfig = anchorDataCacheConfig.mapConfigs.get('anchorDataCacheMapConfig')
expect: 'system created instance with correct config'
assert anchorDataCacheConfig.clusterName == 'cps-and-ncmp-test-caches'
- assert anchorDataCacheMapConfig.backupCount == 3
- assert anchorDataCacheMapConfig.asyncBackupCount == 3
+ assert anchorDataCacheMapConfig.backupCount == 1
+ assert anchorDataCacheMapConfig.asyncBackupCount == 0
}
def 'Verify deployment network configs for Distributed Caches'() {
}
def 'Verify deployment network configs for Distributed Caches'() {