Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How big should my swap partition be?
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2  
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
d2_racing
Bodhisattva
Bodhisattva


Joined: 25 Apr 2005
Posts: 13047
Location: Ste-Foy,Canada

PostPosted: Sat Jan 23, 2010 7:14 pm    Post subject: Reply with quote

yngwin wrote:
256MB should be enough for anyone, unless you use applications that rely on heavy swapping, or use suspend to disk.


In fact, and in that situation, how much swap do we need actually to be safe ? RAM * 1.5 maybe ?
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9678
Location: almost Mile High in the USA

PostPosted: Tue Jan 26, 2010 1:25 am    Post subject: Reply with quote

Is there a Gentoo FAQ about swap somewhere?

How much swap you need depends on how you use your computer. Gentoo installations are a bit different as everyone will be compiling for the most part.

Key things:
1) how much ram you have
2) how much ram you typically use (all applications, including allocated but unused RAM)
3) using tmpfs to build? (ramdisk)
4) how fast is your disk (see #5)
5) your tolerance for pain :)

If you want to emerge anything at all, I think a safe number is you must have minimal 512MB of memory, whether it's made of physical RAM or swap. However, if you have less than 1/4 real RAM, this may hit the "pain tolerance" fast and having that much would be counterproductive. If you have a fast disk your tolerance for swap may be higher. If you want to run with -j to use more cores, you may need to multiply this by the number of jobs you have running at once.

Now if you use X11 and GUIs a lot you need to add more to this 512MB number, say another 512M or so. I think it is possible to run a Gentoo system with no swap with 1GB RAM if you're *very* careful, but 512MB for the GUI/etc may be optimistic.

At 2 or 4GB RAM there may be temptation to use tmpfs. This will take away from your normal use, so however big your tmpfs gets you need to add this to your working space (ram+swap).

I'd say at 1GB or more, if you want to play chicken with your RAM, you don't need swap. Else I think it's best to add some swap as long as you can afford the disk space. Most people with large mechanical disks, there's no reason why not to have swap space.

It's a touchy feely guess. I normally just do:
if RAM <= 512MB then swap=2X RAM
else if using(SuspendToDIsk) then swap = 2X RAM
else SWAP=1GB

This is NOT a good heuristic. Depending on your utilization it may not be enough swap or too much. I use an 8G machine at work and have gone 3-4GB deep into swap. The machine is still very responsive -- and the disk isn't thrashing. If I didn't have the swap enabled, the program would have died and I would have had to beg for more RAM...
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
akbarstatx
n00b
n00b


Joined: 14 Oct 2002
Posts: 67
Location: Minneapolis, MN

PostPosted: Wed Jan 27, 2010 6:05 am    Post subject: Reply with quote

I still use create a swap file system. Even when the box has 4GB+ ram. I don't always make it twice the ram but usually 1G. The reason is if by some wierd chance you do run out of ram memory and you don't have swap space the kernel will crash but If you a little swap, I don't think size matters here :wink: the kernel will not crash but just run very slowly.
Back to top
View user's profile Send private message
aidanjt
Veteran
Veteran


Joined: 20 Feb 2005
Posts: 1118
Location: Rep. of Ireland

PostPosted: Wed Jan 27, 2010 6:25 am    Post subject: Reply with quote

d2_racing wrote:
yngwin wrote:
256MB should be enough for anyone, unless you use applications that rely on heavy swapping, or use suspend to disk.


In fact, and in that situation, how much swap do we need actually to be safe ? RAM * 1.5 maybe ?

There's no rule of thumb other than $totalmemyouuse-$ram. So swap can be anything from 0-10000GB. Of course apps like The GIMP opening huge images will gobble up a serious volume of mem, so swap can be useful there, even if horrifically slow.
_________________
juniper wrote:
you experience political reality dilation when travelling at american political speeds. it's in einstein's formulas. it's not their fault.
Back to top
View user's profile Send private message
yngwin
Retired Dev
Retired Dev


Joined: 19 Dec 2002
Posts: 4572
Location: Suzhou, China

PostPosted: Wed Jan 27, 2010 12:08 pm    Post subject: Reply with quote

d2_racing wrote:
yngwin wrote:
256MB should be enough for anyone, unless you use applications that rely on heavy swapping, or use suspend to disk.


In fact, and in that situation, how much swap do we need actually to be safe ? RAM * 1.5 maybe ?

To be safe I'd say twice the amount of RAM you have. But it really depends on your usage.
_________________
"Those who deny freedom to others deserve it not for themselves." - Abraham Lincoln
Free Culture | Defective by Design | EFF
Back to top
View user's profile Send private message
d2_racing
Bodhisattva
Bodhisattva


Joined: 25 Apr 2005
Posts: 13047
Location: Ste-Foy,Canada

PostPosted: Wed Jan 27, 2010 1:03 pm    Post subject: Reply with quote

Thanks yngwin, I will keep that in mind.
Back to top
View user's profile Send private message
NathanZachary
Moderator
Moderator


Joined: 30 Jan 2007
Posts: 2605

PostPosted: Thu Jan 28, 2010 4:59 am    Post subject: Reply with quote

Since I don't use suspend to disk, I have my swap partition set to a really low amount. I only have 1GiB of RAM, but I still only have a 128MiB swap partition. I haven't run into any problems, and this system has been running for years. Of course, it is completely dependent on your typical usage (as others have mentioned).
_________________
“Truth, like infinity, is to be forever approached but never reached.” --Jean Ayres (1972)
---avatar cropped from =AimanStudio---
Back to top
View user's profile Send private message
milomak
Apprentice
Apprentice


Joined: 10 Apr 2008
Posts: 287

PostPosted: Thu Jan 28, 2010 11:08 am    Post subject: Reply with quote

yngwin wrote:
d2_racing wrote:
yngwin wrote:
256MB should be enough for anyone, unless you use applications that rely on heavy swapping, or use suspend to disk.


In fact, and in that situation, how much swap do we need actually to be safe ? RAM * 1.5 maybe ?

To be safe I'd say twice the amount of RAM you have. But it really depends on your usage.


That's they key for me. For instance I have a laptop with 2GB RAM but 750MB swap. I am able to use suspend to disk on the laptop. Primarily because I am mostly browsing or editing a doc or spreadsheet.

i certainly wouldn't have twice the size of swap on my main system with 6GB RAM.
_________________
Desktop - Windows 10, Debian Sid, Gentoo Unstable, Arch Linux, Solus

Laptop - Windows 10, Debian Sid, Solus
Back to top
View user's profile Send private message
d2_racing
Bodhisattva
Bodhisattva


Joined: 25 Apr 2005
Posts: 13047
Location: Ste-Foy,Canada

PostPosted: Thu Jan 28, 2010 5:18 pm    Post subject: Reply with quote

In fact, 12 Gig of SWAP is too high :P
Back to top
View user's profile Send private message
gruber
n00b
n00b


Joined: 14 Jan 2010
Posts: 42
Location: /home/Southpark

PostPosted: Thu Jan 28, 2010 6:25 pm    Post subject: Reply with quote

Yep!

I'm with 3GB RAM (because of the @#$& WinXP 32bit). On my I have a small swap only because I let Ubuntu do it. Nevertheless, Neither Ubuntu or Gentoo actually ever swapped something. And I'm using some FFTs which can eat-a-lot. My newest gentoo install is with no swap at all and still works with no need of one.

So, if you're using desktop system for regular use (gaming, office, net) and you don't want suspend-to-disk, you don't need swap. IMHO!!!

If you want to do some sci jobs, heavy gimp-ing, etc, do some swap. IMHO!!!
Back to top
View user's profile Send private message
d2_racing
Bodhisattva
Bodhisattva


Joined: 25 Apr 2005
Posts: 13047
Location: Ste-Foy,Canada

PostPosted: Fri Jan 29, 2010 3:57 am    Post subject: Reply with quote

Maybe 1 Gig of swap is enough if you don't use suspend to ram feature :P
Back to top
View user's profile Send private message
ruivilela
Apprentice
Apprentice


Joined: 05 Oct 2004
Posts: 236
Location: Łódź

PostPosted: Fri Jan 29, 2010 9:57 am    Post subject: Reply with quote

gruber wrote:
Yep!

I'm with 3GB RAM (because of the @#$& WinXP 32bit). On my I have a small swap only because I let Ubuntu do it. Nevertheless, Neither Ubuntu or Gentoo actually ever swapped something. And I'm using some FFTs which can eat-a-lot. My newest gentoo install is with no swap at all and still works with no need of one.

So, if you're using desktop system for regular use (gaming, office, net) and you don't want suspend-to-disk, you don't need swap. IMHO!!!

If you want to do some sci jobs, heavy gimp-ing, etc, do some swap. IMHO!!!


To get swap use is quite simple. Use tmpfs. And copy a 3GB file to there Or use Virtualization systems. My box with Fluxbox uses around 87MB when idle and I have 3GB. And rarely kernel uses swap. Only for caching stuff. If you don't like swap partitation, make a swap file. I'm not sure about the fragm. issue ...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum