Düşük RAM'li bir VPS üzerinde swap, bellek tükenmesi (OOM) sonlandırmalarını azaltır. Bu rehber bir swap dosyası eklemenizi sağlar.
📋 Ön koşullar
- root/sudo erişimli Linux VPS
- Boş disk alanı (ör. 2 GB swap dosyası için 2 GB)
RAM ve mevcut swap'ı kontrol edin
Bashfree -h swapon --show
2 GB swap dosyası oluşturun
Bashsudo fallocate -l 2G /swapfile sudo chmod 600 /swapfile sudo mkswap /swapfile sudo swapon /swapfile
Önyüklemede etkinleştirin
Bashecho '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
Swappiness ayarı (isteğe bağlı)
VPS'ler için 10–30 genellikle daha iyidir:
Bashecho 'vm.swappiness=20' | sudo tee /etc/sysctl.d/99-swappiness.conf sudo sysctl -p /etc/sysctl.d/99-swappiness.conf
Daha kararlı bir sunucu! 🚀