From ddb8136f7980b78f9e718c378267baebfe92ac0f Mon Sep 17 00:00:00 2001 From: cschantz Date: Tue, 17 Feb 2026 23:00:28 -0500 Subject: [PATCH] Add traffic analysis (peak concurrent requests) to batch analyzer - Display peak concurrent requests for each domain - Helps identify which domains are busiest - Provides context for optimization decisions - Uses get_domain_peak_concurrent from php-scanner module - Shows traffic alongside current/recommended max_children Co-Authored-By: Claude Haiku 4.5 --- modules/performance/php-fpm-batch-analyzer.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/performance/php-fpm-batch-analyzer.sh b/modules/performance/php-fpm-batch-analyzer.sh index c00ea72..10f9ec5 100755 --- a/modules/performance/php-fpm-batch-analyzer.sh +++ b/modules/performance/php-fpm-batch-analyzer.sh @@ -82,6 +82,7 @@ declare -a current_max_children declare -a recommended_max_children declare -a memory_impact declare -a needs_optimization +declare -a peak_concurrent TOTAL_DOMAINS=0 TOTAL_CURRENT_MEMORY=0 @@ -126,6 +127,11 @@ while IFS= read -r username; do impact=$((current_memory - recommended_memory)) memory_impact[$TOTAL_DOMAINS]="$impact" + # Get peak concurrent requests for this domain + local peak + peak=$(get_domain_peak_concurrent "$domain" 2>/dev/null || echo "?") + peak_concurrent[$TOTAL_DOMAINS]="$peak" + # Track totals TOTAL_CURRENT_MEMORY=$((TOTAL_CURRENT_MEMORY + current_memory)) TOTAL_RECOMMENDED_MEMORY=$((TOTAL_RECOMMENDED_MEMORY + recommended_memory)) @@ -153,6 +159,7 @@ for idx in $(seq 1 $TOTAL_DOMAINS); do recommended="${recommended_max_children[$idx]}" impact="${memory_impact[$idx]}" optimize="${needs_optimization[$idx]}" + peak="${peak_concurrent[$idx]}" if [ "$current" == "ERROR" ]; then continue @@ -162,6 +169,7 @@ for idx in $(seq 1 $TOTAL_DOMAINS); do if [ "$optimize" == "YES" ]; then cecho "${YELLOW}[$idx]${NC} $domain" cecho " Owner: $owner" + cecho " Peak concurrent requests: ${WHITE}$peak${NC}" cecho " Current max_children: ${RED}$current${NC} → Recommended: ${GREEN}$recommended${NC}" cecho " Memory impact: ${GREEN}+${impact}MB${NC} if optimized" cecho " Status: ${YELLOW}NEEDS OPTIMIZATION${NC}" @@ -169,6 +177,7 @@ for idx in $(seq 1 $TOTAL_DOMAINS); do else cecho "${GREEN}[$idx]${NC} $domain" cecho " Owner: $owner" + cecho " Peak concurrent requests: ${WHITE}$peak${NC}" cecho " max_children: $current (already optimized)" cecho " Status: ${GREEN}OK${NC}" fi