@@ -7,6 +7,7 @@ cd "$ROOT_DIR"
77
88GCANNON=" ${GCANNON:-/ home/ diogo/ Desktop/ Socket/ gcannon/ gcannon} "
99H2LOAD=" ${H2LOAD:- h2load} "
10+ OHA=" ${OHA:- oha} "
1011HARD_NOFILE=$( ulimit -Hn)
1112ulimit -n " $HARD_NOFILE "
1213THREADS=12
@@ -19,16 +20,18 @@ RESULTS_DIR="$ROOT_DIR/results"
1920CERTS_DIR=" $ROOT_DIR /certs"
2021
2122# Profile definitions: pipeline|req_per_conn|cpu_limit|connections|endpoint
22- # endpoint: empty = /baseline11 (raw), "json" = /json (GET), "pipeline" = /pipeline, "h2" = /baseline2 (h2load), "static-h2" = multi-URI h2load
23+ # endpoint: empty = /baseline11 (raw), "json" = /json (GET), "pipeline" = /pipeline, "h2" = /baseline2 (h2load), "static-h2" = multi-URI h2load, "h3" = /baseline2 (oha HTTP/3)
2324declare -A PROFILES=(
2425 [baseline]=" 1|0||512,4096,16384|"
2526 [pipelined]=" 16|0||512,4096,16384|pipeline"
2627 [limited-conn]=" 1|10||512,4096|"
2728 [json]=" 1|0||4096,16384,32768|json"
2829 [baseline-h2]=" 1|0||64,256,1024|h2"
2930 [static-h2]=" 1|0||64,256,1024|static-h2"
31+ [baseline-h3]=" 128|0||64,512|h3"
32+ [static-h3]=" 128|0||64,512|static-h3"
3033)
31- PROFILE_ORDER=(baseline pipelined limited-conn json baseline-h2 static-h2)
34+ PROFILE_ORDER=(baseline pipelined limited-conn json baseline-h2 static-h2 baseline-h3 static-h3 )
3235
3336# Parse flags
3437SAVE_RESULTS=false
@@ -267,7 +270,9 @@ for profile in "${profiles_to_run[@]}"; do
267270
268271 # Wait for server
269272 echo " [wait] Waiting for server..."
270- if [ " $endpoint " = " h2" ] || [ " $endpoint " = " static-h2" ]; then
273+ if [ " $endpoint " = " h3" ] || [ " $endpoint " = " static-h3" ]; then
274+ local_check_url=" https://localhost:$H2PORT /baseline2?a=1&b=1"
275+ elif [ " $endpoint " = " h2" ] || [ " $endpoint " = " static-h2" ]; then
271276 local_check_url=" https://localhost:$H2PORT /static/reset.css"
272277 [ " $endpoint " = " h2" ] && local_check_url=" https://localhost:$H2PORT /baseline2?a=1&b=1"
273278 elif [ " $endpoint " = " json" ]; then
@@ -289,7 +294,25 @@ for profile in "${profiles_to_run[@]}"; do
289294
290295 # Build load generator args based on profile endpoint
291296 USE_H2LOAD=false
292- if [ " $endpoint " = " static-h2" ]; then
297+ USE_OHA=false
298+ if [ " $endpoint " = " static-h3" ]; then
299+ USE_OHA=true
300+ oha_out=$( mktemp)
301+ gc_args=(" $OHA "
302+ " $REQUESTS_DIR /static-h2-uris.txt"
303+ --urls-from-file
304+ --http-version 3 --insecure
305+ -o " $oha_out " --output-format json
306+ -c " $CONNS " -p " $pipeline " -z " $DURATION " )
307+ elif [ " $endpoint " = " h3" ]; then
308+ USE_OHA=true
309+ oha_out=$( mktemp)
310+ gc_args=(" $OHA "
311+ " https://localhost:$H2PORT /baseline2?a=1&b=1"
312+ --http-version 3 --insecure
313+ -o " $oha_out " --output-format json
314+ -c " $CONNS " -p " $pipeline " -z " $DURATION " )
315+ elif [ " $endpoint " = " static-h2" ]; then
293316 USE_H2LOAD=true
294317 gc_args=(" $H2LOAD "
295318 -i " $REQUESTS_DIR /static-h2-uris.txt"
@@ -330,7 +353,11 @@ for profile in "${profiles_to_run[@]}"; do
330353 done &
331354 stats_pid=$!
332355
333- if [ " $USE_H2LOAD " = " true" ]; then
356+ if [ " $USE_OHA " = " true" ]; then
357+ " ${gc_args[@]} " || true
358+ output=$( cat " $oha_out " 2> /dev/null)
359+ rm -f " $oha_out "
360+ elif [ " $USE_H2LOAD " = " true" ]; then
334361 output=$( timeout 45 " ${gc_args[@]} " 2>&1 ) || true
335362 else
336363 output=$( timeout 45 " $GCANNON " " ${gc_args[@]} " 2>&1 ) || true
@@ -345,7 +372,11 @@ for profile in "${profiles_to_run[@]}"; do
345372 echo " $output "
346373 echo " CPU: $avg_cpu | Mem: $peak_mem "
347374
348- if [ " $USE_H2LOAD " = " true" ]; then
375+ if [ " $USE_OHA " = " true" ]; then
376+ # oha JSON: .summary.requestsPerSec
377+ rps_int=$( echo " $output " | python3 -c " import sys,json; d=json.load(sys.stdin); print(int(d['summary']['requestsPerSec']))" 2> /dev/null || echo " 0" )
378+ rps_int=${rps_int:- 0}
379+ elif [ " $USE_H2LOAD " = " true" ]; then
349380 # h2load: "finished in 5.00s, 123456.78 req/s, 45.67MB/s"
350381 rps_int=$( echo " $output " | grep -oP ' finished in [\d.]+s, \K[\d.]+' | cut -d. -f1 || echo " 0" )
351382 rps_int=${rps_int:- 0}
@@ -370,7 +401,12 @@ for profile in "${profiles_to_run[@]}"; do
370401 echo " === Best: ${best_rps} req/s (CPU: $best_cpu , Mem: $best_mem ) ==="
371402
372403 # Extract metrics
373- if [ " $USE_H2LOAD " = " true" ]; then
404+ if [ " $USE_OHA " = " true" ]; then
405+ # oha JSON: .summary.average (seconds), .latencyPercentiles.p99 (seconds)
406+ avg_lat=$( echo " $best_output " | python3 -c " import sys,json; d=json.load(sys.stdin); v=d['summary']['average']; print(f'{v*1e6:.0f}us' if v<0.001 else f'{v*1000:.2f}ms')" 2> /dev/null || echo " —" )
407+ p99_lat=$( echo " $best_output " | python3 -c " import sys,json; d=json.load(sys.stdin); v=d['latencyPercentiles']['p99']; print(f'{v*1e6:.0f}us' if v<0.001 else f'{v*1000:.2f}ms')" 2> /dev/null || echo " —" )
408+ reconnects=" 0"
409+ elif [ " $USE_H2LOAD " = " true" ]; then
374410 # h2load: "time for request: min max mean sd +/-sd" all on one line
375411 avg_lat=$( echo " $best_output " | awk ' /time for request:/{print $6}' )
376412 p99_lat=" $avg_lat " # h2load doesn't report p99; use mean as placeholder
0 commit comments