• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Question increase swap partition on ubuntu 16

Alaa Mansour

Basic Pleskian
Hello everybody,

I have a server with 8GB of RAM, and I keep getting the message:
Advanced monitoring

The swap usage threshold has been exceeded​

now when running this command:
Code:
sudo swapon --show

I get:
Code:
NAME      TYPE      SIZE USED PRIO
/dev/dm-1 partition 1.9G 1.6G   -1

I'm using the VPS of Ionos.com they use SSD disks want to increase the swap space, should I just increase the swap partition? and how to do it?
or should I disable the swap partition and create a swap file? and how to do it?
thank you all very much
 
they told me that they don't do any kind of intervention on the server, as I have complete control over it.
so I would have to do it by myself
 
I wouldn't recommend trying to resize mounted filesystems remotely unless you absolutely know what you're doing, so I guess you're stuck with using a swap file.
See the man pages for mkswap and swapon for how to create and configure such a file. I recommend specifying a lower priority for swapon in fstab because swap file is slower than swap partition.
 
Would not upgrading to more RAM be the correct solution? If you run into swap usage, it is an indication that your RAM is too small. The moment when swap comes into play, the system performance is considerably degraded. Your server can slow down to a point where it feels like it is almost not responding at all. So instead of upgrading the swap space, it may be better to upgrade the RAM.
 
OP didn't write anything about monitoring complaining about RAM usage threshold, so I assume that is not a problem (yet).

Depending on swappiness, linux kernel will swap not recently used application data out in favor of keeping more cache available. This is often faster than keeping code/data in RAM that e.g. is only used at startup/shutdown of that app. So though you have sufficient RAM available or even free (not used for cache/buffers) there may still be swap usage.
 
yeah, as I thought, the "real" RAM usage does not exceed half of physical RAM, the kernel is just swapping out pages it doesn't use much in favor of having more cache during the backup. You can see those pages aren't really needed as they stay swapped out even after cache goes back down after 2:00. If they were accessed, they would be swapped back in.
So, nothing to worry about, just the kernel optimizing use of the available ressources.
 
Back
Top