-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 At some point hitherto, Jerry Feldman hath spake thusly: > Someone sent me email regarding swap space. He mentioned that on memory > larger than 512M, one does not need swap. I disagree, but I would like to > get some educated opinion on this. The answer is somewhere in the middle. The purpose of swap is to simulate real RAM, and it is needed if and only if you don't have enough physical RAM to accomodate your running processes. It essentially acts as a safety net, for when your applications (and the operating system) use more memory than you have physical RAM. So, if you're on a busy server with lots of active processes, you're going to either need to have a huge amount of physical memory, or a good amount of swap. On a single-user desktop, if you've got 1/2 GB RAM, you probably don't really need any swap. This fallacy irks me; I just installed RH8 on my laptop, which has 384MB physical RAM. This is far more than I could ever hope to use by running Mozilla and mutt. :) The install complained that I didn't have >700MB of swap configured. Well, my laptop's been up for days, with everything I run currently running, and it's using about 4MB of swap. So why should I waste 700MB? OTOH, the VM system of the Linux 2.4 kernel swaps more aggressively than either earlier Linux or typical commercial Unix systems. If you have the swap space, it'll probably make use of it at some point. I don't understand the reasoning, but the developers seem to have favored keeping large amounts of cache around to keeping inactive applications in memory. This might make sense on a server, but I find it irritating on a workstation... I needed to add what I would otherwise consider too much RAM to my systems to keep my apps from paging out on me. > Historically, one would configure swap to be 3 X memory. However > today with memories typically larger than 100MB, this has changed. Many people still advocate that you configure 2-3X memory for swap, but on the typical user workstation with > 128MB RAM, running typical applications, this just really isn't necessary. In most cases, it's downright silly. So, if I have 4GB of physical RAM, I'm going to allocate an entire hard drive to swap space? This might be necessary for a few specialized applications, but in most cases, it's preposterous. > One reason to have swap on a desktop system is for core dumps. Why? On Linux systems, the kernel doesn't dump core without specialized patches, and so doesn't dump core to swap, like some commercial Unix systems do. User processes that dump core do so to a file on the filesystem. > First, a typical desktop Linux system with 512MB or more of memory. ...probably doesn't need any swap, in practice. > Second, a server where you are stuck with a configuration since you don't > want to take the server down. There's no such thing. Even Unix/Linux systems periodically need to be taken down for maintenance, though certainly not as often as their MS counterparts, typically. However, obviously if you're in a pinch, it's easier to add a swap file to the system, than it is to add physical RAM. Even still, if your applications have more than enough RAM, then there's no reason to have swap, other than as a safety net... > Thirdly, a desktop system running specialized applications, such as CAD, > which may require large memory configurations. Again, if you have enough memory, no swap is needed. Through experience, I've formulated the following theory on virtual memory configuration. If you have a good idea of how much RAM your applications will use (and you should, either from experience, or by pre-implementation testing for an app with which you're not familiar), configure your VM to have at least 50% more than you think you need, favoring RAM as much as possible. Unless money is no object, in which case I'd just configure double the amount of physical RAM I think I'd need, and add a fairly minimal swap partition (< 1/2 GB). Now, that said, disk space is cheap. It's much better to have extra swap space lying around, than to have some critical application die on you because the system ran out of virtual memory, especially on a system whose memory usage fluctuates wildly and is hard to predict. OTOH, right now RAM is really cheap too; if performance is an issue, adding RAM is probably a better investment, as it's really cheap, and orders of magnitude faster than disk. If you can afford it, you always want your applications being serviced by physical RAM, rather than having to be paged in and out of memory. - -- Derek D. Martin http://www.pizzashack.org/ GPG Key ID: 0x81CFE75D -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE9odDudjdlQoHP510RAsNTAKCtksYIyy4SCw0kX7UV/T6Y1/pZvgCgvV60 wMMdwmViqzioM7OsVsSr0Pg= =ybX3 -----END PGP SIGNATURE-----