LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices


Reply
  Search this Thread
Old 12-19-2005, 10:34 AM   #1
tells
Member
 
Registered: Jun 2003
Location: Peoria, IL
Distribution: Ubuntu (home) / RHEL (work)
Posts: 65

Rep: Reputation: 15
How much swap?


I would like to see how others are determining the amount of swap to put on a server. In the old days we just doubled the amount of memory that the server had. Today I am getting servers with 16GB or more of memory and it seems like it should not need that much swap. The other problem I have is the 2GB limit that Red Hat Enterprise linux has on swap partitions. Is there a way to create a swap partition of more that 2GB? This limitation seems to cause problems when you try to keep each swap partition on a sperate disk.
 
Old 12-26-2005, 05:59 PM   #2
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
There is not now, nor was there ever, a formula for calculating the proper size of swap space. The only way that you can determine the required amount of swap space is to run your normal work load and see what it uses. The amount of swap space that is required is determined by the amount of memory required by the normal workload minus the amount of physical RAM available, then add some margin of safety.

So then the question is what to do when you are setting up a server. If you have a lot of disk space then you could set up a swap space that is equal in size to the RAM but you could end up wasting 16 GB of disk space if your server never swaps. On the other hand if you set up a 1 GB swap partition and all of the rest of your disk space is allocated for other things then you could have a problem when the server is put under a high load and your swap space gets filled.

One answer would be to set a small swap space but keep some disk space unallocated. Hopefully on a server you have more than one disk. So put a 4 GB or a 8 GB or whatever partition for swap space on one disk, and make another partition on another disk for swap. They should probably be equal in size. You can boot using both partitions and over time if you find that you don't need as much swap space then you can reallocate one of the swap files for something else, like making a physically adjacent partition larger.

Taking this approach will let you configure the server for a large swap space but will give you a way to easily recover some of the swap space if you find that you don't need it. If you do this then you could take the approach of initially allocating a lot of swap space knowing that you can recover some if it was not needed.
 
Old 12-26-2005, 07:58 PM   #3
debianmike
Member
 
Registered: Sep 2005
Posts: 115

Rep: Reputation: 15
Oracle requires i think 3 gigs of swap space for its install, so depending on what you are doing, systems may require more or less than others.
 
Old 12-29-2005, 11:34 AM   #4
williamwbishop
Member
 
Registered: Feb 2003
Location: god's judge
Posts: 376

Rep: Reputation: 30
It really does depend on what you are doing with it. As he said oracle needs a good bit, but I've got a server with 3 gigs of memory that has a 2 gig swap and has never used more than 5 meg of it. It does small transactions, so it will fill up ram and never touch the swap as yet....You'll just have to decide what's right for you.
 
Old 12-31-2005, 07:03 AM   #5
arvin_shu
LQ Newbie
 
Registered: Nov 2005
Distribution: red hat 9
Posts: 3

Rep: Reputation: 0
受教了!
I was told that the swap should be twice as the size as mem, though I don't think it should be in that way. Now I know how it should be, but I won't tell the teacher since they won't believe the things on their book is not correct.

Thanks angin.
 
  


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
Linux swap / solaris not appearing as swap in Ubuntu? Erik_the_Red Linux - Newbie 1 07-30-2005 12:57 PM
Swap not being used provo1234 Linux - General 4 02-01-2005 10:35 PM
How to unmount actual swap and mount a new(bigger) swap space? isaac Linux - Newbie 1 06-06-2004 01:23 AM
Difference between Swap Virtrual memory and Swap Parition Nappa Slackware 4 11-27-2003 07:58 PM
what about the swap ? sapilas Linux From Scratch 1 04-29-2002 03:34 PM

LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise

All times are GMT -5. The time now is 09:23 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