From 3db7e08d433e24141049ea6ccfe1e2c5870a0e55 Mon Sep 17 00:00:00 2001 From: Lenin Mehedy Date: Tue, 1 Oct 2024 22:26:14 +1000 Subject: [PATCH] fix: specify jvm env variables explicitly for local profile (#405) Signed-off-by: Lenin Mehedy Co-authored-by: JeffreyDallas <39912573+JeffreyDallas@users.noreply.github.com> --- resources/profiles/custom-spec.yaml | 10 +++++++++- src/core/profile_manager.mjs | 12 +++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/resources/profiles/custom-spec.yaml b/resources/profiles/custom-spec.yaml index f160a7d30..8ab246ec8 100644 --- a/resources/profiles/custom-spec.yaml +++ b/resources/profiles/custom-spec.yaml @@ -1,5 +1,13 @@ -local: # 3 nodes, ~950 TPS (Docker Desktop 8 cores, 16 GB RAM) +local: # 3 nodes, ~850 TPS (Docker Desktop 8 cores, 16 GB RAM) consensus: # use chart defaults + root: + extraEnv: + - name: JAVA_HEAP_MIN + value: 1g + - name: JAVA_HEAP_MAX + value: 3g + - name: JAVA_OPTS + value: "-XX:+UnlockExperimentalVMOptions -XX:+UseZGC -XX:ZAllocationSpikeTolerance=2 -XX:ConcGCThreads=2 -XX:ZMarkStackSpaceLimit=1g -XX:MaxDirectMemorySize=1g -XX:MetaspaceSize=100M -Xlog:gc*:gc.log --add-opens java.base/jdk.internal.misc=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED -Dio.netty.tryReflectionSetAccessible=true" haproxy: # use chart defaults envoyProxy: # use chart defaults rpcRelay: diff --git a/src/core/profile_manager.mjs b/src/core/profile_manager.mjs index a15a3e663..4f091a57e 100644 --- a/src/core/profile_manager.mjs +++ b/src/core/profile_manager.mjs @@ -150,10 +150,17 @@ export class ProfileManager { const dotItems = dot.dot(items) for (const key in dotItems) { + let itemKey = key + + // if it is an array key like extraEnv[0].JAVA_OPTS, convert it into dot separated key as extraEnv.0.JAVA_OPTS + if (key.indexOf('[') !== -1) { + itemKey = key.replace('[', '.').replace(']', '') + } + if (itemPath) { - this._setValue(`${itemPath}.${key}`, dotItems[key], yamlRoot) + this._setValue(`${itemPath}.${itemKey}`, dotItems[key], yamlRoot) } else { - this._setValue(key, dotItems[key], yamlRoot) + this._setValue(itemKey, dotItems[key], yamlRoot) } } } @@ -173,7 +180,6 @@ export class ProfileManager { for (let nodeIndex = 0; nodeIndex < nodeIds.length; nodeIndex++) { this._setValue(`hedera.nodes.${nodeIndex}.name`, nodeIds[nodeIndex], yamlRoot) this._setValue(`hedera.nodes.${nodeIndex}.accountId`, accountMap.get(nodeIds[nodeIndex]), yamlRoot) - this._setChartItems(`hedera.nodes.${nodeIndex}`, profile.consensus, yamlRoot) } const stagingDir = Templates.renderStagingDir(