Saturated swap file after 15 days

*** Nethserver 7.9 ****
Hello everyone, my neth server, works perfectly in the production of its services. The only problem I can’t solve is the dimesione of the swap file that increases to 100% saturate after 15 days. In the past I have read that it is possible to shell reset it without needing an action on the server to restart . Can someone give me guidance on how to mitigate this problem?

Hi, try following these instructions.

Keep in mind that you must have as much free space in ram as the size of the swap.

Which is the ram size of your host?

The memory is 4 GB

If the hardware is older than 4 years, consider to upgrade to 8gb.
If the hardware have 4 years or less, consider to upgrade 16gb.
It’s not the answer to your question, but maybe it will achieve both better performance and the resolution to the issue.

Linux maybe is not doing best of the best in recycling memory or swap file, but if it’s using that much, maybe more RAM is needed.

1 Like

Thanks , the machine is a VM on proxmox cluster .

I tried to increase to 8Gb does not change the state of affairs. In addition, the swap reaches 100% despite the system with 4GB uses only 2.5 GB at most.

That info was interesting in the first post. However…

Would you please post the output of cat /proc/sys/vm/swappiness, please?
Standard CentOS 7 value should be 30, I don’t know if Nethserver tweaks the default value.

Yes, I confirm it’s 30

Source

You should be able to use the command sysctl vm.swappiness=%% for changing the value of swappiness (replace %% with the number). My installation was set to 60, now I changed to 30; the higher the number the higher the “aggressivity” on kernel will try to clean the memory
I don’t know if this is the most proper way to setup the swappiness in CentOS 7, or the setting will survive to a reboot.

However, i’d suggest you:

  • Mantain 8gb of ram to your ProxMOX VM
  • Lower swappines in steps of 5 and let it cook at least for a week before tweak it again
  • After a proper value for your desire is found, reboot at check if the setting survived; check the CentOS 7 documentation and NethServer documentation to find the proper and safe way to configure it (In a way that can survive also a backup)

Last but not least: did you “overbooked” your ProxMox host RAM in VMs?

Where can I check this parameter?

I’d do a simple calc:

Total host ram - guest 1 ram - guest 2 ram (repeat for every guest) and the total should still left some RAM for proxmox…
If the result is zero or less, your ram is “overbooked” (More ram allotment to guests than available to the hosts… it’s a cluster?).
I’d check also proxmox documentation for the best practice about Ram allotment

Yes, I think I understand, however the management and baloon of the ram
This is the cluster :slight_smile:



Which tell nothing about ram allotment? Anyway… IMVHO is a task that should be done verifying the use of ram for all hosts for the guests assigned. :man_shrugging:t2:

Thanks anyway for your intervention, I will try to investigate better because I understand up to a certain point.

The only thing I have activated for linux vm is the baloon that works well as the memory released by the guests is correct, but the swap file goes its way …

Hi @france

I do hope you’re aware of the main reason WHY Balloon Memory should NOT be used on “Servers”…
If memory goes short (It will, with only 4 GB!), Ballooning will take away RAM from the host (VM).

And, ballooning will just take away the RAM, without reporting to the OS in advance…
This kills applications, mostly databases - and lose users data! (Note the plurality of users, this does not happen on a “workstation”, as only one user works on a workstation concurrently…).

For a NethServer as AD, especially in a business environment, you need 8 GB RAM to be halfway productive!

Note: Virtual RAM is MUCH cheaper than employees salaries, and they’re being paid to twiddle their thumbs (Do nothing while the system makes them wait)…

I’ve heard people claim their NethServer with 4 GB RAM is running (including memory hungry apps like Nextcloud!), but to be honest, either these users have never seen anything better. (The sort which will buy a notebook with 8-16 GB RAM, but allocate 4 GB RAM for the server…)

Give that same VM server on a decent host hypervisor 16 GB RAM, 8 CPU cores and storage based on virtual SSD running on real SSDs (or better!), all using VirtIO drivers… Now, that’s more like what I call running… Anyhing less is more crawling…

:slight_smile:

My 2 cents
Andy

2 Likes

Few months ago I explained to a customer why it costs so much doing a lot of things on the current server (6yo, neither server CPU, 8gb of ram)
“Older the hardware, lesser the performance, bigger the time spent waiting end of operations like updates, backup, hi volume upload”.
Did not enjoy that, but changed heart for a shorter term upgrade.

1 Like

╭─stephdl@leo-net ~ ‹master›
╰─➤ cat /proc/sys/vm/swappiness
10

on my laptop with 40G of ram I do not want swapping, I tend to do quite the same on my server (sure 30 is a safe value), swapping is the last thing to do.

1 Like

I wanted to update the situation regarding the swap.

11 days have passed and after considerably increasing the memory, the swal file keeps at not even 100 MB, so what you suggested is fine. Thank you all .