diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 873b1e6..df07fb1 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -22,13 +22,8 @@ on: default: '11' required: true type: string - memory_request: - description: 'The memory request set for the workers' - default: '32Gi' - required: false - type: string - memory_limit: - description: 'The memory limit set for the workers' + memory: + description: 'The memory set for the workers' default: '32Gi' required: false type: string @@ -48,7 +43,11 @@ on: description: 'The RPC endpoint zero-bin will use' required: false default: 'http://35.208.84.178:8545' - type: string + default: IMX_RPC + type: choice + options: + - IMX_RPC + - INTERNAL_RPC jobs: test: @@ -85,4 +84,4 @@ jobs: GCP_WORKLOAD_IDENTITY_ID: ${{ secrets.GCP_WORKLOAD_IDENTITY_ID }} GCP_SERVICE_ACCOUNT: ${{ secrets.GCP_SERVICE_ACCOUNT }} run: > - ./tools/run-benchmark.sh ${{ inputs.machine_type }} ${{ inputs.num_workers }} ${{ inputs.cpu_request }} ${{ inputs.cpu_limit }} ${{ inputs.memory_request }} ${{ inputs.memory_limit }} ${{ inputs.block_start }} ${{ inputs.block_end }} ${{ inputs.other_args }} ${{ inputs.rpc_endpoint }} \ No newline at end of file + ./tools/run-benchmark.sh ${{ inputs.machine_type }} ${{ inputs.num_workers }} ${{ inputs.cpu_request }} ${{ inputs.cpu_limit }} ${{ inputs.memory }} ${{ inputs.memory }} ${{ inputs.block_start }} ${{ inputs.block_end }} ${{ inputs.other_args }} ${{ inputs.rpc_endpoint }} \ No newline at end of file diff --git a/tools/run-benchmark.sh b/tools/run-benchmark.sh index 51c39f5..71b6037 100755 --- a/tools/run-benchmark.sh +++ b/tools/run-benchmark.sh @@ -24,6 +24,10 @@ LEADER_ENDPOINT="http://35.238.105.189:8080" LOG_STRING_TO_WATCH_FOR="Finalized benchmarked proofs" CPU_THRESHOLD=100 DISK_TYPE="" +NUM_WORKERS_LIMIT=200 +IMX_RPC="http://35.208.84.178:8545" +INTERNAL_RPC="http://35.208.68.173:8545" +RPC_ADDRESS="" # parameters machine_type=$1 @@ -37,17 +41,41 @@ block_end=$8 other_args=$9 # will be appended to the csv file name RPC_ENDPOINT=${10} +###################### +# Do some validation # +###################### +if [[ "$num_workers" -gt $NUM_WORKERS_LIMIT ]]; then + echo "error: Num workers can't be greater than ${NUM_WORKERS_LIMIT}" >&2 + exit 1 +fi -if [[ "$machine_type" == *"n4"* ]]; then - DISK_TYPE="hyperdisk-balanced" +re='^[0-9]+$' +if ! [[ $block_start =~ $re ]] ; then + echo "error: Block start must be a number" >&2; exit 1 +fi + +if ! [[ $block_end =~ $re ]] ; then + echo "error: Block end must be a number" >&2; exit 1 +fi + +if [[ $RPC_ENDPOINT == "IMX_RPC" ]]; then + RPC_ADDRESS=$IMX_RPC +elif [[ $RPC_ENDPOINT == "INTERNAL_RPC" ]]; then + RPC_ADDRESS=$INTERNAL_RPC else - DISK_TYPE="pd-ssd" + echo "error: Wrong RPC endpoint" >&2; exit 1 fi ######################## # Update GKE node pool # ######################## +if [[ "$machine_type" == *"n4"* ]]; then + DISK_TYPE="hyperdisk-balanced" +else + DISK_TYPE="pd-ssd" +fi + gcloud container node-pools update $NODE_POOL_NAME --cluster=$CLUSTER_NAME --machine-type=$machine_type --disk-type=$DISK_TYPE --region=$REGION ########################## @@ -156,7 +184,7 @@ done # Build out the request parameters csv_file_name=$(printf "%s.%s.%s.%s.%scpu.%sworkers.sequential.%s.csv" "$block_start" "$block_end" "$machine_type" "$CPU_PLATFORM" "$cpu_request" "$num_workers" "$other_args") -post_body=$(printf '{"block_interval":"%s..=%s","block_source":{"ZeroBinRpc":{"rpc_url":"%s"}},"benchmark_output":{"GoogleCloudStorageCsv":{"file_name":"%s","bucket":"zkevm-csv"}}}' "$block_start" "$block_end" "$RPC_ENDPOINT" "$csv_file_name") +post_body=$(printf '{"block_interval":"%s..=%s","block_source":{"ZeroBinRpc":{"rpc_url":"%s"}},"benchmark_output":{"GoogleCloudStorageCsv":{"file_name":"%s","bucket":"zkevm-csv"}}}' "$block_start" "$block_end" "$RPC_ADDRESS" "$csv_file_name") # Run the benchmark test echo "Triggering benchmark test..."