LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-04-2012, 02:57 PM   #1
mannmaniyar
LQ Newbie
 
Registered: Apr 2009
Posts: 22

Rep: Reputation: 0
Question Swap Space.


Hi All,

Greetings!!

I have a very basic doubt. I am sorry if its a very stupid question, but I am confused.

We know that its a best practice to give 1.5 times of RAM as SWAP Space. Its okay when we have small RAM of 8 -10 GB we can give max of 15GB as Swap space. But if we have more 60 -100 GB RAM then also do we need to give 1.5 times of the RAM as Swap.

If I am not wrong Swapping of (page-in and Page-out) large data will slowdown the server a lot.

Kindly suggest how much swap should we give if RAM is very high.


Best Wishes,
Mann.
 
Old 06-04-2012, 03:04 PM   #2
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by mannmaniyar View Post
We know that its a best practice to give 1.5 times of RAM as SWAP Space.
Quote:
Kindly suggest how much swap should we give if RAM is very high.
There is no correlation between the amount of ram in a Linux system and the proper amount of swap space.

The amount of swap space you need depends on how the system is used. Most people setting up ordinary Linux systems have no way to even make a decent estimate of how much swap space they ought to have, so "experts" have made up silly rules (such as your 1.5 times ram size) to give the illusion that it wasn't just a guessed number.

Quote:
we have more 60 -100 GB RAM
Why do you have so much ram? If you have so much ram just because ram is inexpensive and your systems workload doesn't need nearly that much ram, then I suggest a swap size of 2GB. Even with lots of excess ram, systems that have reasonable hard drive space ought to have some swap space. 2GB is a nice size for swap for any system that has plenty of ram for its intended use.

But if your system will be used in a way that really needs the amount of ram you have, it might need significantly more than 2GB of swap space. That really depends on details of the use that could be very hard for even an expert to predict. There may be no method better than try it and see. My 2GB suggestion was based on excess ram leading to trivial use of swap. If the most swap space your system is ever likely to use is under 100MB, 2GB is still a wise safety factor. If you expect some real use of swap space, you might start the swap size at 4GB and watch the use occasionally. If you ever see less than 2GB of swap space free, increase the swap size. Obviously, try it and see is unsound for a critical production server. Without knowing the intended use level, only guesses are possible.

Last edited by johnsfine; 06-04-2012 at 03:15 PM.
 
1 members found this post helpful.
Old 06-04-2012, 03:05 PM   #3
em31amit
Member
 
Registered: Apr 2012
Location: /root
Distribution: Ubuntu, Redhat, Fedora, CentOS
Posts: 190

Rep: Reputation: 55
you're correct, technically it depends on application need that how much it usage. but if you have sufficient RAM for it than you don't require to make swap 1.5 times of RAM. you can decrease it.

there are some kernel swappiness parameters which also affect page-in and page-out.

you can configure those, else 1 times is best.

note : we can also increase swap space later on.
 
Old 06-04-2012, 03:11 PM   #4
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,057

Rep: Reputation: Disabled
It very much depend what you do.

For a desktop 4 GB is enough. My box (Slackware 13.37) has that and only 3 GB and even when compiling big programs the swap is not used.

If you are running a server with a lot of connections to a very big database that's another story.

I think the rule you mentioned is obsolete nowadays. With more than 4 GB RAM I don't see the point in adding swap space proportionally to RAM space.

Anyhow you can check with a memory usage tracking app.
 
Old 06-04-2012, 03:23 PM   #5
mannmaniyar
LQ Newbie
 
Registered: Apr 2009
Posts: 22

Original Poster
Rep: Reputation: 0
Hi,

Thanks for the replies.

Sorry for the mistake "we have more 60 - 100 GB RAM" I wanted to say our servers have RAM 60GB and 100GB.

These are newly brought servers and as thumb rule we were suggested to go with 90GB of swap for 60GB servers. I was not sure do we really require that much swap space initially and as em31amit suggested we can also add swap if required in future.

I wanted to check is there any suggested swap space for setting up at the time of installation on the server with large RAMs.

Best Wishes,
Mann.
 
Old 06-04-2012, 04:22 PM   #6
SaintDanBert
Senior Member
 
Registered: Jan 2009
Location: "North Shore" Louisiana USA
Distribution: Mint-20.1 with Cinnamon
Posts: 1,771
Blog Entries: 3

Rep: Reputation: 108Reputation: 108
Years ago, IBM did a major study of virtual memory systems and performance. They concluded that "... virtual memory systems worked better with large amounts of physical memory ..."

If the kernel needs to allocate memory to a process, and free memory is not available, the kernel will identify processes which are "swappable" and move some memory contents to swap space marking that memory free. Now it has free memory to allocate to the process that needs or asks for more memory. When a swapped process next enters the run queue, the kernel needs free memory ... and the steps get repeated.

Given so much physical memory, you most likely do not require any swap space. There are utilities that will let you see what is happening for sure. When I really care about accurate sizes and I have lots of physical memory, I make a swap file that is 10-20% larger than all of my largest processes at run time. This is typically 4-8 GBytes.

Keep us posted on your progress and mark the thread SOLVED when you think you have all the answers you need.

~~~ 0;-Dan
 
1 members found this post helpful.
Old 06-07-2012, 04:23 AM   #7
mannmaniyar
LQ Newbie
 
Registered: Apr 2009
Posts: 22

Original Poster
Rep: Reputation: 0
Cool

Quote:
Originally Posted by SaintDanBert View Post
Given so much physical memory, you most likely do not require any swap space. There are utilities that will let you see what is happening for sure. When I really care about accurate sizes and I have lots of physical memory, I make a swap file that is 10-20% larger than all of my largest processes at run time. This is typically 4-8 GBytes.
Thanks Saint !!

Finally, we are going to have 8GB Swap and will be monitoring the RAM utilization.
 
Old 06-07-2012, 05:44 AM   #8
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by mannmaniyar View Post
Finally, we are going to have 8GB Swap and will be monitoring the RAM utilization.
I hope you meant monitoring the swap utilization.

If you have plenty of ram, you still may have very little free ram, because the cache tends to use up most of the ram that isn't otherwise needed.

Typical long running service processes tend to use some swap space even if there is significant excess physical ram. So some use of swap space is not any indication of significant "memory pressure".

If you find a few GB of that 8GB swap gets used, then depending on your application, that might indicate some memory pressure that might deserve some attention.

If you find 6GB or more of the 8GB swap gets used, then while you are figuring out whether or what else might deserve adjustment, you should increase the swap space to have more safety margin.

Still just guessing with no clue of your intended use of the systems, but my best guess is you will see less than 100MB of your 8GB swap used.

Last edited by johnsfine; 06-07-2012 at 05:46 AM.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to reduce swap space and reclaim the space grantm Linux - Newbie 7 08-16-2012 07:05 AM
swap file or swap space? simonb1975uk Linux - General 11 08-15-2008 02:39 PM
swap space (or) swap file yusufs Linux - Newbie 8 07-17-2008 02:02 AM
how much swap space is needed; how to increase swap space? johnpaulodonnell Linux - Newbie 5 03-23-2007 03:20 AM
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 - General

All times are GMT -5. The time now is 03:41 AM.

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