diff --git a/scripts/perf-lab/main.yml b/scripts/perf-lab/main.yml index 5618a2e..4918757 100644 --- a/scripts/perf-lab/main.yml +++ b/scripts/perf-lab/main.yml @@ -89,6 +89,7 @@ states: REPO_DIR: ${{BASE_DIR}}/spring-quarkus-perf-comparison SCRIPTS_DIR: ${{REPO_DIR}}/${{PROJ_REPO_NAME}}/scripts/perf-lab + JS_SCRIPTS_DIR: ${{SCRIPTS_DIR}}/scripts SPRING3_BOOT_DIR: ${{REPO_DIR}}/${{PROJ_REPO_NAME}}/springboot3 QUARKUS3_DIR : ${{REPO_DIR}}/${{PROJ_REPO_NAME}}/quarkus3 TARGET_URL: http://localhost:8080/fruits @@ -133,7 +134,7 @@ scripts: - log: Checked out repo - sh: git remote get-url origin - sh: git branch --show-current - - sh: cd ${{SCRIPTS_DIR}} + - sh: cd ${{JS_SCRIPTS_DIR}} - sh: npm install axios@0.27.2 update-spring-boot-version: @@ -277,7 +278,7 @@ scripts: then: - script: start-test-services - script: sync-drop-fs-cache - - sh: node ${{SCRIPTS_DIR}}/time.js "${{= "${{RUNTIME.runCmd}}".trim().replace(/ +/g, ' ') }}" ${{TARGET_URL}} | awk '{print $1}' + - sh: node ${{JS_SCRIPTS_DIR}}/time.js "${{= "${{RUNTIME.runCmd}}".trim().replace(/ +/g, ' ') }}" ${{TARGET_URL}} | awk '{print $1}' then: - set-state: START_TIME - script: state-array-push @@ -456,9 +457,11 @@ hosts: roles: test-cgroups: hosts: - - target-host - # - target-host-root +# - target-host + - target-host-root setup-scripts: + - detect-os + - capture-os-info - create-cgroup: with: CGROUP_NAME: ${{config.cgroup.name}} diff --git a/scripts/perf-lab/run-benchmarks.sh b/scripts/perf-lab/run-benchmarks.sh index bd4f356..6f2ee56 100755 --- a/scripts/perf-lab/run-benchmarks.sh +++ b/scripts/perf-lab/run-benchmarks.sh @@ -124,11 +124,30 @@ print_values() { } make_json_array() { - local bashArray=("$@") - local jsonArray="${bashArray[*]}" - echo "['${jsonArray// /','}']" + local items=($@) # Split on whitespace into array + local json="[" + local first=true + + for item in "${items[@]}"; do + if [ "$first" = true ]; then + first=false + else + json+="," + fi + + json+="\"$item\"" + done + + json+="]" + echo "$json" } +#make_json_array() { +# local bashArray=("$@") +# local jsonArray="${bashArray[*]}" +# echo "['${jsonArray// /','}']" +#} + setup_jbang() { if command -v jbang &> /dev/null; then echo "Using installed jbang ($(jbang --version))" @@ -158,6 +177,8 @@ run_benchmarks() { #print_values +set -x + # jbang qDup@hyperfoil --trace="target" \ ${JBANG_CMD} qDup@hyperfoil \ -B ${OUTPUT_DIR} \ @@ -182,11 +203,12 @@ ${JBANG_CMD} qDup@hyperfoil \ -S config.repo.url=${SCM_REPO_URL} \ -S env.USER=${USER} \ -S env.TARGET=${target} \ + -S env.HOST=${HOST} \ -S config.num_iterations=${ITERATIONS} \ -S PROJ_REPO_NAME="$(basename ${SCM_REPO_URL} .git)" \ - -S RUNTIMES="$(make_json_array ${RUNTIMES})" \ + -S RUNTIMES="$(make_json_array $RUNTIMES)" \ -S PAUSE_TIME=${WAIT_TIME} \ - -S TESTS="$(make_json_array ${TESTS_TO_RUN})" \ + -S TESTS="$(make_json_array $TESTS_TO_RUN)" \ -S DROP_OS_FILESYSTEM_CACHES=${DROP_OS_FILESYSTEM_CACHES} } diff --git a/scripts/perf-lab/scripts/time.docker.js b/scripts/perf-lab/scripts/time.docker.js deleted file mode 100644 index 069ff51..0000000 --- a/scripts/perf-lab/scripts/time.docker.js +++ /dev/null @@ -1,34 +0,0 @@ -const spawn = require("child_process").spawn; -const request = require("request"); - -const pingIntervalMs = 10; - -const args = process.argv.slice(2); -if (args.length == 0) { - console.log('The path of java executable jar must be specified !'); -} - -const dockerImageName = args[0]; -const dockerContainerName = args[1]; - - -spawn("docker", ["run", "--rm", "-d", "--network=host", "--name="+dockerContainerName, dockerImageName+":latest"]); - -const startTime = new Date().getTime(); -const intervalHandle = setInterval(() => { - request("http://localhost:8080/hello/John", (error, response, body) => { - if (!error && response && response.statusCode === 200 && body) { - const time = new Date().getTime() - startTime; - console.log(time + " ms"); - clearInterval(intervalHandle); - spawn("docker", ["stop", dockerContainerName]); - process.exit(0); - } else { - // @ts-ignore - if (!error || !error.code === "ECONNREFUSED") { - console.log(error ? error : response.statusCode); - } - } - } - ); -}, pingIntervalMs); \ No newline at end of file