From e532e6a685c787b8568b98d221ce4c2906c5ebd8 Mon Sep 17 00:00:00 2001 From: aya Date: Fri, 26 Sep 2025 16:22:41 +0300 Subject: [PATCH] Add merged scripts --- .../store/nodes_15_scenario2.sh | 151 +++++++++++++++ .../store/nodes_15_service_1.sh | 21 +- .../store/store_cpu_stress.sh | 4 +- .../stress_high_concurrency_scenario2.sh | 183 ++++++++++++++++++ 4 files changed, 347 insertions(+), 12 deletions(-) create mode 100755 scripts/Lite_protocol_scripts/store/nodes_15_scenario2.sh create mode 100755 scripts/Lite_protocol_scripts/store/stress_high_concurrency_scenario2.sh diff --git a/scripts/Lite_protocol_scripts/store/nodes_15_scenario2.sh b/scripts/Lite_protocol_scripts/store/nodes_15_scenario2.sh new file mode 100755 index 00000000..f4dbb35a --- /dev/null +++ b/scripts/Lite_protocol_scripts/store/nodes_15_scenario2.sh @@ -0,0 +1,151 @@ +#!/bin/bash +set -e +if ! typeset -f wn >/dev/null 2>&1; then + wn() { docker compose "$@"; } +fi +# - waku-simulator: 15-node network, 1 service, 1 edge +# - Service node limited by env below (CPU cores 0-3; memory 512 MiB) +# - Phases driven by LPT; Sonda runs throughout to exercise Store +# - This variant stresses CPU more and uses 120s observe windows + +echo " Running test..." + +# -------------------- Bring up simulator ------------------------ +cd ./waku-simulator + +export NWAKU_IMAGE=wakuorg/nwaku:latest +export NUM_NWAKU_NODES=15 +export RLN_ENABLED=false + +export SERVICENODE_CPU_CORES="0-3" +export SERVICENODE_MEM_LIMIT=512m +export POSTGRES_CPU_CORES="0-3" +export POSTGRES_MEM_LIMIT=2g +export POSTGRES_SHM=1g + +docker compose up -d + +# Wait until service node is running +while true; do + sid="$(docker compose ps -q servicenode || true)" + if [[ -n "$sid" ]]; then + state="$(docker inspect --format '{{.State.Status}}' "$sid" 2>/dev/null || true)" + [[ "$state" == "running" ]] && break + fi + sleep 1 +done + +cd ../lpt + +# -------------------- LPT common knobs (same exports) ------------------------- +export LPT_IMAGE=harbor.status.im/wakuorg/liteprotocoltester:latest +export START_PUBLISHING_AFTER=15 +export NUM_MESSAGES=0 +export MESSAGE_INTERVAL_MILLIS=100 + +export MIN_MESSAGE_SIZE=120Kb +export MAX_MESSAGE_SIZE=145Kb + +export LIGHTPUSH_SERVICE_PEER=/ip4/10.2.0.101/tcp/60001/p2p/16Uiu2HAkyte8uj451tGkbww4Mjcg6DRnmAHxNeWyF4zp23RbpG3n +export FILTER_SERVICE_PEER=/ip4/10.2.0.101/tcp/60001/p2p/16Uiu2HAkyte8uj451tGkbww4Mjcg6DRnmAHxNeWyF4zp23RbpG3n + +export PUBSUB=/waku/2/rs/66/0 +export CONTENT_TOPIC=/tester/2/light-pubsub-test/wakusim +export CLUSTER_ID=66 + +# wait time before starting traffic +sleep 60 + + +# -------------------- Sonda (Store monitor) ----------------------------------- +cd ../sonda + +docker build -t local-perf-sonda -f ./Dockerfile.sonda . + +# perf-test.env +cat < perf-test.env +RELAY_NODE_REST_ADDRESS=http://127.0.0.1:8645 +STORE_NODE_REST_ADDRESS=http://127.0.0.1:8644 +QUERY_DELAY=0.5 +STORE_NODES=/ip4/10.2.0.101/tcp/60001/p2p/16Uiu2HAkyte8uj451tGkbww4Mjcg6DRnmAHxNeWyF4zp23RbpG3n +CLUSTER_ID=66 +SHARD=0 +EOF + +sleep 5 + +docker rm -f sonda >/dev/null 2>&1 || true +docker run --env-file ./perf-test.env -l sonda -d --network host local-perf-sonda + +cd ../lpt + +# -------------------- Phase 1: 6 pub / 6 recv -------------------------------- +export NUM_PUBLISHER_NODES=6 +export NUM_RECEIVER_NODES=6 +docker compose down -v >/dev/null 2>&1 || true +docker compose up -d + +current_time=$(date +"%Y-%m-%d %H:%M:%S") +echo "[test] LPT is running with 6 publishers and 6 receivers + sonda from now: $current_time" + +sleep 120 + +# -------------------- Phase 2: 3 pub / 12 recv ------------------------------- +docker compose down -v +export NUM_PUBLISHER_NODES=3 +export NUM_RECEIVER_NODES=12 +docker compose up -d + +current_time=$(date +"%Y-%m-%d %H:%M:%S") +echo "[test] LPT is running with 3 publishers and 12 receivers from now: $current_time" + +sleep 120 + +# -------------------- Phase 3: 12 pub / 3 recv ------------------------------- +docker compose down -v +export NUM_PUBLISHER_NODES=12 +export NUM_RECEIVER_NODES=3 +docker compose up -d + +current_time=$(date +"%Y-%m-%d %H:%M:%S") +echo "[test] LPT is running with 12 publishers and 3 receivers from now: $current_time" + +sleep 120 + +# -------------------- Phase 4: receivers down; keep publisher + sonda -------- +docker compose down -v +export NUM_PUBLISHER_NODES=12 +export NUM_RECEIVER_NODES=0 +docker compose up -d + +current_time=$(date +"%Y-%m-%d %H:%M:%S") +echo "[test] LPT receivers are down; sonda and lightpush publisher running from now: $current_time" + +sleep 120 + +# -------------------- Phase 5: LPT down; only sonda -------------------------- +docker compose down -v + +current_time=$(date +"%Y-%m-%d %H:%M:%S") +echo "[test] LPT down; only sonda is working from now: $current_time" + +sleep 120 + +# -------------------- Phase 6: final high-load burst ----------------- + +export NUM_PUBLISHER_NODES=12 +export NUM_RECEIVER_NODES=12 +docker compose up -d + +current_time=$(date +"%Y-%m-%d %H:%M:%S") +echo "[test] Final burst: LPT running with 12 publishers and 12 receivers from now: $current_time" + +sleep 120 + +cd .. + +current_time=$(date +"%Y-%m-%d %H:%M:%S") +echo "[test] Test finished at $current_time" + +# finish +# exec ./stop_test.sh diff --git a/scripts/Lite_protocol_scripts/store/nodes_15_service_1.sh b/scripts/Lite_protocol_scripts/store/nodes_15_service_1.sh index 5d6ce322..60b30633 100755 --- a/scripts/Lite_protocol_scripts/store/nodes_15_service_1.sh +++ b/scripts/Lite_protocol_scripts/store/nodes_15_service_1.sh @@ -6,9 +6,9 @@ set -e # - Phases driven by LPT; Sonda runs throughout to exercise Store # - This variant stresses CPU more and uses 120s observe windows -echo "[store_scenario1] Running test..." +echo "Running test..." -# -------------------- Bring up simulator (same exports) ------------------------ +# -------------------- Bring up simulator ------------------------ cd ./waku-simulator export NWAKU_IMAGE=wakuorg/nwaku:latest @@ -35,7 +35,7 @@ done cd ../lpt -# -------------------- LPT common knobs (same exports) ------------------------- +# -------------------- LPT common knobs ------------------------- export LPT_IMAGE=harbor.status.im/wakuorg/liteprotocoltester:latest export START_PUBLISHING_AFTER=15 export NUM_MESSAGES=0 @@ -61,7 +61,7 @@ cd ../sonda docker build -t local-perf-sonda -f ./Dockerfile.sonda . -# perf-test.env (same style as scenario_1.sh) +# perf-test.env cat < perf-test.env RELAY_NODE_REST_ADDRESS=http://127.0.0.1:8645 STORE_NODE_REST_ADDRESS=http://127.0.0.1:8644 @@ -85,7 +85,7 @@ docker compose down -v >/dev/null 2>&1 || true docker compose up -d current_time=$(date +"%Y-%m-%d %H:%M:%S") -echo "[store_scenario1] LPT is running with 6 publishers and 6 receivers + sonda from now: $current_time" +echo "LPT is running with 6 publishers and 6 receivers + sonda from now: $current_time" sleep 120 @@ -96,7 +96,7 @@ export NUM_RECEIVER_NODES=12 docker compose up -d current_time=$(date +"%Y-%m-%d %H:%M:%S") -echo "[store_scenario1] LPT is running with 3 publishers and 12 receivers from now: $current_time" +echo "LPT is running with 3 publishers and 12 receivers from now: $current_time" sleep 120 @@ -107,7 +107,7 @@ export NUM_RECEIVER_NODES=3 docker compose up -d current_time=$(date +"%Y-%m-%d %H:%M:%S") -echo "[store_scenario1] LPT is running with 12 publishers and 3 receivers from now: $current_time" +echo "LPT is running with 12 publishers and 3 receivers from now: $current_time" sleep 120 @@ -118,7 +118,7 @@ export NUM_RECEIVER_NODES=0 docker compose up -d current_time=$(date +"%Y-%m-%d %H:%M:%S") -echo "[store_scenario1] LPT receivers are down; sonda and lightpush publisher running from now: $current_time" +echo "LPT receivers are down; sonda and lightpush publisher running from now: $current_time" sleep 120 @@ -126,14 +126,15 @@ sleep 120 docker compose down -v current_time=$(date +"%Y-%m-%d %H:%M:%S") -echo "[store_scenario1] LPT down; only sonda is working from now: $current_time" +echo "LPT down; only sonda is working from now: $current_time" sleep 120 cd .. current_time=$(date +"%Y-%m-%d %H:%M:%S") -echo "[store_scenario1] Test finished at $current_time" +echo "Test finished at $current_time" # finish # exec ./stop_test.sh +s \ No newline at end of file diff --git a/scripts/Lite_protocol_scripts/store/store_cpu_stress.sh b/scripts/Lite_protocol_scripts/store/store_cpu_stress.sh index ecd0546e..299a9263 100755 --- a/scripts/Lite_protocol_scripts/store/store_cpu_stress.sh +++ b/scripts/Lite_protocol_scripts/store/store_cpu_stress.sh @@ -88,8 +88,8 @@ EOF docker run --env-file perf-test.env -l sonda -d --network host local-perf-sonda cd .. -echo "[${TEST_NAME}] hold 12m" -sleep 720 +echo "[${TEST_NAME}] hold 240s" +sleep 240 # ========================= # Phase 3 — recovery diff --git a/scripts/Lite_protocol_scripts/store/stress_high_concurrency_scenario2.sh b/scripts/Lite_protocol_scripts/store/stress_high_concurrency_scenario2.sh new file mode 100755 index 00000000..760dc400 --- /dev/null +++ b/scripts/Lite_protocol_scripts/store/stress_high_concurrency_scenario2.sh @@ -0,0 +1,183 @@ +#!/bin/bash +set -e + +# Heavier Store stress by stacking more concurrent Sonda readers +# and ramping LPT publishers/receivers & message sizes. + +cd ./waku-simulator + +export NWAKU_IMAGE=wakuorg/nwaku:latest +export NUM_NWAKU_NODES=15 +export RLN_ENABLED=false + +# Service node config +export SERVICENODE_CPU_CORES="0-3" +export SERVICENODE_MEM_LIMIT=2g +export POSTGRES_CPU_CORES="0-3" +export POSTGRES_MEM_LIMIT=2g +export POSTGRES_SHM=1g + +docker compose up -d + +# Wait until service node is running +while true; do + sid="$(docker compose ps -q servicenode || true)" + if [[ -n "$sid" ]]; then + state="$(docker inspect --format '{{.State.Status}}' "$sid" 2>/dev/null || true)" + [[ "$state" == "running" ]] && break + fi + sleep 1 +done + +cd ../lpt + +# -------------------- LPT config --------------------------- +export LPT_IMAGE=harbor.status.im/wakuorg/liteprotocoltester:latest +export START_PUBLISHING_AFTER=15 +export NUM_MESSAGES=0 +export MESSAGE_INTERVAL_MILLIS=100 + +# Service peers +export LIGHTPUSH_SERVICE_PEER=/ip4/10.2.0.101/tcp/60001/p2p/16Uiu2HAkyte8uj451tGkbww4Mjcg6DRnmAHxNeWyF4zp23RbpG3n +export FILTER_SERVICE_PEER=/ip4/10.2.0.101/tcp/60001/p2p/16Uiu2HAkyte8uj451tGkbww4Mjcg6DRnmAHxNeWyF4zp23RbpG3n + +# Topics +export PUBSUB=/waku/2/rs/66/0 +export CONTENT_TOPIC=/tester/2/light-pubsub-test/wakusim +export CLUSTER_ID=66 + +# settle before traffic +sleep 60 + +cd ../sonda +docker build -t local-perf-sonda -f ./Dockerfile.sonda . + +# Keep perf-test.env location and content +cat < perf-test.env +RELAY_NODE_REST_ADDRESS=http://127.0.0.1:8645 +STORE_NODE_REST_ADDRESS=http://127.0.0.1:8644 +QUERY_DELAY=0.5 +STORE_NODES=/ip4/10.2.0.101/tcp/60001/p2p/16Uiu2HAkyte8uj451tGkbww4Mjcg6DRnmAHxNeWyF4zp23RbpG3n +CLUSTER_ID=66 +SHARD=0 +EOF + +sleep 5 + +# Clean old sonda +docker rm -f sonda1 sonda2 sonda3 sonda4 sonda5 sonda6 sonda7 sonda8 sonda9 sonda10 >/dev/null 2>&1 || true + +# Baseline Sonda (0.5s) +docker run -d --name sonda1 --network host -l sonda \ + --env-file ./perf-test.env local-perf-sonda + +cd ../lpt + +# ============================================================================ # +# PHASE 0: Warmup, small messages, quick history fill +# LPT 8/8, 20–40 KB; Sonda x1 @0.5s +# ============================================================================ # +export NUM_PUBLISHER_NODES=8 +export NUM_RECEIVER_NODES=8 +export MIN_MESSAGE_SIZE=20Kb +export MAX_MESSAGE_SIZE=40Kb + +docker compose down -v >/dev/null 2>&1 || true +docker compose up -d + +echo "Phase 0: LPT 8/8, 20–40KB; Sonda x1 @0.5s — $(date '+%F %T')" +sleep 30 + +# ============================================================================ # +# PHASE 1: Moderate traffic +# LPT 6/6, 50–90 KB; Sonda x1 @0.5s +# ============================================================================ # +export NUM_PUBLISHER_NODES=6 +export NUM_RECEIVER_NODES=6 +export MIN_MESSAGE_SIZE=50Kb +export MAX_MESSAGE_SIZE=90Kb + +docker compose down -v >/dev/null 2>&1 || true +docker compose up -d + +echo "Phase 1: LPT 6/6, 50–90KB; Sonda x1 @0.5s — $(date '+%F %T')" +sleep 30 + +# ============================================================================ # +# PHASE 2: Triple query rate +# Keep LPT; add Sonda x2 @0.1s (total 3) +# ============================================================================ # +docker run -d --name sonda2 --network host -l sonda \ + --env-file ../sonda/perf-test.env -e QUERY_DELAY=0.1 local-perf-sonda +docker run -d --name sonda3 --network host -l sonda \ + --env-file ../sonda/perf-test.env -e QUERY_DELAY=0.1 local-perf-sonda + +echo "Phase 2: +Sonda x2 @0.1s (total 3) — $(date '+%F %T')" +sleep 30 + +# ============================================================================ # +# PHASE 3: Heavier traffic + peak query rate +# LPT 10/10, 130–149 KB; +Sonda x2 @0.05s (total 5) +# ============================================================================ # +docker compose down -v +export NUM_PUBLISHER_NODES=10 +export NUM_RECEIVER_NODES=10 +export MIN_MESSAGE_SIZE=130Kb +export MAX_MESSAGE_SIZE=149Kb +docker compose up -d + +docker run -d --name sonda4 --network host -l sonda \ + --env-file ../sonda/perf-test.env -e QUERY_DELAY=0.05 local-perf-sonda +docker run -d --name sonda5 --network host -l sonda \ + --env-file ../sonda/perf-test.env -e QUERY_DELAY=0.05 local-perf-sonda + +echo "Phase 3: LPT 10/10, 130–149KB; Sonda total x5 — $(date '+%F %T')" +sleep 30 + +# ============================================================================ # +# PHASE 3.5: Max Store pressure spike (Store-heavy while LPT still running) +# Add Sonda x3 @0.02s (total 8) +# ============================================================================ # +docker run -d --name sonda6 --network host -l sonda \ + --env-file ../sonda/perf-test.env -e QUERY_DELAY=0.02 local-perf-sonda +docker run -d --name sonda7 --network host -l sonda \ + --env-file ../sonda/perf-test.env -e QUERY_DELAY=0.02 local-perf-sonda +docker run -d --name sonda8 --network host -l sonda \ + --env-file ../sonda/perf-test.env -e QUERY_DELAY=0.02 local-perf-sonda + +echo "Phase 3.5: +Sonda x3 @0.02s (total 8) — $(date '+%F %T')" +sleep 30 + +# ============================================================================ # +# PHASE 4: Store-only flood +# Stop LPT; observe pure Store query saturation +# ============================================================================ # +docker compose down -v + +echo "Phase 4: LPT down; Store-only with Sonda x8 — $(date '+%F %T')" +sleep 30 + +# ============================================================================ # +# PHASE 5: Final squeeze +# Add Sonda x2 more @0.01s (total 10) for short burst +# ============================================================================ # +docker run -d --name sonda9 --network host -l sonda \ + --env-file ../sonda/perf-test.env -e QUERY_DELAY=0.01 local-perf-sonda +docker run -d --name sonda10 --network host -l sonda \ + --env-file ../sonda/perf-test.env -e QUERY_DELAY=0.01 local-perf-sonda + +echo "Phase 5: +Sonda x2 @0.01s (total 10) — $(date '+%F %T')" +sleep 30 + +# brief post-run observation +echo "Final observe window — $(date '+%F %T')" +sleep 30 + +# -------------------- Cleanup ------------------------------------------------- +docker rm -f sonda1 sonda2 sonda3 sonda4 sonda5 sonda6 sonda7 sonda8 sonda9 sonda10 >/dev/null 2>&1 || true + +cd .. + +echo "Test finished at $(date '+%F %T')" +# exec ./stop_test.sh +