# 🚀 Optimizing Linux Swappiness

#   


By default, Linux has a "swappiness" value of 60. Lowering this to **10** tells the kernel to avoid using the slow disk swap and prioritize the fast physical RAM, which is critical for Wazuh Indexer performance.

<div class="page-content" id="bkmrk-1" style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; line-height: 1.5; color: #24292e;"><div style="margin-top: 24px;"><div style="display: flex; align-items: flex-start; margin-bottom: 24px;"><div style="background-color: #206afb; color: white; border-radius: 50%; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; font-weight: bold; margin-right: 12px; flex-shrink: 0;">1</div><div style="flex-grow: 1;">  
</div></div></div></div>### Check Current Swappiness

Run this command to see your current value. It will likely return `60`.

```
sudo cat /proc/sys/vm/swappiness
```

<div class="page-content" id="bkmrk-2" style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; line-height: 1.5; color: #24292e;"><div style="margin-top: 24px;"><div style="display: flex; align-items: flex-start; margin-bottom: 24px;"><div style="flex-grow: 1;">  
</div></div><div style="display: flex; align-items: flex-start; margin-bottom: 24px;"><div style="background-color: #206afb; color: white; border-radius: 50%; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; font-weight: bold; margin-right: 12px; flex-shrink: 0;">2</div><div style="flex-grow: 1;">  
</div></div></div></div>### Apply Immediate Change

Use the `sysctl` command to lower the value to 10 instantly without a reboot.

```
sudo sysctl vm.swappiness=10
```

<div class="page-content" id="bkmrk-3" style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; line-height: 1.5; color: #24292e;"><div style="margin-top: 24px;"><div style="display: flex; align-items: flex-start; margin-bottom: 24px;"><div style="flex-grow: 1;">  
</div></div><div style="display: flex; align-items: flex-start; margin-bottom: 24px;"><div style="background-color: #206afb; color: white; border-radius: 50%; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; font-weight: bold; margin-right: 12px; flex-shrink: 0;">3</div><div style="flex-grow: 1;">  
</div></div></div></div>### Make Change Permanent

Add the configuration to `/etc/sysctl.conf` so the setting persists after the VM reboots.

```
sudo echo 'vm.swappiness=10' | sudo tee -a /etc/sysctl.conf
```

<div class="page-content" id="bkmrk-" style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; line-height: 1.5; color: #24292e;"><div style="margin-top: 24px;"><div style="display: flex; align-items: flex-start; margin-bottom: 24px;"><div style="flex-grow: 1;">  
</div></div></div><div style="margin-top: 32px; padding: 16px; background-color: #e7f3ff; border: 1px solid #d1d5da; border-left: 6px solid #206afb; border-radius: 6px;">  
</div></div>#### ✅ Verification

You have successfully reduced disk I/O wait times for the Wazuh Indexer. This helps prevent the VM from hanging when memory usage spikes during large data ingestions.