LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Need for SWAP with 1 GB RAM? (http://www.linuxquestions.org/questions/linux-newbie-8/need-for-swap-with-1-gb-ram-531762/)

Aleksandersen 02-23-2007 01:51 PM

Need for SWAP with 1 GB RAM?
 
Hi,

I have read that there is no need for a SWAP partition on a computer with 1 GB RAM? Is this correct? What is the advantages/disadvantages with having such a partition? And how large should it be, if any?

Hardware: 1.83 GHz Intel Core 2 Duo (64-bits), 100 GB hard drive space, and 1 GB RAM.

Electro 02-23-2007 01:54 PM

Yes and no. Yes, you could get by with out swap. You will not last long with out swap. You can make 256 MB of swap and if you need more look up fly swapping.

b0uncer 02-23-2007 01:58 PM

SWAP is not (at least much) used as long as there is free RAM available; the moment RAM starts to get filled, SWAP is used. SWAP can be used, though, even if your RAM isn't full. But anyway if you ever do any tasks with your pc that consume memory resources, you probably want SWAP; it's a place on the harddisk where the kernel can -- without any actual defined filesystem -- store files temporarily, and that may (or may not, it depends) boost up the speed of your tasks.

With a 100GB harddrive you won't even notice having a SWAP partition as big as 1GB, and since it doesn't hurt you, I'd say it's good to have it there -- in case you find it useful one day. Another option would be to use a SWAP file instead of a partition, but I'd still pick up the partition way; 1G swap space should be big enough for you, and it's still only one percent of your whole HD space.

bskrakes 02-23-2007 02:15 PM

SWAP partition - is always a good thing to have
 
I would always have a SWAP partition, no questions asked! Like previous post, if you run out of ram then the system can use the SWAP file. If you are not hard up for space like having a 100GB HD then make a 1GB swap. The general rule has always been to double ram in the system. So if you have 1 GB I would make the system have a 2GB SWAP partition. Now this rule was probably meant more for the older systems and hardware but it would probably still be a very good idea to include in systems today!

Tinkster 02-23-2007 02:28 PM

There *is* no fixed rule as to whether you will or will not
need swap (to begin with or at some stage later in your linux
life). I've seen machines w/ 256MB never swap, and I've seen
machines w/ 2GB using lots of swap space. The only thing that's
always valid is that once your swap fills twice the amount of
your RAM you should go and buy more RAM :}

My current notebook has 1GB RAM and I have a 1GB swap-partition
(of which it currently only uses 0 MB).
My server has 256MB RAM and 756MB swap (of which it currently
only uses 90MB).

If I were to edit a video on my notebook things would change
dramatically, and so they would if I ran a complex query against
my PostgreSQL database on the server.




Cheers,
Tink

bskrakes 02-23-2007 02:35 PM

Sure you should probably buy more ram, but what is the point if you have a 100GB HD and can spare 2GB? It is not like this guy is running a huge database, unless I read something wrong and he has a Database that would require like 8GB of ram and two dual core processors.... just makes sense to double the swap size, especially if you have the space.... I think anyone who has worked with a Linux system professionally doubles there SWAP size.

See this link for some more GOOD info: http://www.hccfl.edu/pollock/AUnix1/Partitioning.htm

See this link for more info: http://forums.vnunet.com/thread.jspa?messageID=735750

YOU SHOULD DOUBLE YOUR SWAP SIZE, especially if you have a large database. At work we have a server that has 8GB of ram and we did double the SWAP size, mind we also have 1500 GB of space to work with. We have a large Database that requires POWER and MEMORY.

Ciao,
B

Tinkster 02-23-2007 03:17 PM

Quote:

Originally Posted by bskrakes
Sure you should probably buy more ram, but what is the point if you have a 100GB HD and can spare 2GB? It is not like this guy is running a huge database, unless I read something wrong and he has a Database that would require like 8GB of ram and two dual core processors.... just makes sense to double the swap size, especially if you have the space.... I think anyone who has worked with a Linux system professionally doubles there SWAP size.

If that's a response to my post you either didn't
read it or didn't understand what I am saying.

I never suggested that he use any given size. I
said if his SWAP exceeds double his RAM he should
get more RAM. And I'll stick with that: if you
use more that double your RAM for SWAP the
performance deteriorates DRASTICALLY.

Quote:

YOU SHOULD DOUBLE YOUR SWAP SIZE, especially if you have a large database. At work we have a server that has 8GB of ram and we did double the SWAP size, mind we also have 1500 GB of space to work with. We have a large Database that requires POWER and MEMORY.
And I'll bet it hardly uses half of that. If it
did your DBAs would be jumping up and down because
of the POOR PERFROMANCE.


Cheers,
Tink

bskrakes 02-23-2007 03:25 PM

No, may bad, I did not interpret your post the right way... sorry TINK. I couldn't agree more, never do more than double you swap size and 9 times out of 10 you won't use it but there has to be a reason why all linux people suggest it.

As for our work DB your right, it doesn't use the SWAP space or hardly at all. It never usually uses more than a few hundred MB's. I find that the SWAP is good for large HOT/COLD DB backups, thats when the SWAP is used most.

Electro 02-23-2007 03:46 PM

After 14 hours of use and counting, only 168 KB of swap is being used while folding@home and other programs are running. When I play a game like UT2004, swap gets used up to 8 MB even with out folding@home running.

The kernel comes with default parameters so use sysctl to adjust them to suit your setup. I have vm.swappiness set to 30 on my computer with 1 GB of RAM.

rshaw 02-23-2007 04:00 PM

"but there has to be a reason why all linux people suggest it."

folklore. it once made sense years ago when mainboards wouldn't support large amounts of ram. now it gets parroted by some as if it's "the law" .

Emerson 02-23-2007 04:06 PM

RAM + swap = 512 MB is OK for a Gentoo desktop.

AdaHacker 02-23-2007 04:44 PM

Is 1GB enough RAM to do without swap? Maybe, depending on what you do with your system. However, swap helps performance, among other things, so it's generally a good idea to have some, regardless of how much RAM you have.

If you don't want to commit an entire partition to swap, you can always use swap files. That would allow you to play with different sizes and see what works best for you.

PTrenholme 02-23-2007 05:13 PM

I've got 1Gb RAM on this laptop, and 2Gb swap. As far as I know, "swap" has never been used, but I saw no harm in allocating a couple Gb from my 80Gb drive. "Just in case."

custangro 02-23-2007 05:20 PM

Swap is always good. The rule of thumb is twice your RAM, but you don't HAVE to do this. With 1GB of RAM, I think 1GB or even 512MB swap is good. You don't HAVE to...but I suggest it.

Quakeboy02 02-23-2007 05:29 PM

I read a bit of that thread on swapping. It got old after awhile, and I think the bit that I read must have been out of date as compared to current kernels. I don't buy the full memory theory. Things have simply changed. http://gentoo-wiki.com/FAQ_Linux_Mem...2.6_kernels.29

If you simply MUST have a swap space, then spend another $100 on a 1GB stick, and put your swap space on a RAMdisk. If that doesn't make sense to you, then you understand why the need to have a swapspace on disk makes no sense to me. :)


All times are GMT -5. The time now is 02:49 PM.