Skip to content

Commit

Permalink
Force P-S-S topology
Browse files Browse the repository at this point in the history
We do not want to have N shard server for N nodes, because
it would divide the total available resources per shard,
reducing the available memory: we should reduce the need to
rely on the disks as much as possible to improve the performances,
as per official recommendations.

Issue: ZENKO-4641
  • Loading branch information
williamlardier committed Jan 3, 2025
1 parent 058ddd5 commit a9bd6f9
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions solution-base/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function render_mongodb_sharded_yamls()
local OUTPUT_PATH=${1:-${OPERATOR_PATH}}
local SHARD_COUNT=${2:-1}
local NODE_COUNT=${3:-1}
local ADD_OPTIONS=${4:-""}
local REPLICA_COUNT=${3:-${NODE_COUNT}}

echo creating mongodb-sharded ${NODE_COUNT}-node yamls
CHART_PATH="$SOLUTION_BASE_DIR/mongodb/charts/mongodb-sharded"
Expand All @@ -97,10 +97,10 @@ function render_mongodb_sharded_yamls()
--set shards=${SHARD_COUNT} \
--set mongos.replicaCount=${NODE_COUNT} \
--set mongos.useStatefulSet=true \
--set shardsvr.dataNode.replicaCount=${NODE_COUNT} \
--set shardsvr.dataNode.replicaCount=${REPLICA_COUNT} \
--set shardsvr.persistence.enabled=true \
--set shardsvr.persistence.storageClass=${MONGODB_STORAGE_CLASS} \
--set configsvr.replicaCount=${NODE_COUNT} \
--set configsvr.replicaCount=${REPLICA_COUNT} \
--set configsvr.persistence.enabled=true \
--set configsvr.persistence.storageClass=${MONGODB_STORAGE_CLASS} \
--set metrics.enabled=true \
Expand Down Expand Up @@ -130,18 +130,20 @@ function render_mongodb_sharded_yamls()

function mongodb_sharded_yamls()
{
render_mongodb_sharded_yamls "${MONGODB_SHARDED_SINGLE_NODE_PATH}" 1 1
render_mongodb_sharded_yamls "${MONGODB_SHARDED_SINGLE_NODE_TWO_SHARDS_PATH}" 2 1
render_mongodb_sharded_yamls "${MONGODB_SHARDED_THREE_NODE_PATH}" 1 3
render_mongodb_sharded_yamls "${MONGODB_SHARDED_THREE_NODE_THREE_SHARDS_PATH}" 3 3
render_mongodb_sharded_yamls "${MONGODB_SHARDED_SIX_NODE_PATH}" 1 6
render_mongodb_sharded_yamls "${MONGODB_SHARDED_SIX_NODE_TWO_SHARDS_PATH}" 2 6
render_mongodb_sharded_yamls "${MONGODB_SHARDED_SIX_NODE_THREE_SHARDS_PATH}" 3 6
render_mongodb_sharded_yamls "${MONGODB_SHARDED_SIX_NODE_SIX_SHARDS_PATH}" 6 6
render_mongodb_sharded_yamls "${MONGODB_SHARDED_NINE_NODE_PATH}" 1 9
render_mongodb_sharded_yamls "${MONGODB_SHARDED_NINE_NODE_THREE_SHARDS_PATH}" 3 9
render_mongodb_sharded_yamls "${MONGODB_SHARDED_NINE_NODE_SIX_SHARDS_PATH}" 6 9
render_mongodb_sharded_yamls "${MONGODB_SHARDED_NINE_NODE_NINE_SHARDS_PATH}" 9 9
# For now we maximize the number of replicas to 3, so each shard is a P-S-S
# Do we want to support more combinations that is, N replicas?
render_mongodb_sharded_yamls "${MONGODB_SHARDED_SINGLE_NODE_PATH}" 1 1 1
render_mongodb_sharded_yamls "${MONGODB_SHARDED_SINGLE_NODE_TWO_SHARDS_PATH}" 2 1 1
render_mongodb_sharded_yamls "${MONGODB_SHARDED_THREE_NODE_PATH}" 1 3 3
render_mongodb_sharded_yamls "${MONGODB_SHARDED_THREE_NODE_THREE_SHARDS_PATH}" 3 3 3
render_mongodb_sharded_yamls "${MONGODB_SHARDED_SIX_NODE_PATH}" 1 6 3
render_mongodb_sharded_yamls "${MONGODB_SHARDED_SIX_NODE_TWO_SHARDS_PATH}" 2 6 3
render_mongodb_sharded_yamls "${MONGODB_SHARDED_SIX_NODE_THREE_SHARDS_PATH}" 3 6 3
render_mongodb_sharded_yamls "${MONGODB_SHARDED_SIX_NODE_SIX_SHARDS_PATH}" 6 6 3
render_mongodb_sharded_yamls "${MONGODB_SHARDED_NINE_NODE_PATH}" 1 9 3
render_mongodb_sharded_yamls "${MONGODB_SHARDED_NINE_NODE_THREE_SHARDS_PATH}" 3 9 3
render_mongodb_sharded_yamls "${MONGODB_SHARDED_NINE_NODE_SIX_SHARDS_PATH}" 6 9 3
render_mongodb_sharded_yamls "${MONGODB_SHARDED_NINE_NODE_NINE_SHARDS_PATH}" 9 9 3
}

function gen_manifest_yaml()
Expand Down

0 comments on commit a9bd6f9

Please sign in to comment.