Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Data Storage Operating Systems Software

Swap File Optimizations? 177

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?"
This discussion has been archived. No new comments can be posted.

Swap File Optimizations?

Comments Filter:
  • no sense in that (Score:3, Insightful)

    by zatz ( 37585 ) on Wednesday March 24, 2004 @03:08AM (#8653656) Homepage
    First, if this is a workstation for one person, not an application server, then you are not likely to feel performance is acceptable when paging does happen, regardless of the device where swap resides. Just because your OS installer insists that you allocate swap space doesn't mean you should use it often.

    Second, transfer rates have increased about ten-fold since that drive was manufactured. (Access times haven't.) While it is ideal to have swap space on its own spindle and controller, it doesn't make much sense to optimize details like that but use such a slow disk.

    Just make a swap file on your system disk and forget about it. If the rest of the machine is new, it should have enough physical memory that swap is mostly irrelevant.
  • by PurpleFloyd ( 149812 ) <`zeno20' `at' `attbi.com'> on Wednesday March 24, 2004 @03:14AM (#8653679) Homepage
    As far as using the HD goes, it sounds like a good idea, albiet with some conditions:
    • If you're planning on spending any money on this, it would be better off going towards more RAM.
    • If the drive isn't as fast as your primary HD, it may not be as good a deal as you might think. Remember that the non-DMA access modes used by older IDE drives, can eat up your CPU and thus any performance gain. Of course, this isn't an issue with SCSI if that's what you're using.
    • If you use an app that has its own scratchpad requirements, you might want to put that on the drive rather than your Windows swapfile. Photoshop comes to mind immediately as an example of where this would be a good thing; it might also be good for dumping processed video onto (although if you're doing major video work, you should have a fast, preferably RAID-0, scratchspace, along with more reliable storage).
    As far as a fixed-size swapfile, it should help some in Windows; when you defrag, it will help to keep your swapfile coherent as much as possible. Of course, if the swapfile is the only thing on the drive, it won't matter too much. If you do go for a fixed size file, make sure to make it larger than you ever think you'll need - it sucks to run out of memory when you're doing a lengthy, complex operation. One rule of thumb (not as valid these days) is to set your swap to 2x your physical memory. Another, which I use, is to simply take the most memory you'll ever think you'll use and then add a 50% safety factor. Remember to resize this if you ever start working with really large stuff - high-res video, 3000 x 3000 pixel Photoshop images, etc.

    Finally, remember that idealy, you never want to hit swap at all. If you're experiencing problems with thrashing, you should probably either pare down your system (do you really need to run that IM program all the time? all those systray utilities you never use?) or simply bite the bullet and get more RAM. Even the fastest hard drive can't touch RAM for speed, and seeing your system hit the pagefile for routine tasks means it's time to put a new stick of RAM into the beast.

  • Yes, definitely (Score:2, Insightful)

    by BoogieChile ( 517082 ) on Wednesday March 24, 2004 @08:12AM (#8654626)
    I've always gone for the extra channels when I'm buying a motherboard. Windows and apps live on one drive, swap/temp files and data on the other.

    Real world experience - Rally Championship 2000 - swap file on the same drive as the game - loading times were long - 30 seconds or more. The indicator bar would move for a bit, stop for a bit, move for a bit, stop for a bit...

    Change the swap file to the other drive and the level loading time went away. 18 seconds.

    And the progress indicator keeps moving all the way with no pauses.

    Think of it as the difference between having to do everything one handed (read this bit off the drive, track all the way across the platter to the swap file, write that bit there, track all the way back across the platter for the nexct bit of reading, etc, etc, etc), and having two hands (read with the right, write with the left)

  • by pointbeing ( 701902 ) on Wednesday March 24, 2004 @10:55AM (#8655905)
    Apparently we're dealing with Windows, so I'll chime in ;-)

    Depends on your PC and what you do with it. Putting the swapfile on the outside edge of the fastest disk that does *not* have Windows on it is generally the best idea. If you're concerned about dissimilar PIO or UDMA transfer rates, if your IDE controller supports multiple media transfer rates (most IDE controllers built after about 1998 do) you don't have anything to worry about. There's no reason I can think of to have multiple pagefiles on a Windows machine unless it's a server or you're heavily into A/V.

    Re size of the paging file: A static swapfile is always going to perform better than a dynamic one - provided the static file is big enough. Here's whatcha do -

    Use Performance Monitor to measure swapfile use over a week or two. You'll be able to tell exactly how much paging file you need from that. Take a couple hundred MB onto that number just for grins and make it a static pagefile.

    Paging to disk is always slower than using real memory - but some applications (one of them being Internet Explorer) *require* a swapfile. My XP box is a dual processor 1GHz machine with 384mb of memory. It's usually just used for surfing the web and a bit of word processing, but I've never seen more than about 10% of its 768mb static pagefile in use.

    Hope this helps -

Kleeneness is next to Godelness.

Working...