From 8ae138b8253086bbfff67b120a1bedf248eb39b0 Mon Sep 17 00:00:00 2001 From: Sahil Yeole Date: Fri, 5 Jul 2024 17:21:30 +0530 Subject: [PATCH] update benchmark Signed-off-by: Sahil Yeole --- k6/bench.js | 6 +++--- run_benchmarks.sh | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/k6/bench.js b/k6/bench.js index 7778f2c3..ad1d1da0 100644 --- a/k6/bench.js +++ b/k6/bench.js @@ -2,13 +2,13 @@ import http from 'k6/http'; import { check } from 'k6'; const whichBenchmark = Number(__ENV.BENCHMARK); -const benchmarkName = whichBenchmark === 1 ? 'posts' : 'posts+users'; +const benchmarkName = whichBenchmark === 2 ? 'posts' : 'posts+users'; export const options = { scenarios: { posts: { executor: 'constant-vus', - duration: whichBenchmark === 1 ? '10s' : '30s', + duration: whichBenchmark === 2 ? '10s' : '30s', gracefulStop: '0s', vus: 100, } @@ -31,7 +31,7 @@ export default function() { const payload = JSON.stringify({ operationName: null, variables: {}, - query: whichBenchmark === 1 ? '{posts{title}}' : '{posts{id,userId,title,user{id,name,email}}}', + query: whichBenchmark === 2 ? '{posts{title}}' : '{posts{id,userId,title,user{id,name,email}}}', }); const res = http.post(url, payload, params); diff --git a/run_benchmarks.sh b/run_benchmarks.sh index 549f13d6..1f2dbb3c 100755 --- a/run_benchmarks.sh +++ b/run_benchmarks.sh @@ -24,7 +24,7 @@ function runBenchmark() { local serviceScript="graphql/${service}/run.sh" local benchmarks=(1 2) - if [[ "$service" == *"hasura"* ]]; then + if [[ "$service" == "hasura" ]]; then bash "$serviceScript" # Run synchronously without background process else bash "$serviceScript" & # Run in daemon mode @@ -44,15 +44,15 @@ function runBenchmark() { local resultFiles=("result1_${sanitizedServiceScriptName}.txt" "result2_${sanitizedServiceScriptName}.txt" "result3_${sanitizedServiceScriptName}.txt") - bash "test_query${bench}.sh" "$graphqlEndpoint" + bash "test_query${bench}.sh" "$graphqlEndpoint" - # Warmup run - bash "$benchmarkScript" "$graphqlEndpoint" >/dev/null - sleep 1 # Give some time for apps to finish in-flight requests from warmup - bash "$benchmarkScript" "$graphqlEndpoint" >/dev/null - sleep 1 - bash "$benchmarkScript" "$graphqlEndpoint" >/dev/null - sleep 1 + # Warmup run + bash "$benchmarkScript" "$graphqlEndpoint" >/dev/null + sleep 1 # Give some time for apps to finish in-flight requests from warmup + bash "$benchmarkScript" "$graphqlEndpoint" >/dev/null + sleep 1 + bash "$benchmarkScript" "$graphqlEndpoint" >/dev/null + sleep 1 # 3 benchmark runs for resultFile in "${resultFiles[@]}"; do @@ -69,7 +69,7 @@ function runBenchmark() { rm "results.md" -for service in "apollo_server" "caliban" "netflix_dgs" "gqlgen" "tailcall" "async_graphql"; do +for service in "apollo_server" "caliban" "netflix_dgs" "gqlgen" "tailcall" "async_graphql" "hasura"; do runBenchmark "$service" if [ "$service" == "apollo_server" ]; then cd graphql/apollo_server/