diff --git a/README.md b/README.md index fde0c91..6840d18 100644 --- a/README.md +++ b/README.md @@ -307,13 +307,15 @@ The following default configurations are available: --msPerBlock Protocol setting specifying the minimal (and targeted for) time interval between blocks. Must be an integer number of milliseconds. The default value is set in configuration templates and is 1s and 5s for single node and multinode setup respectively. Example: --msPerBlock 3000 + -e, --external Use external network for benchmarking. Default is false. -a flag should be used to specify RPC addresses. ``` ## Build options By default, neo-bench uses released versions of Neo nodes to build Docker images. -However, you can easily test non-released branches or even separate commits for both Go and C# Neo nodes. +However, you can easily test non-released branches or even separate commits for both Go and C# Neo nodes. +Also with `--external` flag benchmark will be build and run locally without docker containers. ### Build Go node image from sources diff --git a/runner.sh b/runner.sh index 1aeab3b..dcc6c35 100755 --- a/runner.sh +++ b/runner.sh @@ -3,7 +3,7 @@ source .env OUTPUT="" -ARGS=(-i "/dump.txs") +ARGS=() FILES=() MODE="" TARGET_RPS="" @@ -12,6 +12,7 @@ WORKERS_COUNT="30" IR_TYPE=go RPC_TYPE= RPC_ADDR=() +EXTERNAL_NETWORK=false export NEOBENCH_LOGGER=${NEOBENCH_LOGGER:-none} export NEOBENCH_TYPE=${NEOBENCH_TYPE:-NEO} export NEOBENCH_FROM_COUNT=${NEOBENCH_FROM_COUNT:-1} @@ -56,6 +57,7 @@ show_help() { echo " --msPerBlock Protocol setting specifying the minimal (and targeted for) time interval between blocks. Must be an integer number of milliseconds." echo " The default value is set in configuration templates and is 1s and 5s for single node and multinode setup respectively." echo " Example: --msPerBlock 1000" + echo " -e, --external Use external network for benchmarking. Default is false. -a flag should be used to specify RPC addresses." exit 0 } @@ -74,6 +76,9 @@ while test $# -gt 0; do case $_opt in -h | --help) show_help ;; + -e|--external) + EXTERNAL_NETWORK=true + ;; -l | --log) if [[ $# -gt 0 && ${1:0:1} != "-" ]]; then case "$1" in @@ -279,8 +284,22 @@ if [ -n "$NEOBENCH_VOTE" ]; then ARGS+=(--vote) fi -make prepare +cleanup() { + echo "Cleaning up..." + [ -n "$pid" ] && kill "$pid" && wait "$pid" + exit +} -docker compose "${FILES[@]}" run bench neo-bench -o "$OUTPUT" "${ARGS[@]}" +trap cleanup SIGINT SIGTERM EXIT -make stop +make prepare +if [ "$EXTERNAL_NETWORK" = true ]; then + ARGS+=(-i "./.docker/build/dump.$NEOBENCH_TYPE.$NEOBENCH_FROM_COUNT.$NEOBENCH_TO_COUNT.txs" --disable-stats) + ./cmd/bin/bench -o "$OUTPUT" "${ARGS[@]}"& + pid=$! + wait $pid +else + ARGS+=(-i "/dump.txs") + docker compose "${FILES[@]}" run bench neo-bench -o "$OUTPUT" "${ARGS[@]}" + make stop +fi