LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 05-23-2022, 01:06 PM   #1
sombre14
LQ Newbie
 
Registered: Mar 2018
Posts: 3

Rep: Reputation: Disabled
clearing swap space.


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
 
Old 05-23-2022, 01:57 PM   #2
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Rep: Reputation: 164Reputation: 164
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?)
 
Old 05-23-2022, 03:07 PM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,680

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
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/
 
Old 05-26-2022, 07:41 AM   #4
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,781

Rep: Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198
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.
 
Old 05-26-2022, 07:55 AM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,120

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
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.
 
Old 05-26-2022, 09:40 AM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,804

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
www.linuxatemyram.com
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
swap space (or) swap file yusufs Linux - Newbie 8 07-17-2008 02:02 AM
Clearing out Swap in the morning... MikeyCarter Linux - Software 22 01-08-2008 01:32 AM
how much swap space is needed; how to increase swap space? johnpaulodonnell Linux - Newbie 5 03-23-2007 03:20 AM
Clearing the swap cwwilson721 Slackware 5 07-10-2006 09:40 PM
How to unmount actual swap and mount a new(bigger) swap space? isaac Linux - Newbie 1 06-06-2004 01:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration