Skip to content

Commit

Permalink
update benchmark
Browse files Browse the repository at this point in the history
Signed-off-by: Sahil Yeole <[email protected]>
  • Loading branch information
beelchester committed Jul 5, 2024
1 parent aa40281 commit 8ae138b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions k6/bench.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand All @@ -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);
Expand Down
20 changes: 10 additions & 10 deletions run_benchmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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/
Expand Down

2 comments on commit 8ae138b

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Query Server Requests/sec Latency (ms) Relative
1 { posts { id userId title user { id name email }}}
[Tailcall] -nan -nan -nanx
[Netflix DGS] -nan -nan -nanx
[Hasura] -nan -nan -nanx
[Gqlgen] -nan -nan -nanx
[Caliban] -nan -nan -nanx
[async-graphql] -nan -nan -nanx
[Apollo GraphQL] -nan -nan -nanx
2 { posts { title }}
[Tailcall] -nan -nan -nanx
[Netflix DGS] -nan -nan -nanx
[Hasura] -nan -nan -nanx
[Gqlgen] -nan -nan -nanx
[Caliban] -nan -nan -nanx
[async-graphql] -nan -nan -nanx
[Apollo GraphQL] -nan -nan -nanx

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Query Server Requests/sec Latency (ms) Relative
1 { posts { id userId title user { id name email }}}
[Tailcall] -nan -nan -nanx
[Netflix DGS] -nan -nan -nanx
[Hasura] -nan -nan -nanx
[Gqlgen] -nan -nan -nanx
[Caliban] -nan -nan -nanx
[async-graphql] -nan -nan -nanx
[Apollo GraphQL] -nan -nan -nanx
2 { posts { title }}
[Tailcall] -nan -nan -nanx
[Netflix DGS] -nan -nan -nanx
[Hasura] -nan -nan -nanx
[Gqlgen] -nan -nan -nanx
[Caliban] -nan -nan -nanx
[async-graphql] -nan -nan -nanx
[Apollo GraphQL] -nan -nan -nanx

Please sign in to comment.