Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



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:
  • Erm (Score:2, Funny)

    by Anonymous Coward on Wednesday March 24, 2004 @02:39AM (#8653549)
    Swap file? Modern operating systems use a page file. Get out of your Loonix mind set, hippie.
  • swapping? (Score:4, Interesting)

    by ArmorFiend ( 151674 ) on Wednesday March 24, 2004 @02:39AM (#8653553) Homepage Journal
    Do people still swap? Seriously, I can't remember when I heard my prime dueller do the rumble, and its only got 512 megs of ram.
    • Re:swapping? (Score:4, Informative)

      by Hythlodaeus ( 411441 ) on Wednesday March 24, 2004 @02:48AM (#8653585)
      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.
    • by Enrico Pulatzo ( 536675 ) on Wednesday March 24, 2004 @02:48AM (#8653587)
      I'd say that you don't do anything worthwhile with that computer, then...but hey, that's just me.
    • by BCoates ( 512464 ) on Wednesday March 24, 2004 @03:01AM (#8653635)
      Even if you have enough ram to function without swap space, you should enable it and give it some room so that the OS can swap out as it sees fit to make room for a bigger disk cache.
    • by batemanm ( 534197 ) <batemanm&gmail,com> on Wednesday March 24, 2004 @06:38AM (#8654321)
      Up until 2 days ago my office PC was swapping loads, then again it was a PIII 800 with 256 meg of memory. It was leading to performance problems. My new P4 2.8Ghz with a gig of ram doesn't seem to have the same issues :-) Now I'm just trying to get top to report that it is 0% idle, used to happen a lot on the old machine.

      Yes this post was just an excuse to tell people that I have a new computer :-)

    • by Mr. Piddle ( 567882 ) on Wednesday March 24, 2004 @01:31PM (#8657911)

      Yes, swap is still important to many people, even those with 512MB of RAM or more. With a dozen xterms, Mozilla, OpenOffice, etc. open, starting something like a MCAD application makes swap very very useful (if the OS is efficient about it, that is). Using swap doesn't necessarily mean slow performance, if the OS does a one-time dump of unused pages to the disk allowing the one big app to take what it needs. Switching among several large apps, though, means a purchase order for more RAM is in order.
    • Re:swapping? (Score:2, Interesting)

      by jonadab ( 583620 ) on Wednesday March 24, 2004 @01:58PM (#8658284) Homepage Journal
      > I can't remember when I heard my prime dueller do the rumble, and its only
      > got 512 megs of ram.

      I make it a point to have enough RAM that the system almost never has to use
      the swap space, but I consider it vital to have the swap space there as a
      safety net, because occasionally something uses a whole lot of RAM (e.g., I
      might write a quick-and-dirty use-once-and-throw-away Perl script to process
      some data, and it might store them in a Really Big Hash while doing so, or I
      might have to work with an image in Gimp that's intended to be printed at
      600dpi at 8x10 inches, and I might forget to turn down the length of the undo
      history and perform several memory-intensive operations on the image), and
      the Linux kernel has a tendency to react rather badly to running out of both
      memory and swap space. So, as cheap as drive space is, I like to have plenty
      of swap space available for such occasions. Usually, it's 0% used and 100%
      available, but I consider it an important safety net. I like to have several
      gigabytes of swap space, Just In Case.

      However, if you're using the swap space often enough that you want to optimize
      its speed by putting it on a separate controller, I recommend more RAM instead.
  • Fixed size... (Score:5, Interesting)

    by Motherfucking Shit ( 636021 ) on Wednesday March 24, 2004 @02:43AM (#8653571) Journal
    The general advice that I've picked up is that, at least in the *n?x world, you should create a swap partition which is double the size of the machine's physical RAM. For example, if you're sitting on 512MB of RAM, a 1GB swap partition is appropriate.

    You only mention Windows towards the end of your question so I can't tell whether or not you're looking for a Windows answer. I've always allowed Windows to resize its swap file, but within a small window. This machine (Win2K) has 640 megs of physical RAM, and the swap file is set at 1280 minimum, 1960 maximum; that gives Windows "double the real RAM," but not a license to take over the whole drive. Seems to work well for me.

    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.
    • Re:Fixed size... (Score:3, Informative)

      by zatz ( 37585 ) on Wednesday March 24, 2004 @03:22AM (#8653705) Homepage
      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.
    • Re:Fixed size... (Score:3, Informative)

      by Brandybuck ( 704397 ) on Wednesday March 24, 2004 @03:42AM (#8653754) Homepage Journal
      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.
    • Re:Fixed size... (Score:3, Informative)

      by WSSA ( 27914 ) on Wednesday March 24, 2004 @04:19AM (#8653889)
      Don't let Windows resize the swapfile - that's a surefire path to fragmentation, fragmentation = slowness.
    • by larien ( 5608 ) * on Wednesday March 24, 2004 @07:26AM (#8654468) Homepage Journal
      2*physical RAM is an old rule of thumb which falls over on large systems; we have one server with 16GB of RAM and we don't really want to allocate 32GB of swap space which should never be used as a rule.

      In most cases, servers should never swap; most systems these days only have swap as a space for crash dumps; both Solaris and Windows do this.

      Also, as others have said, leave Windows page files at a constant side to avoid fragmentation; this is one thing which the *nix world has definately got right.

    • by unixbob ( 523657 ) on Wednesday March 24, 2004 @07:37AM (#8654509)
      That was valid in the old BSD days, but newer paging algorythms no longer need this.
    • by Rick the Red ( 307103 ) <[moc.liamg] [ta] [deR.ehT.kciR]> on Wednesday March 24, 2004 @02:06PM (#8658394) Journal
      A lot of people here have repeated the old advice to make swap twice your RAM. OK, so in the days of 16Meg RAM that would mean 32Meg of swap, for a total of 48Meg. So why would a 64Meg machine need any swap?

      I'm not flaming or trolling, I'm serious. Even if running a GUI (which never happened in the days of 16Meg machines, and don't mention X Windows because I know for a fact the serious number cruning workstations didn't waste their precious RAM on X -- remember, we're talking "back in the day" here) even if running a GUI sucks up the RAM we could go an order of magnitude higher these days, to 640Meg. That oghta cover KDE or Gnome. So why should a modern computer need any swap space, let alone twice as large as today's typical RAM?

      • by AlecC ( 512609 ) <aleccawley@gmail.com> on Thursday March 25, 2004 @07:46AM (#8665854)
        Why should one not swap out program and data structures that one is not using, and free up ram for high-turnover uses such as disk caching? Given that disk space is cheap and the page swapping system exists, you might as well make use of it. I agree that, if one were developing a new OS with todays hardware, it is arguable that you shouldn't bother with a swapping mechanism (though the inifinite ability of people to use up processor power makes me doubt this). But since we have the swapping mechanism, you can effectively buy $100 worth of extra ram for about $5 (the cost of the disk space). Sounds a good deal to me.
    • by MikeDawg ( 721537 ) on Thursday March 25, 2004 @02:49AM (#8665004) Homepage Journal

      The only problem with this (which doesn't make much sense in my mind) and as a caveat, I would say for "modern OSs", why would you need to double the amount of swap for more RAM you put in the system? You'd think that you would need to use a decreasing amount of swap with the more memory you put in your system?

      The only thing I could possible figure out, is that if ALL your RAM dumps all of its memory to the swap at once; but again, what OS does this, I'm quite sure that Linux (modern) doesn't do this, are there any modern OSs that do this?

    • by Angry Pixie ( 673895 ) on Thursday March 25, 2004 @03:42AM (#8665184) Journal
      A technique we Windows users have suggested for years has been to set the minimum and maximum swapfile/pagefile size to the same value equal to twice the amount of real RAM you have. Back under Windows 3.11 we had to type in the settings in our Windows configs. This technique has stuck really only out of habit though. At one time the formula was 2.5 x RAM. You can probably go lower. On Linux I used a swap filesystem equal in size to my real RAM, and I had no problems.

      I've always found storing Swap/pagefile on a separate drive off my main drive has given me better performance especially when running data mining/modelling or video editing software. Video capturing to a drive that is sharing your Pagefile can be a real drag.

      Maybe using a separate channel will result in bandwidth increases for the writes and reads on the swap disk. Eh??? But if it did, considering the speeds we're dealing with today, would it even make a noticeable difference?

      For security, I like to put my pagefile on the dame physical drive I store other short-term data (emails, photos, etc - anything personal not put to disc right away). The reason is that I figure the pagefile contains a lot of data that might be personal. Is there any sense to this? I also have Windows set to delete the pagefile on shutdown so...
    • by Wolfrider ( 856 ) <kingneutron@nOsPAm.gmail.com> on Thursday March 25, 2004 @08:19AM (#8665946) Homepage Journal
      --You shouldn't follow such advice blindly, without monitoring how much swap actually gets USED... Otherwise that 1GB of disk is completely wasted.

      --Example: 900MHz AMD Duron, 512MB RAM
      swapon -s
      Filename Type Size Used Priority
      /dev/hda5 partition 257000 0 3
      /dev/hdb5 partition 514040 0 3

      free

      total used free shared buffers cached
      Mem: 516196 232612 283584 0 24876 85448
      -/+ buffers/cache: 122288 393908
      Swap: 771040 0 771040


      --Note that the swap "Used" count is Zero.

      --Granted, all I have running ATM is Opera, rxvt, Konsole, Sawfish and a few daemons. But even recompiling the kernel will only use <100MB of RAM (usually much less.)

      --Monitor how much swap you use on a daily basis with various tasks. I'll bet you can resize your swap partition down to == the RAM or even a bit less, if you're not worried about suspend-to-disk.

      --From personal experience, the more RAM you have - the less swap you need. If you have installed 256MB-512MB of RAM, unless you're *really* pushing the machine, you only "need" about 300MB of swap.

      --If you've got ~128MB of RAM (typical older Windoze machine), 300-400MB of swap should be fine even if you're running KDE, XMMS, and a kernel compile all at once.

      --1GB of swap actually being *used* is almost unheard of, even if you only have 64MB of RAM; the machine would be so slow as to be almost unusable, and eventually the hard drive would go up in flames from disk thrash. (I've seen it happen with XP. I think the client had only 128MB of RAM installed, and XP swap thrash forced us to reinstall and repartition the disk around the bad sectors.)

      --AFA putting the swap on its own drive - Make sure the drive can handle DMA. If you implement it and it works well enough that you don't notice the difference, go for it. :)

      stupidassfkgslashdotlamenessfilter-POS-Ireallyfk g- hateititssodamnstupid-fixtheidiotlamenessfilteryou lazy-ass-sysadmins
  • Dedicated (Score:2, Informative)

    by yosemite ( 6592 ) on Wednesday March 24, 2004 @02:45AM (#8653575)
    It is better
  • by viware ( 680138 ) on Wednesday March 24, 2004 @02:49AM (#8653591)
    My experience has always been to give windows a fixed page file, at twice the RAM size (ie. 512MB RAM so 1024MB page file). Further, a separate physical drive is the best scenario, or second best is a separate partition.

    It is important to note that WindowsXP will use the page file whether you've got plenty of RAM or not.
    • by kayen_telva ( 676872 ) on Wednesday March 24, 2004 @09:34AM (#8655097)
      I've never understood the reasoning behind "I have more ram, so I make a bigger swap file".

      Seems counterintuitive. Does anyone know why this is ??
      • by Zeriel ( 670422 ) <sholes@athertonia. o r g> on Wednesday March 24, 2004 @11:15AM (#8656125) Homepage Journal
        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.
      • by perlchild ( 582235 ) on Wednesday March 24, 2004 @05:40PM (#8660942)
        Psychology, you have a faster computer, that can do more tasks, and you can multitask, so you will run larger tasks that take more ram, and that swap WILL be used.

        The other reason is that you have some recurring processes(scheduled tasks, crons, disk defrags) that run at times when the machine is supposed to be idle, but may just be busy. With larger swap, you avoid a crash, by risking more swapin/swapouts.
    • by Quarters ( 18322 ) on Wednesday March 24, 2004 @10:20AM (#8655548)
      It is important to note that WindowsXP will use the page file whether you've got plenty of RAM or not.

      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

      • by JeFurry ( 75785 ) on Wednesday March 24, 2004 @12:27PM (#8657024)
        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

        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...
  • by derrith ( 600195 ) on Wednesday March 24, 2004 @02:50AM (#8653592)
    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.
  • by Anonymous Coward on Wednesday March 24, 2004 @02:50AM (#8653593)
    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.
    • by Prowl ( 554277 ) on Wednesday March 24, 2004 @06:18AM (#8654260)
      but putting them in the middle of the disk will on average reduce the seek time.
      • by MarcQuadra ( 129430 ) * on Wednesday March 24, 2004 @08:56AM (#8654805)
        only if your files are spread evenly throughout the entire disk. I know most of MY disks are only using 2-3 GB of the 40-80 available.

        The exception is the 'storage' drive on the server, and that's only holding files, not serving as a swapper or system volume.

        I've had the best luck in 2.6 with using a swapfile instead of a partition, and making the swapfile with 'dd' and 'mkswap' after the base system is installed and before I lay down all the other stuff. That places the swapfile close to the most-used application files and towards the outer end of the disk. I use a 512MB swapfile on all of my machines, most have 512-1024MB RAM and since I've been doing things this way I've only ever used about 3MB of swap (linux pages out unused stuff after a while).

        2.6 has a system whereby it can use a swapfile just as efficiently as a separate partition (it bypasses the filesystem layer to access it?).
        • That places the swapfile close to the most-used application files and towards the outer end of the disk.

          How do you know? One of the features of ext2/3 is the way it avoids fragmentation by randomly placing files all over the partition, unlike FAT16/32 which fills the partition from start to end.

          The only way to optimize the location of swap space in Linux is to use a dedicated swap drive, or place the swap partition between /boot and /.
          • by MarcQuadra ( 129430 ) * on Wednesday March 24, 2004 @03:35PM (#8659448)
            to some extent, yes, but I've seen improved app launch times from 'defragging' my reiserfs '/' partition (tar the files, reformat, untar to same place). This leads me to believe that there is, in fact, a structured 'closest to the top' file placement scheme in reiserfs. in any case, having the swap as a file inside '/' as opposed to a partition far away on either side of it seems optimal in 2.6, given that you only have one drive to work with.

            Even with multiple drives, running swap and '/' on the fast one might be advantageous, my drive has an 8MB buffer, and most writes to swap are much smaller than that, while an old 2GB drive likely has only a 512K buffer. If there's 4MB that the kernel wants to page out it'll go at 'wire speed' to the bigger drive, while the older 'dedicated' drive might have to swallow it in chunks as it commits.

            The real question is why should we worry about swap optimization AT ALL. I've got a 320MB system and it's never used more than 15MB of swap, and the activity on the swap was absolutely minimal. My 'bigger' systems almost never page out. You're much better off just making a smallish swapfile inside your filesystem and not having to deal with any more partitions than you need, the small amount of sanity this affords you should greatly outweigh the 'half-second over three weeks' of difference it makes in performance.
    • 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.

      So will Windows (NT, 2k, XP).

      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.

      Putting them in the middle of the disk to minimise seek time would be a better plan - swapping generally entails lots of small, random reads and writes, not long, continuous reads and writes. Not that physical location makes a whole lot of difference these days.

  • by sICE ( 92132 ) on Wednesday March 24, 2004 @03:00AM (#8653632) Homepage
    This [ibiblio.org] Linux Mini-HOWTO might be of interrested to some /.ers, it describes how to share your Linux swap partition with Windows.
  • Good Results (Score:3, Interesting)

    by harryk ( 17509 ) <jofficer@@@gmail...com> on Wednesday March 24, 2004 @03:01AM (#8653636) Homepage
    I too am in a similar environment as yourself. I took it one step further, and also setup the temp variables to use the same drive.

    I've noticed significant performance increases since doing, not to mention that I've freed up some space on other, more important drives.

    Good luck!
  • by WarPresident ( 754535 ) on Wednesday March 24, 2004 @03:07AM (#8653653) Homepage Journal
    An old, surplus, dedicated swap drive on its own channel: $0.00

    A RAMdrive from system memory: Under $100 [cenatek.com]

    A solid state disk drive you shove into a PCI slot with a bunch of SDRAM on it: Priceless [cenatek.com]

    For everything else, there's, Hey! Why would I pay more than a grand for a PCI bandwidth capped solid state drive when I can fill my memory slots and use RAMDrive at DDR bandwidth?

  • 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.
  • Absolutely!!!! (Score:3, Informative)

    by OC_Wanderer ( 729511 ) on Wednesday March 24, 2004 @03:10AM (#8653661)
    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.]
    • by Mr. Piddle ( 567882 ) on Wednesday March 24, 2004 @01:35PM (#8657983)
      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.

      For Solaris 8 and 9, at least, /tmp is swap (and RAM, using virtual memory for storage). This makes doing file operations in /tmp very very fast, but the user always has to take into account the amount of virtual memory on the system.
    • by Lord Kano ( 13027 ) on Wednesday March 24, 2004 @05:07PM (#8660559) Homepage Journal
      From Windows XP back to Windows 95, gurus have suggested a fixed size of 2 or 2.5 times the size of your RAM.

      That advice goes back to the days of Win 3.1, probably even further back, and it's bullshit. Any "guru" who makes such a blanked suggestion is talking out of his ass. He read it once ten years ago and is just parroting it.

      The point of having so much RAM is so that you don't need as much virtual memory. I have 512 MB in my current machine, it would be idiocy to use 1.25 GB of my HD for swap that I don't need. If I was running bigger programs, or needed to run more programs at once, I'd buy more RAM.

      Currently I'm letting Windows handle the swap on its own, it has allocated 768 MB for my swap. The task manager shows that I'm currently using 167 MB of that swap file.

      I couldn't agree more with the benefits of swapping to a different drive, but as for the swap/page/virtual memory. Don't believe the hype.

      LK
  • by Elivs ( 43960 ) on Wednesday March 24, 2004 @03:11AM (#8653666)
    I have two ide drives and 512M ram. I have the first 512M on each drive as a swap with linux stripping the swap. (See "man 2 swapon", "man swapon", "man 5 fstab" and set the priorities of each partion to be the same) I did this on the assupmtion that the bottleneck is likely to be disks's read/write speed, not the controller.


    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...

    • Controller limitations on IDE drive subsystems mean one read/write process at a time - thus putting half your swapfile on one drive and half on the other really don't gain you anything on an IDE system.

      If you had one drive on one controller, the other drive on a different controller (or if you were using SCSI) and you will see gains.

      That said, if your system seems swap limited watch the memory utilization - if your system has 512M and it is using all 512M of it, add more RAM for better performance (disclaimer - I have no clue whether or not your OS will use more than 512M but if it does, go for it.)

      Good news in you are looking at going to Windows - starting with Windows 2003 they are 'seeing crazy uptime numbers now, like three months' [microsoft.com].
  • by PurpleFloyd ( 149812 ) <zeno20&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.

  • by Phexro ( 9814 ) on Wednesday March 24, 2004 @03:18AM (#8653693)
    You don't specify how much RAM your system has, nor how much you actually use your swap space.

    If you really hit your swap hard, then I guess installing a dedicated swap drive would make sense. Of course, so would upgrading your RAM, which would have a much more positive impact on your system's performance, and without the additional heat, noise, and power consumption that adding another drive would.

    As another poster mentioned, the rule of thumb is to have twice as much swap as physical ram. Personally, I think that's outmoded, and I don't see the point in even having a swap partition equal in size to a system's physical ram. I have 512mb in my desktop box, and I rarely hit my swap. Right now, I'm running a slew of apps, and I've only hit 5mb of swap.

    In short, it may be an interesting exercise, but it's probably not worth it.
  • by Eneff ( 96967 ) on Wednesday March 24, 2004 @03:31AM (#8653730)
    Because not only will you get to play with antiquated technology, (yeah... 2GB is antiquated now.) but you get not one but two slashdot articles out of it!

    Just remember, you have all your time to avoid the slashdot effect, so you better have mirrors, boy. There ain't no excuse!
  • by skinfitz ( 564041 ) on Wednesday March 24, 2004 @04:23AM (#8653905) Journal
    Does it make sense to install the 2GB drive on its own controller and use it for a dedicated, fixed swap file?

    Yes.
  • by Kopretinka ( 97408 ) on Wednesday March 24, 2004 @05:28AM (#8654121) Homepage
    Just my 2c: I used to own a machine with limited RAM but with two HDDs. I split swap on dedicated partitions on both drives with the same priority (in Linux, I don't know if Windows can do this) and when I needed to swap, the performance increase was huge.
  • One Word Answer: No (Score:5, Informative)

    by silverfuck ( 743326 ) <dan...farmer@@@gmail...com> on Wednesday March 24, 2004 @05:28AM (#8654123) Homepage
    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.

  • by jcasey ( 264935 ) on Wednesday March 24, 2004 @06:38AM (#8654323)
    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.
  • 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 NerveGas ( 168686 ) on Wednesday March 24, 2004 @05:55PM (#8661105)
      Real world experience - Rally Championship 2000 - swap file on the same drive as the game...

      The last time I had a game use swap was Warcraft III on a 256-meg machine, and saw slowdowns like the one you mentioned. Rather than put swap on another drive, I stuck another DIMM in the machine, and the problem was solved. : )

      steve
  • by MImeKillEr ( 445828 ) on Wednesday March 24, 2004 @09:00AM (#8654824) Homepage Journal
    ..is to put the swap on a drive other than the OS (not just a different partition), and on a different channel. I've also heard to put the swap start/stop at the same size (so its not fighting the filesystem for space) and to have the size be 2.5 to 3 times the amount of physical RAM installed.

    If you're running Windows NT/2000/XP, make the partition in question NTFS too.

    I'm running XP Pro with 512MB of PC2100 and have my swap start/stop at 2GB (ok, 4x my RAM) on an NTFS partition. The little trashing I do have is because that partition also contains game files and downloads from bittorrent.

    I imagine if you're using a 2GB drive solely for swap and nothing else, you may not have any thrashing at all.

    How reliable is that 2GB drive though? I guess it doesn't really matter, cause if the drive fails, the OS should move the swapfile back to the default location.
    • by NerveGas ( 168686 ) on Wednesday March 24, 2004 @05:51PM (#8661052)
      If you're running Windows NT/2000/XP, make the partition in question NTFS too.

      Why? NTFS is slower than FAT, offsetting the gains you might have made by your other tweaks. If you're worried about someone being able to read what's on the partition easily, well, they still can if it's NTFS.

      How reliable is that 2GB drive though? I guess it doesn't really matter, cause if the drive fails, the OS should move the swapfile back to the default location.

      If the drive fails, you've just experienced roughly the same thing as if you'd pulled a stick of memory out of your computer while it was running.

      steve
      • by MImeKillEr ( 445828 ) on Thursday March 25, 2004 @09:04AM (#8666109) Homepage Journal
        Why? NTFS is slower than FAT, offsetting the gains you might have made by your other tweaks. If you're worried about someone being able to read what's on the partition easily, well, they still can if it's NTFS.

        Slower how? In accessing files? This is just for the pagefile. And NTFS is better as far as fragmentation goes - less fragmentation with NTFS than FAT or FAT32.

  • by phrasebook ( 740834 ) on Wednesday March 24, 2004 @09:02AM (#8654837)
    I've got a pretty standard computer with reasonably fast drives.

    So you don't need to do anything. Leave it alone. You're not going to notice an ounce of difference. All you'll be getting is the extra noise and heat of another hard drive, which will be rarely, if ever, be getting accessed. No need to do it.
  • 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 -

  • by millia ( 35740 ) on Wednesday March 24, 2004 @01:02PM (#8657505) Homepage
    separate drives, esp. on a separate channel or controller, will always help.
    but if you're dealing with xp, you can also gain some speed by NOT using ntfs on that drive. instead, use fat32- your swap file is not a file that needs full ntfs (permission or security or compression or encryption) complexity.
    combine that with a fixed size, from the word go, and you can get very nice speed bumps.
  • by TheSHAD0W ( 258774 ) on Wednesday March 24, 2004 @02:19PM (#8658576) Homepage
    If you've got to swap, then yes, a separate drive to use for swapping is the way to go. It will prevent thrashing between your swap partition and your main partition when working with large executables or large blocks of data. You'd still be better off, however, by blowing some cash to get 2 gigs of RAM and disable swapping entirely.

There are two ways to write error-free programs; only the third one works.

Working...