Swap File Optimizations?
fastswap asks: "I've got a pretty standard computer with reasonably fast drives. I've got an old 2GB-but-fast drive, and a spare channel on the motherboard. Does it make sense to install the 2GB drive on its own controller and use it for a dedicated, fixed swap file? I figure if the computer's using the swap file, then in the current setup with the swap file on the primary controller, then it's contributing to hard drive thrash exactly when one doesn't want it to (i.e. when the machine needs the swap file). If it is better to have a dedicated swap file on its own controller, is the same true for other operating systems with similar approaches to virtual memory? Since drive space is so cheap now, should the swap file be fixed size anyway rather than letting Windows suddenly get the urge to resize the thing?"
It is better
As is often the case, games are making some of the greatest demands on hardware. Many current games fill 300 or more MB by themselves, and right now I'm sitting on 225 MB with Mozilla, Word, and mIRC open.
For great justice.
I've done this under linux, say get a 2-6GB drive and use it as dedicated swap. I tend to do this with scsi servers when I'm patching together old gear. Say an 18GB root drive and then the smaller drive as dedicated swap. leaves everything open. And if the swap drive does get thrashed, no big deal. It's quite effective and works well in my experience.
why does the porridge bird lay his eggs in the air?
Dedicated is better.
However, you will never get true swap performance using Windows.
To do that you need a real operating system. Linux will let you put one swap partition on each controller, set them to the same priority, and it will automatically spread the access between them, getting a RAID-like speedup in your swap access times.
Also, remember to put swap partitions (if you are using files you are hopelessly fucked) on the end of the disk, so that they will be on the outer sectors where the transfer rate is fastest.
This Linux Mini-HOWTO might be of interrested to some /.ers, it describes how to share your Linux swap partition with Windows.
-- search the web
From Windows XP back to Windows 95, gurus have suggested a fixed size of 2 or 2.5 times the size of your RAM. I keep it at 3 times, because I have CRS disease and can't remember the exact size. Better safe than sorry, since I have the room.
Swapping on a separate drive is faster than swapping on the same drive. I've tested that. I also put the "temp" directories on the separate drive, as well as the data directories for my applications. This includeds the mailbox for Outlook Express and the temporary internet files for Internet Explorer.
There's a big bonus to setting up like this, besides performance. There's less to backup from C: drive!
[Contrary to popular belief, not all nerds and geeks use OSS.]
-- There is no spoon. Only fork.
Like you I'm also not sure if it makes much difference but my system certainly seems to often be swap limited. I currently have KDE3, several gnome apps, a browsers with 4 windows (20+tabs), 2 virtual desktops, and I often use octave to process high resolution images. Changing from one app to another can cause the machine to swap for a few seconds if I've haven't used the first app in a few hours/days.
Elivs
Clearly if I used windows I wouldn't have these problems as I could never leave apps idle for days while doing another task.
/me Ducks as an "MS wireless mouse" flies towards me...
If security is a concern, set Windows to use a fixed swap size, i.e. the minumum and maximum values should be identical. Then, install Eraser (GPL), which offers the ability to wipe the swap file during the reboot process.
I think the recommendation of "at least twice physical memory" makes sense only with a VM system which employs a one-to-one mapping between allocated pages and disk blocks. I do not believe either Linux or Windows works this way.
Java: the COBOL of the new millenium.
I've never tried putting the swap on its own channel or controller - or even on its own drive - under any OS. Like you, I'd be interested in hearing whether or not this is worth the trouble.
I still do this, but with 1G of RAM, I never swap anymore. Back back when I had a 100MHz system and 32M RAM, putting the swap on another harddrive made a significant difference. That was with Linux. Since Windows uses a swap file instead of a raw partition, so it might not make much of a difference.
Don't blame me, I didn't vote for either of them!
Don't let Windows resize the swapfile - that's a surefire path to fragmentation, fragmentation = slowness.
Okay, so this is too late for all but the most sad of slashdotters to read it, but here goes:
If the drive is 2GB, then don't be so sure that it is fast - it may have been when it was bought, but that was 6 or so years ago at least. I would be very suprised indeed to see more than 4-5MB/s sustained read and 2-3 write; there have been a lot of advances in the last few years.
My current setup (1GB physical RAM) has 2GB set aside for each of Win2k and Linux in seperate partitions right in the middle (this will speed up average access times as the heads will have the least far to travel on average from any random point over the platters) of the raid array (and hench middle of both disks, as it is RAID-0), which I know to be fast - benchmarking has pegged it at greater than 110MB/s sustained. Windows will hit the swapfile no matter what (just try setting the swap to 0, even on a well-heeled system, and watch it complain at bootup/logon), so it gets 512MB to play with just at bootup and can go all the way to the end of it's swap partition if it wants. Linux, well, that's another story (currently support for the raid array is patchy, so not running linux - the partitions are still there, though, waiting for filsystems!), but as everybody knows, linux is very aggressive about swapping stuff out and using physical RAM as a disk cache, so again I expect it to hit the swapfile after a few days (hours?) running, but be perfectly happy with 2GB.
You know you've been IMing too long when you almost say 'lol' out loud to a non-geeky friend...
If thrashing is causing degradation, I would seriously consider increasing RAM before improving on the swap drive.
Check the performance specs for that 2gig drive first. If you are connecting an older, slower drive, you may actually worsen performance. For best performance, use a drive that can supports whatever performance features your mobo offers ( UDMA-66, Serial ATA, etc... )
IF using Windows 2000/XP you can spread your page file accross multiple hard drives.
X
Putting swap in a RAM disk makes no sense what-so-ever.
You can instruct XP (and probably 2K) to not page the executive and to use more memory as cache space. This reduces the amount of paging significantly.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contro l\Session Manager\Memory Management
*Change DisablePagingExecutive to 1
*Change LargeSystemCache to 1
*Reboot
Putting more ram in the machine instead of adding another power consuming hard drive will give you a much better performance boost.
Well, back in the good old days when 4MB was "more RAM", you generally only had a machine with relatively large amounts of RAM if you were processing a similarly large amount of data.
Joe User would have a machine with 4MB RAM and 8MB swap for his word processing and Ultima 2 or whatever.
Stan Scientific would have a machine with 32MB RAM and 64MB swap because he probably was going to eventually have to deal with datasets larger than 32MB (if you've done ANY scientific computing over historical datasets, you know what I mean).
Basically, more RAM implies you should be swapping less, for a home system.
But for a server or high-end processing computer, more RAM implies you need vast amounts of RAM in general, and swap doesn't hurt.
"America has done some terrible things. But I know that Americans don't cheer when innocents die." -Dave Barry
You can instruct XP (and probably 2K) to not page the executive and to use more memory as cache space. This reduces the amount of paging significantly.o l\Session Manager\Memory Management
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contr
*Change DisablePagingExecutive to 1
*Change LargeSystemCache to 1
*Reboot
True, but doing this disables standby and hibernate modes, since the kernel can't be unloaded any more. If that's not a problem for you, go ahead of course, but it's worth being aware. I did this, and kept finding my system going into standby on request, but never resuming, and it took me ages to find out why...
-- What goes up must come down. Ask any SysAdmin.
Dewey, what part of this looks like authorities should be involved?