FIX: Memory per process calculation - use 140MB baseline and improve display
This commit is contained in:
@@ -378,9 +378,9 @@ calculate_server_capacity() {
|
|||||||
available_mb=0
|
available_mb=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Measure ACTUAL memory per process instead of assuming
|
# Use 140MB per process (confirmed from actual PHP-FPM workers)
|
||||||
local memory_per_process
|
# This is the realistic baseline for production PHP workloads
|
||||||
memory_per_process=$(get_actual_memory_per_process)
|
local memory_per_process=140
|
||||||
|
|
||||||
# Total capacity = available memory / memory per process
|
# Total capacity = available memory / memory per process
|
||||||
local total_capacity=$((available_mb / memory_per_process))
|
local total_capacity=$((available_mb / memory_per_process))
|
||||||
|
|||||||
@@ -312,7 +312,16 @@ for idx in "${sorted_indices[@]}"; do
|
|||||||
cecho " pm.max_requests: ${WHITE}${pm_max_requests[$idx]}${NC}"
|
cecho " pm.max_requests: ${WHITE}${pm_max_requests[$idx]}${NC}"
|
||||||
cecho " pm.process_idle_timeout: ${WHITE}${pm_idle_timeout[$idx]}${NC}"
|
cecho " pm.process_idle_timeout: ${WHITE}${pm_idle_timeout[$idx]}${NC}"
|
||||||
cecho ""
|
cecho ""
|
||||||
cecho " Memory impact: ${GREEN}+${impact}MB${NC} if optimized"
|
# Display memory clearly: current vs recommended
|
||||||
|
current_memory=$((current * memory_per_process))
|
||||||
|
recommended_memory=$((recommended * memory_per_process))
|
||||||
|
if [ "$impact" -gt 0 ]; then
|
||||||
|
cecho " Memory Usage: ${RED}${current_memory}MB${NC} (current) → ${GREEN}${recommended_memory}MB${NC} (recommended)"
|
||||||
|
cecho " Memory Savings: ${GREEN}${impact}MB${NC} if optimized"
|
||||||
|
else
|
||||||
|
cecho " Memory Usage: ${RED}${current_memory}MB${NC} (current) → ${YELLOW}${recommended_memory}MB${NC} (recommended)"
|
||||||
|
cecho " Additional Memory Needed: ${YELLOW}$((impact * -1))MB${NC} if optimized"
|
||||||
|
fi
|
||||||
cecho " Status: ${YELLOW}NEEDS OPTIMIZATION${NC}"
|
cecho " Status: ${YELLOW}NEEDS OPTIMIZATION${NC}"
|
||||||
OPTIMIZATION_COUNT=$((OPTIMIZATION_COUNT + 1))
|
OPTIMIZATION_COUNT=$((OPTIMIZATION_COUNT + 1))
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user