Update docker/bench/run-ab.sh
This commit is contained in:
		
							parent
							
								
									5af5829ce2
								
							
						
					
					
						commit
						4243f737ac
					
				|  | @ -124,10 +124,10 @@ run_ab() { | |||
|     local result=$(ab -n $NUM_REQUESTS -c $CONCURRENCY "$url" 2>&1) | ||||
|     local avg_time=$(echo "$result" | grep 'Time per request' | head -1 | awk '{print $4}') | ||||
|     if [ -z "$avg_time" ] || [ "$(echo "$avg_time > ($MAX_TIME + $VARIANCE) * 1000" | bc)" -eq 1 ]; then | ||||
|         echo "ApacheBench test failed for $url. Average time: ${avg_time:-N/A} milliseconds." | ||||
|         echo "ApacheBench test failed for $url Average time: ${avg_time:-N/A} milliseconds" | ||||
|         return 1 | ||||
|     else | ||||
|         echo "ApacheBench test passed for $url. Average time: $avg_time milliseconds." | ||||
|         echo "ApacheBench test passed for $url Average time: $avg_time milliseconds" | ||||
|         return 0 | ||||
|     fi | ||||
| } | ||||
|  | @ -141,10 +141,10 @@ IFS=',' read -ra URLS <<< "$TARGET_URLS" | |||
| for url in "${URLS[@]}"; do | ||||
|     mean_ttfb=$(measure_ttfb "$url") | ||||
|     if [ -z "$mean_ttfb" ] || [ "$(echo "$mean_ttfb > $TTFB_MAX" | bc)" -eq 1 ]; then | ||||
|         echo "TTFB test failed for $url. Mean TTFB: ${mean_ttfb}ms exceeds maximum of ${TTFB_MAX}ms." | tee -a "$log_file" | ||||
|         echo "TTFB test failed for $url Mean TTFB: ${mean_ttfb}ms exceeds maximum of ${TTFB_MAX}ms" | tee -a "$log_file" | ||||
|         failed_urls+=("TTFB failure: $url") | ||||
|     else | ||||
|         echo "TTFB test passed for $url. Mean TTFB: ${mean_ttfb}ms." | tee -a "$log_file" | ||||
|         echo "TTFB test passed for $url Mean TTFB: ${mean_ttfb}ms" | tee -a "$log_file" | ||||
|     fi | ||||
|     run_ab_result=$(run_ab "$url") | ||||
|     echo "$run_ab_result" | tee -a "$log_file" | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 colin
						colin