aboutsummaryrefslogtreecommitdiffstats
path: root/cps-service/src
diff options
context:
space:
mode:
authordanielhanrahan <daniel.hanrahan@est.tech>2024-03-15 12:42:15 +0000
committerdanielhanrahan <daniel.hanrahan@est.tech>2024-03-19 10:08:19 +0000
commite1277ab49cfbd8fd980336b1f2b84bca3166a449 (patch)
treea448d6c891c9def39837d11c7ddaad1998e99ae6 /cps-service/src
parentbf75ff4d43dc9eb459deaf61920de22cf5c6f1ea (diff)
Configure Hazelcast to have 1 backup to reduce memory
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
Diffstat (limited to 'cps-service/src')
-rw-r--r--cps-service/src/main/java/org/onap/cps/cache/HazelcastCacheConfig.java9
-rw-r--r--cps-service/src/test/groovy/org/onap/cps/cache/AnchorDataCacheConfigSpec.groovy4
2 files changed, 5 insertions, 8 deletions
diff --git a/cps-service/src/main/java/org/onap/cps/cache/HazelcastCacheConfig.java b/cps-service/src/main/java/org/onap/cps/cache/HazelcastCacheConfig.java
index 660176d5e4..418de9b17a 100644
--- a/cps-service/src/main/java/org/onap/cps/cache/HazelcastCacheConfig.java
+++ b/cps-service/src/main/java/org/onap/cps/cache/HazelcastCacheConfig.java
@@ -1,6 +1,6 @@
/*
* ============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.
@@ -72,22 +72,19 @@ public class HazelcastCacheConfig {
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);
- 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);
- commonSetConfig.setAsyncBackupCount(1);
return commonSetConfig;
}
diff --git a/cps-service/src/test/groovy/org/onap/cps/cache/AnchorDataCacheConfigSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/cache/AnchorDataCacheConfigSpec.groovy
index e219945d83..010308c42f 100644
--- a/cps-service/src/test/groovy/org/onap/cps/cache/AnchorDataCacheConfigSpec.groovy
+++ b/cps-service/src/test/groovy/org/onap/cps/cache/AnchorDataCacheConfigSpec.groovy
@@ -50,8 +50,8 @@ class AnchorDataCacheConfigSpec extends Specification {
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'() {