Fix batch analyzer to flag domains needing optimization increases
ISSUE: Batch analyzer only flagged domains for optimization when recommended < current (only reductions). Domains needing INCREASES were marked "OK" even with: • Critical traffic (73 concurrent requests) • Severely undersized configuration (5 max_children) EXAMPLE: Current: 5, Recommended: 20, Traffic: 73 concurrent Old: Status "OK" (no change detected) New: Status "NEEDS OPTIMIZATION" (recognized undersizing) FIX: - Flag optimization when recommended != current - ONLY if change is meaningful: • Has significant traffic (>= 5 concurrent requests) OR • Offers significant memory savings (>= 20% reduction) RATIONALE: - Domains with critical traffic should be optimized even if it increases max_children - Undersized configurations are just as problematic as oversized ones - Users need to see both increases and decreases in optimization recommendations This ensures the batch analyzer surfaces all actionable optimization opportunities. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -159,11 +159,28 @@ while IFS= read -r username; do
|
|||||||
TOTAL_CURRENT_MEMORY_WITH_MAX=$((TOTAL_CURRENT_MEMORY_WITH_MAX + current_memory))
|
TOTAL_CURRENT_MEMORY_WITH_MAX=$((TOTAL_CURRENT_MEMORY_WITH_MAX + current_memory))
|
||||||
|
|
||||||
# Determine if optimization needed
|
# Determine if optimization needed
|
||||||
|
# Flag as YES if: different from current (increase or decrease)
|
||||||
|
# AND has meaningful traffic (>= 5 concurrent) OR memory efficiency gain (> 20% reduction)
|
||||||
|
local memory_reduction=0
|
||||||
if [ "$recommended" -lt "$current" ]; then
|
if [ "$recommended" -lt "$current" ]; then
|
||||||
|
memory_reduction=$(( (current - recommended) * 100 / current ))
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$recommended" -ne "$current" ]; then
|
||||||
|
# Check if change is meaningful:
|
||||||
|
# 1. Has significant traffic (>= 5 concurrent requests)
|
||||||
|
# 2. OR significant memory reduction (>= 20%)
|
||||||
|
local has_traffic=0
|
||||||
|
[ "$peak" != "?" ] && [ "$peak" -ge 5 ] && has_traffic=1
|
||||||
|
|
||||||
|
if [ "$has_traffic" = "1" ] || [ "$memory_reduction" -ge 20 ]; then
|
||||||
needs_optimization[$TOTAL_DOMAINS]="YES"
|
needs_optimization[$TOTAL_DOMAINS]="YES"
|
||||||
else
|
else
|
||||||
needs_optimization[$TOTAL_DOMAINS]="NO"
|
needs_optimization[$TOTAL_DOMAINS]="NO"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
needs_optimization[$TOTAL_DOMAINS]="NO"
|
||||||
|
fi
|
||||||
|
|
||||||
done <<< "$user_domains"
|
done <<< "$user_domains"
|
||||||
done <<< "$users"
|
done <<< "$users"
|
||||||
|
|||||||
Reference in New Issue
Block a user