From ea14ff2bdcb6a62331194d31007531fbdd47bf40 Mon Sep 17 00:00:00 2001 From: MacRimi Date: Tue, 13 May 2025 17:01:25 +0200 Subject: [PATCH] Update customizable_post_install.sh --- scripts/customizable_post_install.sh | 50 ++++++++++++++++------------ 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/scripts/customizable_post_install.sh b/scripts/customizable_post_install.sh index 29a71c3..c691c87 100644 --- a/scripts/customizable_post_install.sh +++ b/scripts/customizable_post_install.sh @@ -2033,30 +2033,38 @@ optimize_memory_settings() { local sysctl_conf="/etc/sysctl.d/99-memory.conf" - # Check if the configuration file already exists and has the correct content - if [ -f "$sysctl_conf" ] && \ - grep -q "Memory Optimising" "$sysctl_conf" && \ - grep -q "vm.min_free_kbytes = 1048576" "$sysctl_conf" && \ - grep -q "vm.nr_hugepages = 2000" "$sysctl_conf" && \ - grep -q "vm.max_map_count = 1048576" "$sysctl_conf" && \ - grep -q "vm.overcommit_memory = 1" "$sysctl_conf"; then - msg_ok "$(translate "Memory settings already optimized")" + + if [ -f "$sysctl_conf" ] && grep -q "Memory Optimising" "$sysctl_conf"; then + msg_info "$(translate "Old memory configuration detected. Replacing with balanced optimization...")" else - msg_info "$(translate "Applying memory optimization settings...")" - # Create or update the configuration file - cat < "$sysctl_conf" -# Memory Optimising -## Bugfix: reserve 1024MB memory for system -vm.min_free_kbytes = 1048576 -vm.nr_hugepages = 2000 -# (Redis/MongoDB) -vm.max_map_count = 1048576 -vm.overcommit_memory = 1 -EOF - msg_ok "$(translate "Memory settings optimized successfully")" + msg_info "$(translate "Applying balanced memory optimization settings...")" fi - msg_success "$(translate "Memory optimization completed")" + cat < "$sysctl_conf" +# Balanced Memory Optimization +# Improve responsiveness without excessive memory reservation + +# Avoid unnecessary swapping +vm.swappiness = 10 + +# Lower dirty memory thresholds to free memory faster +vm.dirty_ratio = 15 +vm.dirty_background_ratio = 5 + +# Allow memory overcommit to reduce allocation issues +vm.overcommit_memory = 1 + +# Avoid excessive virtual memory areas (safe for most applications) +vm.max_map_count = 65530 +EOF + + if [ -f /proc/sys/vm/compaction_proactiveness ]; then + echo "vm.compaction_proactiveness = 20" >> "$sysctl_conf" + msg_ok "$(translate "Enabled memory compaction proactiveness")" + fi + + msg_ok "$(translate "Memory settings optimized successfully")" + msg_success "$(translate "Memory optimization completed.")" }