4d745f203e
Implement data-driven optimization using actual server metrics instead of thresholds: NEW FEATURES: - lib/php-analytics.sh: Analytics engine for domain profiling • analyze_memory_errors_from_logs: Parse error logs for memory exhaustion • analyze_process_memory_usage: Measure actual PHP process memory via ps • get_peak_concurrent_detailed: Extract peak concurrent requests from access logs • detect_memory_leak_pattern: Identify domains with memory leak issues • build_domain_profile: Complete profile with all real usage data • Intelligent recommendations based on ACTUAL peak memory, traffic, and leak patterns - modules/performance/php-domain-analyzer.sh: Pre-analysis script • Scans all domains and builds comprehensive profiles • Stores profiles in /tmp/php-domain-profiles/ for use by optimizer • Shows summary with top memory users, traffic patterns, and potential leaks • Displays analysis in real-time with progress indicators - php-optimizer.sh: Profile-based optimization levels • Option 0: Run pre-analysis to collect real usage data • Levels 1-5: Now use profile-based recommendations (fallback to traffic-based if no profiles) • Shows real usage data from profiles when optimizations applied • Memory recommendations: peak_memory_seen + 20% buffer • Max children: peak_concurrent_requests + 30% safety margin • Max requests: 250 for leak-prone domains, 500 for normal domains ARCHITECTURE: - Profile format (pipe-delimited): domain|username|peak_concurrent|avg_concurrent| total_hits|min_mem|max_mem|avg_mem|proc_count|mem_exhausted|peak_mem_seen| leak_type|current_memory_limit|current_max_children - Profiles cached in /tmp/php-domain-profiles/ (24 hour TTL) - All 5 optimization levels now profile-aware - Seamless fallback to traffic-based method if no profiles exist CONVERSION COMPLETED: - Level 1: Optimizes pm.max_children only (profile-aware) - Level 2: pm.max_children + memory_limit (profile-aware) - Level 3: All of above + pm.max_requests for leak prevention (profile-aware) - Level 4: OPcache optimization (unchanged) - Level 5: Complete optimization with all settings (NOW PROFILE-AWARE - FIXED) All levels now enumeraate users/domains directly and use profile recommendations when available, with intelligent fallback to the original traffic-based method. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>