LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   Swap space size on multi-core systems (https://www.linuxquestions.org/questions/linux-desktop-74/swap-space-size-on-multi-core-systems-587259/)

daWabbit 09-25-2007 11:39 AM

Swap space size on multi-core systems
 
So far, on single core/single cpu systems, I have had good luck with making much smaller swap files than the partitioner on Ubuntu or other such systems wants to. On this machine, with a 1.0 GHz Pentium 3 and 512 MB RAM, I have never used more than 180 MB of swap. My partition is 450 MB, so I'm well covered, there.

But I am building a new system. It will have 4 cpu cores (dual sockets) System memory will be 4 GB, to start. (I can go up to 8, but I don't have the money for that.) The workload will be about the same as what I do on this machine. How much swap would you folks recommend? I'm wondering if the presence of more cores means I might use more swap.

Thanks;
Jack Imsdahl

jiml8 09-25-2007 01:30 PM

swap usage is dictated by the need for your system to have memory in excess of the physical memory available on the system. If you are not experiencing much need for swap using a single processor system, you won't experience much need for swap in a multiprocessor system presuming you have at least the same amount of RAM available and your workload is the same.

Rustylinux 09-25-2007 02:57 PM

Typically the rule of thumb is the swap file should be 1.5 times the amount of memory you have in your machine. however i belive it caps at 2GB. Seeing as you didn't use the swap file much in your last system with only 512mb of memory having 4GB of memory in the new system i can't see the need for a massive swap file. However its a force of habit for me to follow the rule of thumb just incase i EVER will need :D

AlucardZero 09-25-2007 05:29 PM

Quote:

Originally Posted by Rustylinux (Post 2903554)
Typically the rule of thumb is the swap file should be 1.5 times the amount of memory you have in your machine.

1997 called and wants their rule back. This is a bad rule to follow, and has been for a few years.
Quote:

however i belive it caps at 2GB.
What, swap space? Swap space can be as big as you want it to be.
Quote:

Seeing as you didn't use the swap file much in your last system with only 512mb of memory having 4GB of memory in the new system i can't see the need for a massive swap file.
This is true.

TC, if you are going to be hibernating, then with 4GB of RAM you want like a 3GB swap (the image is compressed some). Otherwise, I can't see you ever dipping into swap unless you do video editing.

Cores have no relation to swap size, only RAM does.

On a 4GB non-video-editing, non-hibernating system, I'd go with like a 128MB swap, and be surprised if it needs to be used.

syg00 09-25-2007 06:57 PM

Quote:

Originally Posted by AlucardZero (Post 2903689)
What, swap space? Swap space can be as big as you want it to be.

This is architecture dependant. Last I looked on x86 (32-bit) 2 Gig (per extent) was the limit mkswap would deal with. Redhat put out a hack to relieve this limit, don't know if it has made it's way into the mainstream.
Quote:

Cores have no relation to swap size, only RAM does.
Oh, I don't know - 4 tasks concurrently looping on malloc gotta burn more swap than just one ... ;)

Forgot to mention - I'm just building a similar system. FWIW, I threw a Gig of swap at it.

AceofSpades19 09-25-2007 07:05 PM

You probably don't need any or a very small amount of swap space, there has been people you have 1 gb of ram who don't make a swap file or parition

daWabbit 09-26-2007 06:32 PM

Thanks a lot, folks
 
I made my decision. I went ahead and put in something of a swap file, but not much in relation to RAM, etc. I put in 750 MB swap. I just finished the install (Ubuntu Dapper; I stick with the long term support releases on my production boxes) and so far the max swap usage has shown to be 36 MB. Not much, is it?

The system is running fine now. Thanks again for the reasoned responses.

AceofSpades19 09-26-2007 07:13 PM

Quote:

Originally Posted by daWabbit (Post 2904857)
I made my decision. I went ahead and put in something of a swap file, but not much in relation to RAM, etc. I put in 750 MB swap. I just finished the install (Ubuntu Dapper; I stick with the long term support releases on my production boxes) and so far the max swap usage has shown to be 36 MB. Not much, is it?

The system is running fine now. Thanks again for the reasoned responses.

750 mb of swap is alot, I have less then that on my system with 256 mb of ram. In my opnion, you should have made like a hundred mb of swap or so

syg00 09-26-2007 07:21 PM

Disk is cheap - and swap is cheap insurance.


All times are GMT -5. The time now is 08:09 PM.