CRITICAL FIX: Correct MySQL memory field extraction
The calculate_server_capacity() function was extracting the wrong field from detect_mysql_memory_usage(), causing incorrect available memory calculations and resulting in 0 max_children recommendations. Bug: Was extracting field 1 (buffer_pool_mb) Fix: Now extracts field 3 (estimated_total_mb - actual usage) detect_mysql_memory_usage returns: buffer_pool|connections|total_mb|status This fix allows Level 5 optimization to correctly calculate PHP-FPM capacity and make proper recommendations instead of recommending 0.
This commit is contained in:
@@ -122,8 +122,9 @@ calculate_max_children_memory_based() {
|
||||
local mysql_info
|
||||
mysql_info=$(detect_mysql_memory_usage 2>/dev/null)
|
||||
if [ $? -eq 0 ]; then
|
||||
# FIX: detect_mysql_memory_usage returns: memory|status (only 2 fields)
|
||||
mysql_memory_mb=$(echo "$mysql_info" | cut -d'|' -f1)
|
||||
# FIX: detect_mysql_memory_usage returns: buffer_pool|connections|estimated_total_mb|status (4 fields)
|
||||
# Extract field 3 (estimated_total_mb - the actual memory usage)
|
||||
mysql_memory_mb=$(echo "$mysql_info" | cut -d'|' -f3)
|
||||
fi
|
||||
|
||||
# Available memory for PHP-FPM (after system + MySQL reserves)
|
||||
@@ -372,8 +373,9 @@ calculate_server_capacity() {
|
||||
local mysql_info
|
||||
mysql_info=$(detect_mysql_memory_usage 2>/dev/null)
|
||||
if [ $? -eq 0 ]; then
|
||||
# FIX: detect_mysql_memory_usage returns: memory|status (only 2 fields)
|
||||
mysql_memory_mb=$(echo "$mysql_info" | cut -d'|' -f1)
|
||||
# FIX: detect_mysql_memory_usage returns: buffer_pool|connections|estimated_total_mb|status (4 fields)
|
||||
# Extract field 3 (estimated_total_mb - the actual memory usage)
|
||||
mysql_memory_mb=$(echo "$mysql_info" | cut -d'|' -f3)
|
||||
fi
|
||||
|
||||
# Available memory for PHP-FPM (after system + MySQL reserves)
|
||||
|
||||
Reference in New Issue
Block a user