View previous topic :: View next topic |
Author |
Message |
x1um1n Tux's lil' helper
Joined: 05 Feb 2005 Posts: 126 Location: Chester, UK
|
Posted: Fri Aug 11, 2006 9:51 am Post subject: how much swap do i need? |
|
|
hi,
I'm currently building a new machine:
2xOpteron 246 2.2GHz
2Gb RAM (initially, mobo takes up to 24Gb)
I'm concerned about how much swap space to give this machine, conventional wisdom says 2x or 3xRAM, but how much do I actually need?
if I go with 2xRAM that would be 4Gb, tho as I'm likely to upgrade to the 24Gb at some stage, should I go for the full 48Gb swap?
will I ever need as much as this, or will 4Gb be fine? even after the upgrade?
the machine will be a server/desktop, streaming media to other machines on the network and also running Azureus (most likely using a ridiculous amount of RAM, damnit!)
what are peoples thoughts on this? I've never ran a machine with that much RAM before.. _________________ Linux Version 2.6.25-hh4, Compiled #1 SMP Sun May 25 17:17:46 GMT 2008
Two 3GHz AMD Athlon 64 Processors, 4GB RAM, 12004 Bogomips Total
omnius |
|
Back to top |
|
|
EzInKy Veteran
Joined: 11 Oct 2002 Posts: 1742 Location: Kentucky
|
Posted: Fri Aug 11, 2006 10:05 am Post subject: |
|
|
Strictly speaking you probably don't need any swap at all but from the what I've read the kernel does perform better when it has some available. That said, I have two 246's, 4gb ram, two 500gb ide disks, and one 250 sata with plans to upgrade to 16gb of ram and four 500gb satas so I figured wtf and created ~20gb of swap. Here is my partition setup on hda...
Code: |
Device Boot Start End Blocks Id System
/dev/hda1 1 2445 19639431 82 Linux swap / Solaris
/dev/hda2 * 2446 12171 78124095 83 Linux
/dev/hda3 12172 21897 78124095 83 Linux
/dev/hda4 21898 60801 312496380 5 Extended
/dev/hda5 21898 31623 78124063+ 83 Linux
/dev/hda6 31624 41349 78124063+ 83 Linux
/dev/hda7 41350 51075 78124063+ 83 Linux
/dev/hda8 51076 60801 78124063+ 83 Linux
|
...and free shows:
Code: |
#free
total used free shared buffers cached
Mem: 4124292 1975156 2149136 0 394636 947140
-/+ buffers/cache: 633380 3490912
Swap: 19639420 0 19639420
|
_________________ Time is what keeps everything from happening all at once. |
|
Back to top |
|
|
x1um1n Tux's lil' helper
Joined: 05 Feb 2005 Posts: 126 Location: Chester, UK
|
Posted: Fri Aug 11, 2006 10:15 am Post subject: |
|
|
yeah, whenever I look at the swap usage on my desktop (Athlon 650, 256Mb RAM, 512Mb Swap) its always saying 0 used..
I guess I'll go for 5Gb swap on my main SATA drive and I can always add more partitions on some of the IDE drives if its maxing it out..
unless, anyone else can give me a definitive reason to do otherwise..
thanx for the help, out of interest, as you seem to be running a similar box to the one i'm building, how long does it take you to compile a large package like OO.o? I gave up last time I tried an installed the bins, after 2 days it kept running out of space on /usr, lol.. _________________ Linux Version 2.6.25-hh4, Compiled #1 SMP Sun May 25 17:17:46 GMT 2008
Two 3GHz AMD Athlon 64 Processors, 4GB RAM, 12004 Bogomips Total
omnius |
|
Back to top |
|
|
EzInKy Veteran
Joined: 11 Oct 2002 Posts: 1742 Location: Kentucky
|
Posted: Fri Aug 11, 2006 10:21 am Post subject: |
|
|
I run "~amd64" and stick to koffice so don't bother with oo but emerging every kde*-meta package takes less than 12 hours. _________________ Time is what keeps everything from happening all at once. |
|
Back to top |
|
|
tost Guru
Joined: 10 Dec 2005 Posts: 506
|
Posted: Fri Aug 11, 2006 10:24 am Post subject: |
|
|
Normally more than 1024MB don´t need an extra Swap-Partition.
But I guess it would be simple to check out if your performance increases with the Swap Partition or not.
tost |
|
Back to top |
|
|
x1um1n Tux's lil' helper
Joined: 05 Feb 2005 Posts: 126 Location: Chester, UK
|
Posted: Fri Aug 11, 2006 10:27 am Post subject: |
|
|
cheers,
but i'm a gnome-boy so I try to run as few K-apps as poss, so everythin looks pretty (and the same)
if only we had a burning tool as good as K3B
well, this up should be a big step up in any case..
currently takes bout 6hrs to emerge kde-base *sigh*
tost: thanks, i've read that, but i've also read that you get a boost from having *some* swap, the prob is kernel development moves at a faster pace than userspace docs on the subject.. I've read a couple today sayin *nix can't handle more than 2Gb RAM on x86.. lol, 64Gb last time I checked.. _________________ Linux Version 2.6.25-hh4, Compiled #1 SMP Sun May 25 17:17:46 GMT 2008
Two 3GHz AMD Athlon 64 Processors, 4GB RAM, 12004 Bogomips Total
omnius |
|
Back to top |
|
|
Paapaa l33t
Joined: 14 Aug 2005 Posts: 955 Location: Finland
|
Posted: Fri Aug 11, 2006 11:41 am Post subject: |
|
|
I think 512MB is more than enough - most likely you'll never need it at all. 5GB is just wasting of (cheap) HD space. I also don't think there will be ANY performance differences as everything will be kept in RAM. |
|
Back to top |
|
|
Headrush Watchman
Joined: 06 Nov 2003 Posts: 5597 Location: Bizarro World
|
Posted: Fri Aug 11, 2006 1:01 pm Post subject: |
|
|
I have 2GB of RAM myself and the swap never seems to get used. (Using several VMware virtual machines included.)
Since hard drive space is cheap, it doesn't hurt to set swap up a little bigger than your current/expected RAM size.
Remember that if you plan to use some of the suspend features/apps, some of them store a RAM image in swap, so it has to be bigger than your RAM size and, you never know if something in the future might take advantage of swap. (similar to suspend).
So for such a little HD space, just make it. |
|
Back to top |
|
|
x1um1n Tux's lil' helper
Joined: 05 Feb 2005 Posts: 126 Location: Chester, UK
|
Posted: Fri Aug 11, 2006 1:18 pm Post subject: |
|
|
see, this is the problem, there IS no definitive answer..
I won't ever be suspending this machine as its going to be streaming media around the house..
but you make a good point headrush, i'm gonna have over 800Gb hdd space from the get go, and plan on adding more later, as no matter how much hdd space i have it always fills up rather quickly. Even when I've got an HVD-RW in there i'm still gonna need a couple Tb space methinks, and given how much the HVD will cost I can't see me gettin one anytime soon!
I guess my reluctance to waste space goes back to the length of time i've been playin with PC's..
My first machine (8088) had a 20Mb HDD, and ppl considered that excessive at the time!
still 5Gb is only a little bigger than a DVDR, which is nothing these days..
...and getting smaller by the day it seems _________________ Linux Version 2.6.25-hh4, Compiled #1 SMP Sun May 25 17:17:46 GMT 2008
Two 3GHz AMD Athlon 64 Processors, 4GB RAM, 12004 Bogomips Total
omnius |
|
Back to top |
|
|
Headrush Watchman
Joined: 06 Nov 2003 Posts: 5597 Location: Bizarro World
|
Posted: Fri Aug 11, 2006 1:26 pm Post subject: |
|
|
x1um1n wrote: | see, this is the problem, there IS no definitive answer.. |
Not a problem, just shows the flexibility of Linux and its flexibility for each setup.
x1um1n wrote: | I guess my reluctance to waste space goes back to the length of time i've been playin with PC's..
My first machine (8088) had a 20Mb HDD, and ppl considered that excessive at the time! |
I can beat that. I remember in the day paying $795 US for a 10MB HD for an Apple || and that was considered extravagant.
x1um1n wrote: | still 5Gb is only a little bigger than a DVDR, which is nothing these days..
...and getting smaller by the day it seems |
You talking only 0.625% of your 800Gb, just do it.
(You lose more than than just formatting it.) |
|
Back to top |
|
|
Hauser l33t
Joined: 27 Dec 2003 Posts: 650 Location: 4-dimensional hyperplane
|
Posted: Sat Aug 12, 2006 9:25 am Post subject: |
|
|
I would suggest against a swap partition, because it'll probably never be used and thus a waste of diskspace. If you're really concerned about the possiblity of needing to use some swap space (for whatever the reason), put it on LVM rather than a physical partition, because you can then change the size of it while the system is running. _________________ AMD Athlon XP 2600+; 512M RAM;
nVidia FX5700LE; Hitachi 120Gb
2.6.9-nitro4, reiser4, linux26-headers+nptl
Do I like to compile everything?
Positive definite! |
|
Back to top |
|
|
x1um1n Tux's lil' helper
Joined: 05 Feb 2005 Posts: 126 Location: Chester, UK
|
Posted: Mon Aug 14, 2006 1:22 pm Post subject: |
|
|
hauser: I've never setup LVM, is it easy to configure? thru fdisk I spose? do i need to set the entire disk as LVM, so i can reallocate the swap to one of the other partitions if i find i'm not using it?
headrush: lol, at today's prices £500 ($800-ish) would get you 2x750Gb SATA2 drives, or 4x500Gb IDE, or 1.5x300Gb SCSI..
ahh, progress _________________ Linux Version 2.6.25-hh4, Compiled #1 SMP Sun May 25 17:17:46 GMT 2008
Two 3GHz AMD Athlon 64 Processors, 4GB RAM, 12004 Bogomips Total
omnius |
|
Back to top |
|
|
Paapaa l33t
Joined: 14 Aug 2005 Posts: 955 Location: Finland
|
Posted: Mon Aug 14, 2006 1:30 pm Post subject: |
|
|
x1um1n wrote: | hauser: I've never setup LVM, is it easy to configure? thru fdisk I spose? do i need to set the entire disk as LVM, so i can reallocate the swap to one of the other partitions if i find i'm not using it? |
The question is, will you be ever using any swap? What programs you usually use? I've never ever seem any swap usage and I have 1GB ram and I have more than 3 programs open at the same time.
You can play safe but having a 5GB swap is 100% useless in most "normal" cases. |
|
Back to top |
|
|
x1um1n Tux's lil' helper
Joined: 05 Feb 2005 Posts: 126 Location: Chester, UK
|
Posted: Mon Aug 14, 2006 1:46 pm Post subject: |
|
|
ok,
Normal use for this machine will be:
Gnome+XGL/AIGLX
Azureus (seems to feel the need to have 10-20 copies of the JVM running (according to top), but they appear to be clones)
Icecast (or something similar to stream media: music, TV/Film & Music Video)
NFS/SMB shares
and i'll also be using it for development work, poss as part of a distcc compile-farm..
tho until i move house, i'll only need one machine, so it won't be streaming, but will be playing media, running firefox etc.. _________________ Linux Version 2.6.25-hh4, Compiled #1 SMP Sun May 25 17:17:46 GMT 2008
Two 3GHz AMD Athlon 64 Processors, 4GB RAM, 12004 Bogomips Total
omnius |
|
Back to top |
|
|
electrofreak l33t
Joined: 30 Jun 2004 Posts: 713 Location: Ohio, USA
|
Posted: Mon Aug 14, 2006 6:16 pm Post subject: |
|
|
I don't make swap partitions anymore. Not even for lower mem machines. I just create swap files as needed. They are easy. Just dd the size you think you'll need, mkswap it, then swapon it. _________________ Desktop: ABit AN8, Athlon64 X2 4400+ 939 2.75GHz, 2x1GB Corsair XMS DDR400, 2x160GB SATA RAID-0, 2x20"W, Vista Ultimate x64
Laptop: 15.4" MacBook Pro 2.4Ghz, 2x1GB RAM, 160GB, Mac OS X 10.5.1
Server: PIII 550Mhz, 3x128MB RAM, 160GB, Ubuntu Server 7.10 |
|
Back to top |
|
|
Hauser l33t
Joined: 27 Dec 2003 Posts: 650 Location: 4-dimensional hyperplane
|
Posted: Mon Aug 14, 2006 8:37 pm Post subject: |
|
|
x1um1n wrote: | hauser: I've never setup LVM, is it easy to configure? thru fdisk I spose? do i need to set the entire disk as LVM, so i can reallocate the swap to one of the other partitions if i find i'm not using it?
... |
Yes, it's quite easy to set up. The Gentoo LiveCD supports LVM, modprobe "dm-mod" and then you can proceed. You can set up just a partition as LVM. You will then be able to create some logical volumes with the space available. You can make filesystems on these logical volumes, mount them anywhere you like, resize or delete any of them if you no longer want it. Better still, all these things can be done while your system is running!
Here are some examples for LVM usage: http://gentoo-hauser.blogspot.com/2006/04/put-portage-stuff-on-lvm.html _________________ AMD Athlon XP 2600+; 512M RAM;
nVidia FX5700LE; Hitachi 120Gb
2.6.9-nitro4, reiser4, linux26-headers+nptl
Do I like to compile everything?
Positive definite! |
|
Back to top |
|
|
x1um1n Tux's lil' helper
Joined: 05 Feb 2005 Posts: 126 Location: Chester, UK
|
Posted: Mon Aug 14, 2006 11:40 pm Post subject: |
|
|
hauser: cool! i'll check it out, sounds like the plan
cheers for all the help guys.. _________________ Linux Version 2.6.25-hh4, Compiled #1 SMP Sun May 25 17:17:46 GMT 2008
Two 3GHz AMD Athlon 64 Processors, 4GB RAM, 12004 Bogomips Total
omnius |
|
Back to top |
|
|
Netfeed n00b
Joined: 24 Jan 2004 Posts: 19
|
Posted: Thu Aug 17, 2006 10:38 pm Post subject: |
|
|
shouldnt the swap be 2*memory<=1024? _________________ tie me up, spank me hard and call me virgin mary |
|
Back to top |
|
|
Bob Leny Apprentice
Joined: 18 Aug 2006 Posts: 189
|
Posted: Fri Aug 18, 2006 2:41 am Post subject: |
|
|
Last I checked, the recommended amount to allocate for swap is one and a half times your memory. |
|
Back to top |
|
|
Dralnu Veteran
Joined: 24 May 2006 Posts: 1919
|
Posted: Fri Aug 18, 2006 3:54 am Post subject: |
|
|
2*RAM is what i've always been told.
With that much RAM, SWAP would be one of those things that would seem optional. Honestly, if you do make a SWAP, I'd be tempted to put it at the very end of the hard drive, so that you could merge it into another partition easy if you don't want it.
Personally, I'd match the RAM with Swap if you've got the space to spare. Only a few G, and even if you never touch it, its always nice to have something to fall back on (maybe give you a moment or two more if you hit a major mem leak somewhere) _________________ The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner. |
|
Back to top |
|
|
Bob Leny Apprentice
Joined: 18 Aug 2006 Posts: 189
|
Posted: Fri Aug 18, 2006 4:19 am Post subject: |
|
|
Yeah, I normally just allocate one gig. Five gigs is way to much, you can do it if you want, but it's far from necessary.
There isn't a set amount to allocate because two times the amount is really ridicules in some cases. I know some one who has six gigs of RAM, thats twelve gigs of swap, and like I said, there is know way you will use five gigs! |
|
Back to top |
|
|
Dralnu Veteran
Joined: 24 May 2006 Posts: 1919
|
Posted: Fri Aug 18, 2006 4:47 am Post subject: |
|
|
Bob Leny wrote: | Yeah, I normally just allocate one gig. Five gigs is way to much, you can do it if you want, but it's far from necessary.
There isn't a set amount to allocate because two times the amount is really ridicules in some cases. I know some one who has six gigs of RAM, thats twelve gigs of swap, and like I said, there is know way you will use five gigs! |
Hmm, doesn't suspend to hard disk use swap?
Just a random, laptop-related thing. _________________ The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner. |
|
Back to top |
|
|
Bob Leny Apprentice
Joined: 18 Aug 2006 Posts: 189
|
Posted: Fri Aug 18, 2006 7:37 am Post subject: |
|
|
Well, The best answer to all of this is this:
4.4.1. How large should my swap space be?
If you have decided to use a dedicated swap partition, which is generally a
Good Idea [tm], follow these guidelines for estimating its size:
* In Linux RAM and swap space add up (This is not true for all Unices). For
example, if you have 8 MB of RAM and 12 MB swap space, you have a total
of about 20 MB virtual memory.
* When sizing your swap space, you should have at least 16 MB of total
virtual memory. So for 4 MB of RAM consider at least 12 MB of swap, for 8
MB of RAM consider at least 8 MB of swap.
* Currently, the maximum size of a swap partition is
architecture-dependent. For i386 and PowerPC, it is approximately 2Gb. It
is 128Gb on alpha, 1Gb on sparc, and 3Tb on sparc64. For linux kernels
2.1 and earlier, the limit is 128Mb. The partition may be larger than 128
MB, but excess space is never used. If you want more than 128 MB of swap
for a 2.1 and earlier kernel, you have to create multiple swap
partitions. See the man page for mkswap for details.
* When sizing swap space, keep in mind that too much swap space may not be
useful at all.
A very old rule of thumb in the days of the PDP and the Vax was that the size
of the [partition-3.html#swap] working set of a program is about 25% of its
virtual size. Thus it is probably useless to provide more swap than three
times your RAM.
But keep in mind that this is just a rule of thumb. It is easily possible to
create scenarios where programs have extremely large or extremely small
working sets. For example, a simulation program with a large data set that is
accessed in a very random fashion would have almost no noticeable locality of
reference in its data segment, so its working set would be quite large.
On the other hand, an xv with many simultaneously opened JPEGs, all but one
iconified, would have a very large data segment. But image transformations
are all done on one single image, most of the memory occupied by xv is never
touched. The same is true for an editor with many editor windows where only
one window is being modified at a time. These programs have - if they are
designed properly - a very high locality of reference and large parts of them
can be kept swapped out without too severe performance impact.
One could suspect that the 25% number from the age of the command line is no
longer true for modern GUI programs editing multiple documents, but I know of
no newer papers that try to verify these numbers.
So for a configuration with 16 MB RAM, no swap is needed for a minimal
configuration and more than 48 MB of swap are probably useless. The exact
amount of memory needed depends on the application mix on the machine (what
did you expect?).
Quoted from Linux Planet: http://www.linuxplanet.com/linuxplanet/tutorials/3174/5/ |
|
Back to top |
|
|
x1um1n Tux's lil' helper
Joined: 05 Feb 2005 Posts: 126 Location: Chester, UK
|
Posted: Fri Aug 18, 2006 9:15 am Post subject: |
|
|
cheers for all the help guys,
I'll think about it an make my decision later in the year when i can afford to buy the remaining components..
got to MOT the car next month, then the insurance is due the following month, all money gone _________________ Linux Version 2.6.25-hh4, Compiled #1 SMP Sun May 25 17:17:46 GMT 2008
Two 3GHz AMD Athlon 64 Processors, 4GB RAM, 12004 Bogomips Total
omnius |
|
Back to top |
|
|
madchaz l33t
Joined: 01 Jul 2003 Posts: 993 Location: Quebec, Canada
|
Posted: Fri Aug 18, 2006 2:36 pm Post subject: |
|
|
Keep this in mind
1: Unless you enable high mem in the kernel, anything over 4Gig total RAM + swap will cause you problems.
2: On a system with 384Mgs of ram, running samba+nfs+web server+X session + windows 2000 in vmware with 128mgs of ram alocated + xmms reading music to my sound system + firefox + thunderbird, I have yet to touch more then 50mgs of my swap space.
3: On my desktop machine with 1gig of ram, no mather how much crap I open, I have never even touched swap.
I'd personaly not setup swap to be more then 512Mgs. With that much ram, it'll probably never get touched. _________________ Someone asked me once if I suffered from mental illness. I told him I enjoyed every second of it.
www.madchaz.com A small candle of a website. As my lab specs on it. |
|
Back to top |
|
|
|
|
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
|
|