Server Tuning & Optimization
a. Adjust Swappiness
Lower the swappiness value to improve system performance:
sudo echo "vm.swappiness = 5" >> /etc/sysctl.conf && sudo sysctl -p && sudo swapoff -a && sudo swapon -a
b. Set Up ZRAM
Improve memory utilization by compressing swap in RAM:
sudo apt install -y -f zram-tools && sudo echo "ALGO=lz4" >> /etc/default/zramswap && sudo echo "PERCENT=30" >> /etc/default/zramswap && sudo echo "PRIORITY=1" >> /etc/default/zramswap && sudo systemctl restart zramswap.service && sudo systemctl enable zramswap.service
c. Configure the Firewall
Secure your server by allowing SSH and NGINX traffic:
sudo apt install -y -f ufw && sudo ufw allow ssh && sudo ufw allow 'Nginx Full' && sudo ufw delete allow 'Nginx HTTP' && sudo ufw --force enable && sudo ufw reload && sudo ufw status
d. Clean Temporary Files
Set up a cron job to periodically delete temporary files:
(crontab -l 2>/dev/null; echo "0 */12 * * * sudo find /tmp -type f -atime +1 -delete") | crontab -
e. Tune System Performance
Apply a high-throughput profile with the tuned utility:
sudo apt install -y -f tuned && sudo tuned-adm profile throughput-performance && sudo tuned-adm active && sudo systemctl restart tuned.service && sudo systemctl enable tuned.service
Server performance optimizations for Odoo