Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Our servers typically have a lot of memory cached and run high on memory utilized. If I have space available and am low on free can I do a swapoff/swap on clear the swap space used?
Below is a sample free from my environment.
total used free shared buff/cache available
Mem: 251G 53G 2.0G 10G 196G 187G
Swap: 2.0G 1.8G 246M
I'm not sure how you think having 187g available RAM is low? And you're only swapping 2g of 4g total, so I don't think you're in a crisis. Or am I missing something?
You might want to read about swappiness settings.
(I'm apparently a bit behind on my "latest tech" knowledge. I didn't know we have hardware that supports 256G RAM! Is this a virtual server?)
If you still running CentOS, RHEL recommends at least 4G swap for systems >64 GB memory but it depends on what you are running and how you are using this PC. You can easily add swap space by adding a new swap partition, swap file, or extending your existing swap space.
Also, even though the system is using a bunch of memory as cache you are not running out. https://www.linuxatemyram.com/
It is perfect as it is.
Is your problem the monitoring?
Alert threshold should be based on the sum of RAM and swap (that makes the virtual memory); thresholds on only RAM or only swap are pointless.
But yes, you can temporarily delete your swap. It will take a while, because the on-swap pages must be shuffled into the RAM, and the Linux kernel is slow with this.
There is almost always no reason to swapoff in normal operation. I only do it when doing multiple runs for benchmarking. Hardly normal operation. Note the info in the link in post #3.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.