From c52609b6629708605fc42799c9730a12dd050a7e Mon Sep 17 00:00:00 2001 From: Muhammad Qadora Date: Tue, 11 Feb 2025 09:45:39 +0200 Subject: [PATCH 1/2] added set memory limit by user and added missing instance sizes --- falkordb-cluster/cluster-entrypoint.sh | 4 ++++ falkordb-node/node-entrypoint.sh | 14 ++++++++++++-- omnistrate.startup.yaml | 1 + 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/falkordb-cluster/cluster-entrypoint.sh b/falkordb-cluster/cluster-entrypoint.sh index 0e121c4..0f9cab0 100755 --- a/falkordb-cluster/cluster-entrypoint.sh +++ b/falkordb-cluster/cluster-entrypoint.sh @@ -295,6 +295,8 @@ get_default_memory_limit() { set_memory_limit() { declare -A memory_limit_instance_type_map memory_limit_instance_type_map=( + ["e2-standard-2"]="6GB" + ["e2-standard-4"]="14GB" ["e2-custom-small-1024"]="100MB" ["e2-medium"]="2GB" ["e2-custom-4-8192"]="6GB" @@ -302,6 +304,8 @@ set_memory_limit() { ["e2-custom-16-32768"]="30GB" ["e2-custom-32-65536"]="62GB" ["t2.medium"]="2GB" + ["m6i.large"]="6GB" + ["m6i.xlarge"]="14GB" ["c6i.xlarge"]="6GB" ["c6i.2xlarge"]="13GB" ["c6i.4xlarge"]="30GB" diff --git a/falkordb-node/node-entrypoint.sh b/falkordb-node/node-entrypoint.sh index 0a62db1..8c60a13 100755 --- a/falkordb-node/node-entrypoint.sh +++ b/falkordb-node/node-entrypoint.sh @@ -28,6 +28,7 @@ RUN_HEALTH_CHECK_SENTINEL=${RUN_HEALTH_CHECK_SENTINEL:-1} TLS=${TLS:-false} NODE_INDEX=${NODE_INDEX:-0} INSTANCE_TYPE=${INSTANCE_TYPE:-''} +USER_SET_MEMORY=${USER_SET_MEMORY:-''} PERSISTENCE_RDB_CONFIG_INPUT=${PERSISTENCE_RDB_CONFIG_INPUT:-'low'} PERSISTENCE_RDB_CONFIG=${PERSISTENCE_RDB_CONFIG:-'86400 1 21600 100 3600 10000'} PERSISTENCE_AOF_CONFIG=${PERSISTENCE_AOF_CONFIG:-'everysec'} @@ -214,6 +215,8 @@ get_memory_limit() { declare -A memory_limit_instance_type_map memory_limit_instance_type_map=( + ["e2-standard-2"]="6GB" + ["e2-standard-4"]="14GB" ["e2-custom-small-1024"]="100MB" ["e2-medium"]="2GB" ["e2-custom-4-8192"]="6GB" @@ -221,6 +224,8 @@ get_memory_limit() { ["e2-custom-16-32768"]="30GB" ["e2-custom-32-65536"]="62GB" ["t2.medium"]="2GB" + ["m6i.large"]="6GB" + ["m6i.xlarge"]="14GB" ["c6i.xlarge"]="6GB" ["c6i.2xlarge"]="13GB" ["c6i.4xlarge"]="30GB" @@ -228,8 +233,13 @@ get_memory_limit() { ) if [[ -z $INSTANCE_TYPE ]]; then - echo "INSTANCE_TYPE is not set" - MEMORY_LIMIT=$(get_default_memory_limit) + if [[ -n $USER_SET_MEMORY ]];then + echo "Memory is set by user" + MEMORY_LIMIT=$USER_SET_MEMORY + else + echo "INSTANCE_TYPE is not set" + MEMORY_LIMIT=$(get_default_memory_limit) + fi fi instance_size_in_map=${memory_limit_instance_type_map[$INSTANCE_TYPE]} diff --git a/omnistrate.startup.yaml b/omnistrate.startup.yaml index 7111a50..421d1ab 100644 --- a/omnistrate.startup.yaml +++ b/omnistrate.startup.yaml @@ -471,6 +471,7 @@ services: - TLS=$var.enableTLS - FALKORDB_USER=$var.falkordbUser - DATA_DIR=/data + - USER_SET_MEMORY=$var.memoryRequestsAndLimits - ROOT_CA_PATH=/etc/ssl/certs/GlobalSign_Root_CA.pem - PERSISTENCE_RDB_CONFIG_INPUT=$var.RDBPersistenceConfig - PERSISTENCE_AOF_CONFIG=$var.AOFPersistenceConfig From 084ba195daf98d671eb67b642c76a52c3c335649 Mon Sep 17 00:00:00 2001 From: Muhammad Qadora Date: Tue, 11 Feb 2025 10:04:59 +0200 Subject: [PATCH 2/2] fixed as per dudi's request --- falkordb-node/node-entrypoint.sh | 14 ++++---------- omnistrate.startup.yaml | 2 +- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/falkordb-node/node-entrypoint.sh b/falkordb-node/node-entrypoint.sh index 8c60a13..32640d5 100755 --- a/falkordb-node/node-entrypoint.sh +++ b/falkordb-node/node-entrypoint.sh @@ -28,7 +28,6 @@ RUN_HEALTH_CHECK_SENTINEL=${RUN_HEALTH_CHECK_SENTINEL:-1} TLS=${TLS:-false} NODE_INDEX=${NODE_INDEX:-0} INSTANCE_TYPE=${INSTANCE_TYPE:-''} -USER_SET_MEMORY=${USER_SET_MEMORY:-''} PERSISTENCE_RDB_CONFIG_INPUT=${PERSISTENCE_RDB_CONFIG_INPUT:-'low'} PERSISTENCE_RDB_CONFIG=${PERSISTENCE_RDB_CONFIG:-'86400 1 21600 100 3600 10000'} PERSISTENCE_AOF_CONFIG=${PERSISTENCE_AOF_CONFIG:-'everysec'} @@ -231,15 +230,10 @@ get_memory_limit() { ["c6i.4xlarge"]="30GB" ["c6i.8xlarge"]="62GB" ) - - if [[ -z $INSTANCE_TYPE ]]; then - if [[ -n $USER_SET_MEMORY ]];then - echo "Memory is set by user" - MEMORY_LIMIT=$USER_SET_MEMORY - else - echo "INSTANCE_TYPE is not set" - MEMORY_LIMIT=$(get_default_memory_limit) - fi + + if [[ -z $INSTANCE_TYPE && -z $MEMORY_LIMIT ]]; then + echo "INSTANCE_TYPE is not set" + MEMORY_LIMIT=$(get_default_memory_limit) fi instance_size_in_map=${memory_limit_instance_type_map[$INSTANCE_TYPE]} diff --git a/omnistrate.startup.yaml b/omnistrate.startup.yaml index 421d1ab..1b7de70 100644 --- a/omnistrate.startup.yaml +++ b/omnistrate.startup.yaml @@ -471,7 +471,7 @@ services: - TLS=$var.enableTLS - FALKORDB_USER=$var.falkordbUser - DATA_DIR=/data - - USER_SET_MEMORY=$var.memoryRequestsAndLimits + - MEMORY_LIMIT=$var.memoryRequestsAndLimits - ROOT_CA_PATH=/etc/ssl/certs/GlobalSign_Root_CA.pem - PERSISTENCE_RDB_CONFIG_INPUT=$var.RDBPersistenceConfig - PERSISTENCE_AOF_CONFIG=$var.AOFPersistenceConfig