Re: [gentoo-user] Questions re swap and hibernate interaction on 8 gig machine
Am Dienstag, 22. Juni 2010 schrieb Walter Dnes: I just got a brand new custom-built 8 gig machine. [...] Anyhow, I have 8 gigs of ram on the sytem (will obviously be 64-bit Gentoo) and I want to know how much swap I need. The general rule of thumb is twice the ram. In this case, it would be 16 gigs. I think that it may not need swap when up, unless I do some heavy duty stuff. My main concern about a swap partition is how much I need for hibernate-to-disk to work. Is there a rule about this, or should I simply allocate 16 gigs out of my terabyte drive, and play it safe? It of course depends on your usage profile. I have a laptop with 3 Gigs of RAM without swap. I don’t do really fancy stuff on them. Noteworthy things: Blender, X-Plane (flight sim), Hugin, some small VMs and of course the occasional compiling. Mostly, I do only one of those at one time. I even have set up a ramdisk in /var/tmp/portage for emerge. Except for kdelibs its 1.5 Gigs are more than enough. And if the ramdisk is empty, the free space is used for RAM. -- Gruß | Greetings | Qapla' The first time you’ll get a Microsoft product that doesn’t suck will be the day they start producing vacuum cleaners. signature.asc Description: This is a digitally signed message part.
Re: [gentoo-user] Questions re swap and hibernate interaction on 8 gig machine
On Thu, Jun 24, 2010 at 03:16:30PM +0200, Frank Steinmetzger wrote I even have set up a ramdisk in /var/tmp/portage for emerge. Except for kdelibs its 1.5 Gigs are more than enough. And if the ramdisk is empty, the free space is used for RAM. Why not use the built-in /dev/shm directly, and avoid the overhead of a ramdisk? waltd...@d530 ~ $ ll /dev/shm total 0 drwxrwxrwt 2 root root40 Jun 21 14:46 . drwxr-xr-x 14 root root 14080 Jun 23 17:10 .. waltd...@d530 ~ $ echo Hello World /dev/shm/greeting.txt waltd...@d530 ~ $ ll /dev/shm total 4 drwxrwxrwt 2 root root 60 Jun 24 21:01 . drwxr-xr-x 14 root root 14080 Jun 23 17:10 .. -rw-r--r-- 1 waltdnes users12 Jun 24 21:01 greeting.txt waltd...@d530 ~ $ cat /dev/shm/greeting.txt Hello World waltd...@d530 ~ $ -- Walter Dnes waltd...@waltdnes.org
Re: [gentoo-user] Questions re swap and hibernate interaction on 8 gig machine
On Monday 21 June 2010 23:04:14 Walter Dnes wrote: I just got a brand new custom-built 8 gig machine. There's an outfit in north Toronto that has MSI motherboards with PS/2 ports, so I can keep my genuine IBM PS/2 clickety-clack-keyboard; woho. And the integrated Intel graphics chip has *BOTH VGA AND DIGITAL OUTPUTS*! I have a box with those two outputs, but I found that the display card stopped working if I connected both outputs to the same, dual-input monitor. Just a cautionary note in case you have some need for that. Anyhow, I have 8 gigs of ram on the sytem (will obviously be 64-bit Gentoo) and I want to know how much swap I need. The general rule of thumb is twice the ram. In this case, it would be 16 gigs. I think that it may not need swap when up, unless I do some heavy duty stuff. With 8 GB RAM I recommend putting /tmp into a tmpfs, thus: tmpfs /tmp tmpfs nodev,nosuid,size=16G 0 0 This box has 4 GB RAM, which is never all occupied unless I'm compiling something big, such as Open Office. I created two swap partitions: a 2G and a 20G. The 2G partition has pri=10 and the 20G has pri=1. Now the small swap will be used in ordinary operation (though it never is, as far as I know). When I'm emerging Open Office, the big swap is added when it's needed, and /tmp is rolled out to swap when it grows too big for the physical memory. You may think the small swap is an unnecessary complication, and I dare say it is, but when you have lots of space, why not play in it? Anyway, it seemed like a good idea at the time. (Actually, I've made it more complex still, by duplicating the swap arrangement on the second disk so that the kernel has maximum flexibility and can use the most efficient device at any time.) My main concern about a swap partition is how much I need for hibernate-to-disk to work. Is there a rule about this, or should I simply allocate 16 gigs out of my terabyte drive, and play it safe? Can't help you there; sorry. -- Rgds Peter. Linux Counter 5290, 1994-04-23.
[gentoo-user] Questions re swap and hibernate interaction on 8 gig machine
I just got a brand new custom-built 8 gig machine. There's an outfit in north Toronto that has MSI motherboards with PS/2 ports, so I can keep my genuine IBM PS/2 clickety-clack-keyboard; woho. And the integrated Intel graphics chip has *BOTH VGA AND DIGITAL OUTPUTS*! Anyhow, I have 8 gigs of ram on the sytem (will obviously be 64-bit Gentoo) and I want to know how much swap I need. The general rule of thumb is twice the ram. In this case, it would be 16 gigs. I think that it may not need swap when up, unless I do some heavy duty stuff. My main concern about a swap partition is how much I need for hibernate-to-disk to work. Is there a rule about this, or should I simply allocate 16 gigs out of my terabyte drive, and play it safe? -- Walter Dnes waltd...@waltdnes.org
Re: [gentoo-user] Questions re swap and hibernate interaction on 8 gig machine
On Tuesday 22 June 2010 00:04:14 Walter Dnes wrote: I just got a brand new custom-built 8 gig machine. There's an outfit in north Toronto that has MSI motherboards with PS/2 ports, so I can keep my genuine IBM PS/2 clickety-clack-keyboard; woho. And the integrated Intel graphics chip has *BOTH VGA AND DIGITAL OUTPUTS*! Anyhow, I have 8 gigs of ram on the sytem (will obviously be 64-bit Gentoo) and I want to know how much swap I need. The general rule of thumb is twice the ram. In this case, it would be 16 gigs. I think that it may not need swap when up, unless I do some heavy duty stuff. My main concern about a swap partition is how much I need for hibernate-to-disk to work. Is there a rule about this, or should I simply allocate 16 gigs out of my terabyte drive, and play it safe? With 8G of ram, you will likely never ever use a single bit of swap for the entire life of the machine. There is no such thing as a decent rule of thumb for how much swap. What does exist, is the following: What intelligent-sounding (but actually dumb) answer can we give to this infernal question that keeps coming up that will make the user shut up and go away satisfied (regardless of the correctness and workability of the answer)? That answer is, of course, Twice your RAM. Said answer is also, bullshit[1]. If I said 42! it would have made as much semantic sense. Your swap needs depend totally on your usage. There is no rule of thumb[2]. [1] Long ago when 386's were all the rage, 2 X RAM did make some sense. You do not have a 386 and 2 X RAM does not make sense with the hardware you have. [2] If you plan to suspend to disk you will need a certain minimum amount of swap for that. But you already know that, so I'd create that minimum amount. -- alan dot mckinnon at gmail dot com
Re: [gentoo-user] Questions re swap and hibernate interaction on 8 gig machine
Walter Dnes writes: I just got a brand new custom-built 8 gig machine. There's an outfit in north Toronto that has MSI motherboards with PS/2 ports, so I can keep my genuine IBM PS/2 clickety-clack-keyboard; woho. And the integrated Intel graphics chip has *BOTH VGA AND DIGITAL OUTPUTS*! Hooray! Anyhow, I have 8 gigs of ram on the sytem (will obviously be 64-bit Gentoo) and I want to know how much swap I need. The general rule of thumb is twice the ram. In this case, it would be 16 gigs. I think that it may not need swap when up, unless I do some heavy duty stuff. I think this rule does not scale with todays amounts of system ram. If your system would need a similar amount of swap, swapping such a lot would make things really really slow. You could probably live without any swap, except for the purpose of hibernating to disk. My main concern about a swap partition is how much I need for hibernate-to-disk to work. Is there a rule about this, or should I simply allocate 16 gigs out of my terabyte drive, and play it safe? The amount of swap needed is the amount RAM actually being used on your system, compressed. Add the values of the 'used' fields of Mem and Swap in your free -m output, divide by two, and that should be somewhere near the amount you need. Maybe even less if tuxonice frees caches and buffers. 4GB should be more than enough, I'd think. But hibernation also works with swap files, so there is no need to set the exact size already. And I suggest the usage of LVM, this way you can freely and very easily change the swap size as you like. I never install Linux without LVM these days, this flexibility makes things so much easier, and I do not have to care much about partition sizes. Wonko
Re: [gentoo-user] Questions re swap and hibernate interaction on 8 gig machine
On Tue, 2010-06-22 at 00:27 +0200, Alex Schuster wrote: Walter Dnes writes: I just got a brand new custom-built 8 gig machine. There's an outfit in north Toronto that has MSI motherboards with PS/2 ports, so I can keep my genuine IBM PS/2 clickety-clack-keyboard; woho. And the integrated Intel graphics chip has *BOTH VGA AND DIGITAL OUTPUTS*! Hooray! Anyhow, I have 8 gigs of ram on the sytem (will obviously be 64-bit Gentoo) and I want to know how much swap I need. The general rule of thumb is twice the ram. In this case, it would be 16 gigs. I think that it may not need swap when up, unless I do some heavy duty stuff. I think this rule does not scale with todays amounts of system ram. If your system would need a similar amount of swap, swapping such a lot would make things really really slow. You could probably live without any swap, except for the purpose of hibernating to disk. My main concern about a swap partition is how much I need for hibernate-to-disk to work. Is there a rule about this, or should I simply allocate 16 gigs out of my terabyte drive, and play it safe? The amount of swap needed is the amount RAM actually being used on your system, compressed. Add the values of the 'used' fields of Mem and Swap in your free -m output, divide by two, and that should be somewhere near the amount you need. Maybe even less if tuxonice frees caches and buffers. 4GB should be more than enough, I'd think. But hibernation also works with swap files, so there is no need to set the exact size already. And I suggest the usage of LVM, this way you can freely and very easily change the swap size as you like. I never install Linux without LVM these days, this flexibility makes things so much easier, and I do not have to care much about partition sizes. Wonko google has lots on this - this is one with a few ideas. http://www.cyberciti.biz/tips/linux-swap-space.html Generally hibernate (I use TuxOnIce with compression) uses around half the occupied ram size - but you cant guarantee it, and if swap itself is heavily loaded it gets critical. In my case the most swap Ive ever used is 34Gb of a 145Gb swap partition (5G ram, number crunching :) but graphics editing will sometimes require up to 6gb swap in addition to ram. Keep in mind that the maximum swap available varies depending on physical architecture (I think!, cant find the original reference now, but its recapped here: http://ubuntuforums.org/showthread.php?t=606837) My experience is you can create as much swap as you want - but the cpu will only use as much as its capable of - wastage! Note that i386 can only address 2Gb swap in one partition, but you can have up to 32 swap partitions. So its a 'how long is a piece of string' type question. My 'algorithm' is something like: 1. swap is bad, get as much ram as possible 2. use a swap of 2xram 'just in case' that ram is not enough - better that than a crash or oom event - disk space is cheap! Added benefit is almost always enough space for hibernate. 3. use multiple swap partitions with each one on a different physical disk mounted with equal priority to allow striping for performance benefits. The more disks, the more swap partitions! Create them at the start of the disk as thats apparently the fastest place to put them - http://lissot.net/partition/partition-04.html 3. if swap/hibernate space looks like being a problem, hibernate to a file instead (see tuxonice, not sure if the flakey in-kernal hibernate works with a file) 4. on systems expected to occasionally need extra swap keep a swapfile around for instant use, or a script to create one on the fly 5. Tune the kernel swappable parameter to either force most everything to swap to keep ram free or the other way to make it less likely to swap if thats whats needed. The current parameter is a compromise that works in most cases, but there are uses that benefit one way or the other. Lastly, to reiterate, disk space is cheap and putting aside 16Gb for swap is a small price to pay for stability - you may only need it occasionally, but then you will REALLY need it! Have fun! BillK
Re: [gentoo-user] Questions re swap and hibernate interaction on 8 gig machine
Bill Kenworthy wrote: SNIP 5. Tune the kernel swappable parameter to either force most everything to swap to keep ram free or the other way to make it less likely to swap if thats whats needed. The current parameter is a compromise that works in most cases, but there are uses that benefit one way or the other. Lastly, to reiterate, disk space is cheap and putting aside 16Gb for swap is a small price to pay for stability - you may only need it occasionally, but then you will REALLY need it! Have fun! BillK Just for notes, I have 2Gbs of ram. I have ~1Gb of swap. I don't think I have ever seen it use over 100Mbs or so of swap since I built this thing. Most of this depends on the programs you are using. If they use more memory than you have, you need more swap. If not, then maybe not. ;-) If you only want it to use swap when really needed, set it like this or something close: r...@smoker-new / # cat /proc/sys/vm/swappiness 20 r...@smoker-new / # The lower the number, the more it tries not to use swap. The higher the number, the more it will try to use swap. Since I rarely use more than 1Gb, compiling OOo may be a exception, I set mine to 20. My drives are the old IDE and are not as fast as the new SATA drives. Use echo to change that setting just in case you don't know already. Hope that little bit of info helps. This is one of those it depends situations. No matter what you set it up for, you will want to change it later. :-) Dale :-) :-)