Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Swap partition has to be double of ram memory????????
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
anubisis
n00b
n00b


Joined: 20 Dec 2005
Posts: 49

PostPosted: Fri Jan 06, 2006 5:22 pm    Post subject: Swap partition has to be double of ram memory???????? Reply with quote

I want to know if the swap partition has to be the double of ram memory.........................
Back to top
View user's profile Send private message
PsychoticRetina
Guru
Guru


Joined: 18 Dec 2005
Posts: 352
Location: behind the scalpel

PostPosted: Fri Jan 06, 2006 5:27 pm    Post subject: Reply with quote

has to? no. recommended - yes. if youve got 512RAM, its probably enough with an equally large swap, though...
Back to top
View user's profile Send private message
adsmith
Veteran
Veteran


Joined: 26 Sep 2004
Posts: 1386
Location: NC, USA

PostPosted: Fri Jan 06, 2006 7:25 pm    Post subject: Reply with quote

2X is a good conservative recommendation. Many people run with no swap at all, but in my opinion, they are just wasting resources. (If they expect to absolutely never reach the end of their RAM, then they probably spent too much money on memory they'll never use.....)

If you want to do hibernate-to-disk, then swap needs to be at least 1X your RAM.
Back to top
View user's profile Send private message
opqdan
Guru
Guru


Joined: 13 Dec 2004
Posts: 429
Location: Redmond, WA, USA

PostPosted: Fri Jan 06, 2006 7:54 pm    Post subject: Reply with quote

I would never go with more than 1GB of swap. I have 512MB RAM and another 512 swap. No matter what I do, I have yet to actually need that swap partition. Thats with running a webserver (only for local LAN), KDE desktop and a bunch of media applications. If you have a gig or more of RAM, doubling the ram for the swap space would just be a waste of hard disk (although it's cheap, so theres really no harm done).

On the other hand, with todays modern software, I would use a 512MB - 1GB swap even with 256 or 128 MB of RAM. In these instances, you are guaranteed to need it.
Back to top
View user's profile Send private message
cyrillic
Watchman
Watchman


Joined: 19 Feb 2003
Posts: 7313
Location: Groton, Massachusetts USA

PostPosted: Sat Jan 07, 2006 1:18 am    Post subject: Reply with quote

adsmith wrote:
(If they expect to absolutely never reach the end of their RAM, then they probably spent too much money on memory they'll never use.....)

Extra RAM is not wasted. The kernel uses it for disk caching, which speeds things up quite a bit.
Back to top
View user's profile Send private message
adsmith
Veteran
Veteran


Joined: 26 Sep 2004
Posts: 1386
Location: NC, USA

PostPosted: Sat Jan 07, 2006 1:34 am    Post subject: Reply with quote

cyrillic wrote:
adsmith wrote:
(If they expect to absolutely never reach the end of their RAM, then they probably spent too much money on memory they'll never use.....)

Extra RAM is not wasted. The kernel uses it for disk caching, which speeds things up quite a bit.


Yeah, I realize now I used poor word choice. My point was meant to be economic, not technical.

Technically, more RAM is always better for linux, but what I really meant is that if someone has enough RAM that he can always run his system without any form of swap, then this is a good indicator that he spent too much money on hardware and too little time thinking about what he is going to use the machine for. Of course, this comes from someone who has always had a very tight budget....
Back to top
View user's profile Send private message
platojones
Veteran
Veteran


Joined: 23 Oct 2002
Posts: 1602
Location: Just over the horizon

PostPosted: Sat Jan 07, 2006 1:49 am    Post subject: Reply with quote

I got into a flame war on this earlier last year, but, strictly speaking, the correct answer is that you don't HAVE to have any swap at all. That's not a particularly smart decision IMHO, but it is an option. And Gentoo is all about options. Linux VM management is such a hairball that you can pretty much find an advocate for any answer you want, but I've always stuck with 2X since it's cheap and if you get down to that point, chances are something on you're system is leaking like crazy. When Linux does run out of all VM (physical + swap), the kernel just spontanously reboots, sometimes corrupting disks. My personal opinion is 'why risk that?' Truth is, if somthing is leaking that bad, you'll notice it, but if not, it can bring you down no matter how much swap you have. Not likely to happen on most desktops, but who knows.

Bottom line is that memory management on Linux (and pick your flavor of *nix) depend on it, not only as a last ditch lifeline, but to enhance overall system performance. The philosophy is, unused RAM is wasted RAM, so let the kernel have as much as it wants for buffering to make I/O faster and give it back only when it's needed. It's a GOOD philosophy. But some people freak out when they expand to 2 GB from 1 GB RAM and see a little bit of swap being used and think the machine is thrashing. It's not. Linux is just balancing things in a surprisingly efficient way. Anyway, do whatever you want, but I, and most people who have been around for a while, would say 'Make sure you have at least some'.

PS: You can create a swap file if you didn't bother to create a swap parition when you installed, but you will pay a heavy performance price when it get's used. It's an order of magnitude slower than a partition.
Back to top
View user's profile Send private message
mpsii
l33t
l33t


Joined: 11 Mar 2003
Posts: 658
Location: Jackson, TN

PostPosted: Sat Jan 07, 2006 2:00 am    Post subject: Reply with quote

I would have to go with the swapspace=size_of_ram theory myself, if you have >=512MB of RAM. This is for normal desktop environments.

However, some enterprise level applications (IBM DB2, Oracle E-Business Suite) actually require/want at least swapspace=2 x size_of_ram. It actually gets used, even!
_________________
-----------------------------------------
Michael
Back to top
View user's profile Send private message
Kensai
Guru
Guru


Joined: 09 Mar 2004
Posts: 569
Location: Puerto Rico

PostPosted: Sat Jan 07, 2006 2:06 am    Post subject: Reply with quote

As easy as these, I was tell by some Linux Gurus when I started with Linux some years ago:
For Kernel 2.4 double Swap
For Kernel 2.6 same as RAM
I was told 2.6 was more inteligent on these kinds of things. I'm not a Kernel Hacker so I know not much about the situation.
_________________
Gentoo: Gigabyte: nFORCE 2: nVIDIA GeForce 6600: AMD Athlon XP 3200+
Leaving the above specs to immortalize the first system I Installed Gentoo on!
Back to top
View user's profile Send private message
reynolds531
Apprentice
Apprentice


Joined: 23 Apr 2005
Posts: 260
Location: Rochester, NY

PostPosted: Sat Jan 07, 2006 2:45 am    Post subject: Reply with quote

If you have a laptop and plan to use suspend-to-disk, you should take a look at what suspend2 recommends for swap size (I believe it's something like RAM plus 30%, but I'm not sure).
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
Page 1 of 1

 
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