Skip to content

Commit 9ba47a8

Browse files
szachovyCopilot
andcommitted
Add performance benchmarking script
Create scripts/benchmark.sh for login throughput, dashboard API latency, and Redis latency measurements. Accepts VIP address as argument. Manual diagnostic tool, not added to CI. Closes #84 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 0ab8ce7 commit 9ba47a8

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
* Dependabot updates for `github-actions` and `terraform` ecosystems. (#29)
1616
* CI workflow to build and push service images to GitHub Container Registry on master merge. (#97)
1717
* Pull-first with local build fallback for container images during deployment. (#97)
18+
* Performance benchmarking script for login throughput and API latency. (#84)
1819

1920
### Changed
2021

scripts/benchmark.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
VIP="${1:?Usage: $0 <virtual-ip-address>}"
6+
SUPERSET_URL="https://${VIP}"
7+
ITERATIONS="${2:-50}"
8+
9+
echo "=== Superset Cluster Benchmark ==="
10+
echo "Target: ${SUPERSET_URL}"
11+
echo "Iterations: ${ITERATIONS}"
12+
echo
13+
14+
echo "--- Login throughput ---"
15+
LOGIN_PAYLOAD='{"username":"superset","password":"cluster","provider":"db","refresh":true}'
16+
START=$(date +%s%N)
17+
for i in $(seq 1 "${ITERATIONS}"); do
18+
curl --silent --insecure --output /dev/null --write-out "%{http_code} %{time_total}s\n" \
19+
--url "${SUPERSET_URL}/api/v1/security/login" \
20+
--header "Content-Type: application/json" \
21+
--data "${LOGIN_PAYLOAD}"
22+
done
23+
END=$(date +%s%N)
24+
echo "Total: $(( (END - START) / 1000000 ))ms for ${ITERATIONS} requests"
25+
echo
26+
27+
echo "--- Dashboard API latency ---"
28+
TOKEN=$(curl --silent --insecure \
29+
--url "${SUPERSET_URL}/api/v1/security/login" \
30+
--header "Content-Type: application/json" \
31+
--data "${LOGIN_PAYLOAD}" | python3 -c "import sys,json; print(json.load(sys.stdin)['access_token'])")
32+
33+
for endpoint in "/api/v1/dashboard/" "/api/v1/database/" "/api/v1/chart/"; do
34+
echo -n "${endpoint}: "
35+
curl --silent --insecure --output /dev/null --write-out "%{time_total}s\n" \
36+
--url "${SUPERSET_URL}${endpoint}" \
37+
--header "Authorization: Bearer ${TOKEN}"
38+
done
39+
echo
40+
41+
echo "--- Redis latency (from mgmt node) ---"
42+
ssh superset@node-0 "docker exec redis redis-cli --latency-history --latency-dist -i 1 2>/dev/null | head -5" \
43+
2>/dev/null || echo "Redis latency check requires SSH access to node-0"
44+
echo
45+
echo "=== Benchmark complete ==="

0 commit comments

Comments
 (0)