Skip to content

Commit

Permalink
Switch stress test config to use more natural options (#28)
Browse files Browse the repository at this point in the history
send in processes per container instead of clients per process
  • Loading branch information
texuf authored May 21, 2024
1 parent cd6d529 commit 20374cc
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion core/stress/scripts/gamma_chat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export RIVER_CHAIN_RPC_URL="${RIVER_CHAIN_RPC_URL}"
export CONTAINER_INDEX="${CONTAINER_INDEX:0}"
export CONTAINER_COUNT="${CONTAINER_COUNT:1}"
export STRESS_DURATION="${STRESS_DURATION:-180}"
export CLIENTS_PER_PROCESS="${CLIENTS_PER_PROCESS:-4}"
export PROCESSES_PER_CONTAINER="${PROCESSES_PER_CONTAINER:-3}"
export CLIENTS_COUNT="${CLIENTS_COUNT:-12}"

export RIVER_ENV="${RIVER_ENV:-gamma}"
Expand Down
2 changes: 1 addition & 1 deletion core/stress/scripts/localhost_chat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export STRESS_MODE="${STRESS_MODE:-chat}"
export STRESS_DURATION="${STRESS_DURATION:-120}"
export SESSION_ID="${SESSION_ID:-$(uuidgen)}"

export CLIENTS_PER_PROCESS="${CLIENTS_PER_PROCESS:-5}"
export PROCESSES_PER_CONTAINER="${PROCESSES_PER_CONTAINER:-4}"
export CLIENTS_COUNT="${CLIENTS_COUNT:-20}"

export MNEMONIC="toy alien remain valid print employ age multiply claim student story aware"
Expand Down
20 changes: 16 additions & 4 deletions core/stress/scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export DEBUG_DEPTH="${DEBUG_DEPTH:-10}"
# stride
export CONTAINER_INDEX="${CONTAINER_INDEX:-0}"
export CONTAINER_COUNT="${CONTAINER_COUNT:-1}"
export CLIENTS_PER_PROCESS="${CLIENTS_PER_PROCESS:-1}"
export PROCESSES_PER_CONTAINER="${PROCESSES_PER_CONTAINER:-1}"
export CLIENTS_COUNT="${CLIENTS_COUNT:-10}"

# optional deployment environment variables, all required if pointed to a custom deployment
Expand All @@ -45,8 +45,8 @@ export CONTRACT_VERSION="${CONTRACT_VERSION:-}" # not required if using deployme

# validation
# if clients per process is greater than clients count, exit
if [ $CLIENTS_PER_PROCESS -gt $CLIENTS_COUNT ]; then
echo "CLIENTS_PER_PROCESS cannot be greater than CLIENTS_COUNT"
if [ $PROCESSES_PER_CONTAINER -eq 0 ]; then
echo "PROCESSES_PER_CONTAINER should be gte 0"
exit 1
fi
if [ $CONTAINER_COUNT -gt $CLIENTS_COUNT ]; then
Expand All @@ -56,8 +56,15 @@ fi

# calculate number of clients per container
export CLIENTS_PER_CONTAINER=$((CLIENTS_COUNT / CONTAINER_COUNT))

# hopefully this is mod 0
if [ $PROCESSES_PER_CONTAINER -gt $CLIENTS_PER_CONTAINER ]; then
echo "CLIENTS_PER_PROCESS cannot be greater than PROCESSES_PER_CONTAINER"
exit 1
fi

# calculate number of processes
export PROCESSES_PER_CONTAINER=$((CLIENTS_PER_CONTAINER / CLIENTS_PER_PROCESS))
export CLIENTS_PER_PROCESS=$((CLIENTS_PER_CONTAINER / PROCESSES_PER_CONTAINER))
# calculate the start index for this container
export PROCESS_START_INDEX=$((CONTAINER_INDEX * PROCESSES_PER_CONTAINER))
# calculate the end index for this container
Expand All @@ -73,6 +80,11 @@ echo "PROCESSES_PER_CONTAINER: $PROCESSES_PER_CONTAINER"
echo "PROCESS_START_INDEX: $PROCESS_START_INDEX"
echo "PROCESS_END_INDEX: $PROCESS_END_INDEX"

if [ $((CONTAINER_COUNT * PROCESSES_PER_CONTAINER * CLIENTS_PER_PROCESS)) -ne $CLIENTS_COUNT ]; then
echo "container count * processes per container * clients per process should equal clients count"
exit 1
fi

yarn build

# Array to hold process IDs
Expand Down
2 changes: 1 addition & 1 deletion core/stress/src/mode/chat/joinChat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export async function joinChat(client: StressClient, cfg: ChatConfig) {
announceChannelId,
`c${cfg.containerIndex}p${cfg.processIndex} Starting up! freeMemory: ${
getSystemInfo().FreeMemory
}`,
} clientStart:${cfg.localClients.startIndex} ${cfg.localClients.endIndex}`,
{ threadId: message.hashStr },
)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/stress-testing/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SPACE_ID=
ANNOUNCE_CHANNEL_ID=
CHANNEL_IDS=
STRESS_DURATION="180"
CLIENTS_PER_PROCESS="2"
PROCESSES_PER_CONTAINER="2"
CLIENTS_COUNT="8"
MNEMONIC= # secret
BASE_CHAIN_RPC_URL= # local or get from alchemy
Expand Down
2 changes: 1 addition & 1 deletion packages/stress-testing/.env.example.gamma
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ANNOUNCE_CHANNEL_ID="20a38bcf15ab6b94d404c201dee9f67c6428c0ecb1a166f49d6787eb5dd
CHANNEL_IDS="20a38bcf15ab6b94d404c201dee9f67c6428c0ecb14c8601d7f529814cebe12c,20a38bcf15ab6b94d404c201dee9f67c6428c0ecb1826ef52f48e2e904844cff"
RIVER_CHAIN_RPC_URL="https://devnet.rpc.river.build"
STRESS_DURATION="180"
CLIENTS_PER_PROCESS="2"
PROCESSES_PER_CONTAINER="2"
CLIENTS_COUNT="8"
MNEMONIC= # get from the team
BASE_CHAIN_RPC_URL= # get from alchemy
Expand Down

0 comments on commit 20374cc

Please sign in to comment.