run-benchmark.sh (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
#!/bin/bash # Run benchmark and save output hey -n 1000 -c 50 -m GET http://localhost:5001/ >benchmark_results.txt # Extract metrics (adjust grep patterns if needed) REQUESTS_PER_SEC=$(grep "Requests/sec:" benchmark_results.txt | awk '{print $2}') AVG_RESPONSE=$(grep "Average:" benchmark_results.txt | awk '{print $2}') # Calculate score SCORE=$(echo "scale=2; ($REQUESTS_PER_SEC / $AVG_RESPONSE) * 100" | bc) # Output results echo "===== BENCHMARK RESULTS =====" echo "Requests/sec: $REQUESTS_PER_SEC" echo "Average Response: $AVG_RESPONSE seconds" echo "BENCHMARK SCORE: $SCORE" echo "============================" |