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 <noreply@anthropic.com>
This commit is contained in:
@@ -82,6 +82,7 @@ declare -a current_max_children
|
|||||||
declare -a recommended_max_children
|
declare -a recommended_max_children
|
||||||
declare -a memory_impact
|
declare -a memory_impact
|
||||||
declare -a needs_optimization
|
declare -a needs_optimization
|
||||||
|
declare -a peak_concurrent
|
||||||
|
|
||||||
TOTAL_DOMAINS=0
|
TOTAL_DOMAINS=0
|
||||||
TOTAL_CURRENT_MEMORY=0
|
TOTAL_CURRENT_MEMORY=0
|
||||||
@@ -126,6 +127,11 @@ while IFS= read -r username; do
|
|||||||
impact=$((current_memory - recommended_memory))
|
impact=$((current_memory - recommended_memory))
|
||||||
memory_impact[$TOTAL_DOMAINS]="$impact"
|
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
|
# Track totals
|
||||||
TOTAL_CURRENT_MEMORY=$((TOTAL_CURRENT_MEMORY + current_memory))
|
TOTAL_CURRENT_MEMORY=$((TOTAL_CURRENT_MEMORY + current_memory))
|
||||||
TOTAL_RECOMMENDED_MEMORY=$((TOTAL_RECOMMENDED_MEMORY + recommended_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]}"
|
recommended="${recommended_max_children[$idx]}"
|
||||||
impact="${memory_impact[$idx]}"
|
impact="${memory_impact[$idx]}"
|
||||||
optimize="${needs_optimization[$idx]}"
|
optimize="${needs_optimization[$idx]}"
|
||||||
|
peak="${peak_concurrent[$idx]}"
|
||||||
|
|
||||||
if [ "$current" == "ERROR" ]; then
|
if [ "$current" == "ERROR" ]; then
|
||||||
continue
|
continue
|
||||||
@@ -162,6 +169,7 @@ for idx in $(seq 1 $TOTAL_DOMAINS); do
|
|||||||
if [ "$optimize" == "YES" ]; then
|
if [ "$optimize" == "YES" ]; then
|
||||||
cecho "${YELLOW}[$idx]${NC} $domain"
|
cecho "${YELLOW}[$idx]${NC} $domain"
|
||||||
cecho " Owner: $owner"
|
cecho " Owner: $owner"
|
||||||
|
cecho " Peak concurrent requests: ${WHITE}$peak${NC}"
|
||||||
cecho " Current max_children: ${RED}$current${NC} → Recommended: ${GREEN}$recommended${NC}"
|
cecho " Current max_children: ${RED}$current${NC} → Recommended: ${GREEN}$recommended${NC}"
|
||||||
cecho " Memory impact: ${GREEN}+${impact}MB${NC} if optimized"
|
cecho " Memory impact: ${GREEN}+${impact}MB${NC} if optimized"
|
||||||
cecho " Status: ${YELLOW}NEEDS OPTIMIZATION${NC}"
|
cecho " Status: ${YELLOW}NEEDS OPTIMIZATION${NC}"
|
||||||
@@ -169,6 +177,7 @@ for idx in $(seq 1 $TOTAL_DOMAINS); do
|
|||||||
else
|
else
|
||||||
cecho "${GREEN}[$idx]${NC} $domain"
|
cecho "${GREEN}[$idx]${NC} $domain"
|
||||||
cecho " Owner: $owner"
|
cecho " Owner: $owner"
|
||||||
|
cecho " Peak concurrent requests: ${WHITE}$peak${NC}"
|
||||||
cecho " max_children: $current (already optimized)"
|
cecho " max_children: $current (already optimized)"
|
||||||
cecho " Status: ${GREEN}OK${NC}"
|
cecho " Status: ${GREEN}OK${NC}"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user