Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a really simple QN benchmarking script #5135

Merged
merged 2 commits into from
Apr 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions query-node/benchmark.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/sh

# Run for T seconds
T=60

# Pass the endpoint as the first argument, default to local
endpoint=${1:-'http://localhost:8081/graphql'}

invalidWhen=".errors != null or (.data.proposals | length == 0)"
query=$(
cat <<EOF | awk '{ print NR == 1 ? "" : "\\n" } 1' ORS=''
{"query":"{
proposals (
# Check filter/order performance too
where: { status_json: { isTypeOf_eq: \"ProposalStatusExecuted\" } }
orderBy: createdAt_DESC
) {
id
createdInEvent { id inBlock }
status { __typename }
creator {
createdAt
referredMembers { id }
proposalvotedeventvoter {
id
inBlock
}
}
proposalStatusUpdates {
type
}
votes {
inBlock
voteKind
rationale
}
}
}"}
EOF
)

SEC=1000000000
i=-1

until=$(($(date +%s%N) + $T * $SEC))
while [ $(date +%s%N) -lt $until ]; do
i=$((i + 1))
res=$(curl -s "$endpoint" -H 'Content-Type: application/json' --data-binary "$query")
if $(echo "$res" | jq -e "$invalidWhen"); then
echo "Failed with response $res"
exit 1
fi
done

echo "Sent $i queries in $T seconds"
Loading