Results 1 to 17 of 17

Thread: swap file on another drive

  1. #1
    Join Date
    Feb 2002
    Location
    York, PA, USA
    Posts
    339

    Default

    I searched the database looking at the feasibility of putting the swap file not only onto another partition, but one another drive as well. Funny, but I came up with one of my own questions from a few weeks ago: Rick talks about trying to RAID the four fastest partitions on drives for a superfast photoshop swap file (see http://www.macgurus.com/ubb/Forum1/HTML/000268.html).

    Anyway, I am still not sure if it can be done and if it can, are the performance benefits worth it. I would assume so, since your swapfile on a second drive is always ready to go and doesn't require the harddrive arm to move back and forth across the disk from the swapfile partition to the partition with your system/apps/docs on it?

    Or is there some speed loss for data transfer between the cables and controller that makes performing such a modification no different than having the swapfile on the same drive (albeit, on a different "faster" partition)?

    I'd like to give it a try once I get my new drive from Seagate, but figured I'd field the question here to see if I am wasting my time.

    Thanks,

    Anthony

  2. #2
    Join Date
    Jan 2001
    Location
    Mobius Strip
    Posts
    13,045

    Default

    If you have at least 512MB of RAM, forget it. This isn't linux. Run terminal and give it a "top -au" command and see what the pagein/out shows (cumulative). Also, vm_stat.

    They guy that wrote Carbon Copy Cloner has tips on how to move swap. There is a small utility Swap Cop to move it.

    I have only ONCE seen a second swap file, and that was because VueScan X has a bug and uses 200MB for a scan. Otherwise, my system doesn't use VM.

    Applications will "assign" virtual pages, Classic will assign 1GB of VM, but that doesn't mean it is used. We've been so abused by Mac OS VM for years (in fact I think 9.1 and 9.2.1 are the first time that the old Mac OS got VM under control).

    On a server, you would put the VM across multiple drives, you might even have 4-16GB RAM and use real RAM for VM. Because you are looking at an 80MB file or two, and you might have 512MB - 1.5GB RAM....

    If you have one of the newest Cheetahs, even head arm overhead is the best there is. But you are right to want to spread OS X over drives, just as you never want to be forced to copy to/from the same drive.

    I'm not in OS X right now or I'd have some web sites that talk about setting up swap partitions.

    Gregory

  3. #3
    Join Date
    Jul 2001
    Location
    Las Vegas, NV, USA
    Posts
    1,559

    Default

    ResExcellence has an great tutorial on moving the swap files at:

    http://www.resexcellence.com/hack_ht...06-01-01.shtml

    lv

  4. #4
    Join Date
    Feb 2002
    Location
    York, PA, USA
    Posts
    339

    Default

    I used the command line from the ResXellence article (it was also in a MacAddict issue a couple of months back) on my G4 with no problems.

    I used SwapCop on my G3 B&W with the same result, plus Swap Cop deletes the old swap file on the next reboot. The G3 has the swap on a different partition and I tell ya, sometimes, it seems to respond faster than my Quicksilver... so maybe there is something to putting it on a different partition? I dunno how you would benchmark it in OS X though.

    Either way is fine by me... I liked the command line because it gives me a chance to try Terminal. I used a 512 MB partition... no particular reason except that I didn't want to waste space on a drive, but I didn't want to have too little space for a swap file. That "calculation" by the IBM guy in the ResExcellence article seems pretty random. I just went with 512 because it was a nice round "computer number". I figured a gig was too much and 256 MB was too little.

    Thanks,

    Anthony

  5. #5
    Join Date
    Jun 2002
    Location
    Campbell, CA, USA
    Posts
    732

    Default

    Years ago when I was running the Internet gateway systems for a large-ish corporation and we replaced our Unix-on-a-mainframe with Solaris on an SPARC 1000, I had my first opportunity to play with a Unix host with two internal HDs.

    What we eventually did (after an extended outage due to accidentally wrecking our root disk) was cross-couple the drives such that (I'll make up dev and slice numbers here)

    disk0s0 root
    disk0s1 altswap
    disk1s0 altroot
    disk1s1 swap

    and set the file-system tables (/etc/vfstab on Solaris == /etc/fstab on OSX) which live on their respective root partitions such that if our primary disk0s0 was booted, it swapped on disk1s1; if the alternate disk1s0 was booted, it swapped on disk0s1.

    The performance benefits were *huge* to do paging/swapping to a different HD than the root device.

    The size of a swap file or slice depends on a number of factors. More real RAM? Smaller swap requirements. Do you love launching everything under the Sun (err, Apple) and leaving it running? More swap. Do you do heavy graphics and need the swapper to move everything else to disk so you can dominate RAM? More swap. Are you the tidy type who exits any app you're not using? Less swap.

    If you're running a ton of Server apps, many of which idle out while others need juice, bump your swap space up. What's really bad is, just at the moment you need it most as Apache needs to fork off extra server processes, you've stuffed swap space and can't acquire more (in a timely fashion). The suggestion to watch vm_stat is good -- it may help to check a book (or the on-disk manual page, but that's in terminal! ) to get some understanding of the fields reported.

    In a terminal window, run vm_stat 5 (5-second snapshots). Then, *really* lean on your OSX box with whatever you've got that can hammer RAM while leaving that terminal window visible. Watch what happens! To quit vm_stat when you're through, press Control-C. BTW, the very first report from a time-period vm_stat
    is cumulative from boot-time, so ignore it (basically).

    Note that a PShop swapfile and the VM swapfile are different, though the concepts are common: push to HD stuff you don't need right now or *cannot* fit into available real memory.

    Remember: swap space is only ever used if you demand more RAM from your system than is installed.

    Question: Anyone know if swapfile0 (or swapfile1...) is ever *shrunk* by the OSX system after demand drops? I'd be surprised, though not shocked. My main experience configging is from mainframes and Solaris, where swap partitions and swapfiles were permanently allocated to that purpose and never recovered unless you reconfigged.

    Jazzbo

  6. #6
    Join Date
    Feb 2001
    Location
    Carlisle, MA USA
    Posts
    174

    Default

    I did a little experiment: I made 3 large pixel images- a 700MB file in Photoshop 7, an 850MB file in Painter 7, and a 650MB file in Canvas 8.
    I made these one right after the other, applied several filters and made several new layers in each, and executed a save of each file...
    Mind you, this took several hours for the whole experiment.
    Anyway, I ended up with 60 (sixty) 76.3MB Swapfiles on my system partition, which I observed with SNAX and File Buddy 7.
    In addition, Photoshop made a total of 4GB of temporary files on a dedicated scratch disk. Each of these apps were set at a low number of undos, and history states; Photoshop was allowed to use 50% of available RAM. Canvas has no similar provision, nor can one specify a scratch disk in X for it. Painter has a setting for a 'temp file volume' but I didn't see any evidence of it being used.
    Later I worked only with the Painter file with no other apps running. It made five 76.3MB swapfiles during that session..'Course I had the file size up to 1.16GB by then.

    I didn't get to rigorous about this- I just wanted to see what would happen when I pushed things. Obviously, its very unlikely I would work with files of this size and all at the same time. But from the results of this I'm definitely going to tryout making a fast swapfile partition on a different drive. Even if it only made 1 or 2 swapfiles, I'll betcha that 'll improve overall performance.

    George
    G4733QS 1.5GB RAM

  7. #7
    Join Date
    Aug 2001
    Location
    Grangeville, ID USA
    Posts
    9,142

    Default

    George,

    That is a GREAT TEST. Thanks very much for taking the trouble to post it.

    Gets me to thinking it does. Of course, that's not always a good thing........

    Rick

  8. #8
    Join Date
    Jun 2002
    Location
    Campbell, CA, USA
    Posts
    732

    Default

    George,

    Can't wait to hear clock-time differences with swapping on a separate drive!

    Very cool work, Kemosabe!

    Jazzbo

  9. #9
    Join Date
    Feb 2001
    Location
    Carlisle, MA USA
    Posts
    174

    Default

    I did another experiment- this time with much more tightly controlled parameters.
    First I repaired, defragged, and rebuilt the directory of my X startup volume, a 38.34GB IBM 75GXP ATA hard drive with 22.29GB of available space. This drive contains everything as in a default installation of X on a single drive, including all applications, documents, and the default location of vm/swapfile0.
    I Restarted
    Next, I opened Canvas 8 and Snax. No other apps were running except the usual background processes. Canvas was previously set to a minimum of 4 undos and a maximum of 5 undos. I resized both windows to observe both the impending image progress and the dynamic listing in Snax of the swapfiles.
    1. Next, I used the Create Image command in Canvas and set the dialog box to a 25"x25" image @600ppi with a file size of exactly 675MB. I pressed OK and recorded all times with my wristwatch. (At the completion of each operation I also noted how many swapfiles were present in the Snax directory)
    2. Next, I executed the Duplicate command.
    3. After that op completed, I executed a Move command, where I moved the duplicate an inch down and to the right at a 45 degree angle.
    4. After that was done, I executed a save to a location on the startup disk.
    5. Next, I used the Add Noise command...
    6. Next, a Guassian blur.
    7. Then another save.
    I quit Canvas- which basically I had to force.
    I restarted the computer.
    8. I then opened from the Finder that same document which I had just made- which was now 1.25GB. This completed the test cycle with vm in the default location.

    Using Swap Cop, I (eventually) was able to relocate the vm folder onto a single volume 34.17GB AppleRAID0 consisting of 2 X15 Cheetahs with almost no data on it. I verified this using Snax.
    I restarted.
    Then I did the entire sequence as described above exactly the same way, creating from scratch (bad pun)- but in no way using the first file- an exact duplicate of the first file, and saving it alongside of the first.
    Here are the resulting wristwatch times.....

    Test with vm in default location:
    1. 0:37 and 1 swapfile
    2. 2:30 and 10 swapfiles
    3. 5:08 and 22 swapfiles
    4. 5:20 and 25 swapfiles
    5. 0:47 for the dialog box to open and about 8:00 minutes to complete and 27 swapfiles
    6. 1:25 for the dialog box to open and about 20:00 minutes to complete and 41 swapfiles
    7. about 15:00 minutes and 36 swapfiles
    8. 9:20 and 17 swapfiles.

    Test with vm moved to AppleRAID0 2x X15 Cheetahs:
    1. 0:36 and 1 swapfile
    2. 2:22 and 10 swapfiles
    3. 4:54 and 22 swapfiles
    4. 4:54 and 26 swapfiles
    5. 0:43 for dialog box to open and about 8:00 minutes to complete and 27 swapfiles
    6. 1:15 for dialog box to open and about 20:00 minutes to complete and 40 swapfiles
    7. about 8:00 minutes and 35 swapfiles
    8. 9:20 and 17 swapfiles

    Test results interpretation: ????? (but note #7 in each sequence)

    George

  10. #10
    Join Date
    Feb 2001
    Location
    Carlisle, MA USA
    Posts
    174

    Default

    Please feel free to comment as to how I could do this test better...for instance, I probably should have an included an Undo operation in there. I'd like to try this test on a smaller image- say 100MB, but I'll have to get out the stopwatch. It might turn out though, that anything falling well within the available physical RAM would have negligible speed increases..

  11. #11
    Join Date
    Feb 2001
    Location
    Carlisle, MA USA
    Posts
    174

    Default

    Looking back on this test, my own tentative conclusions are:

    1. Since I have 1.5GB RAM installed, there may be very little benefit if any to locating .vm/ on a seperate drive. It's very unlikely in most of my normal operations I'll ever create a swapfile1 or 2...

    2. Having said that, I could see a scenario where I'm running many apps at once and have multiple projects in process, with maybe some large image file thrown into that mix, and I need to do a big time scan but I don't want to close out stuff in progress. As shown below, for my setup, the cutoff point seems to be about 675MB when it starts to make more swapfiles. Also, maybe certain Finder ops are using swapfile0 anyway..

    3. I could see those with 500MB or less of RAM really benefiting by sticking vm on a fast disk.

    4. A question: is sawpfile0 being used at all in normal use? Guess I'll have to check that out in terminal. If it is being used for small stuff, then it makes some sense -with plenty of available drives- to give a smallish partition over to it for a little speed bump.

    I think I'm going to go ahead and do that. If it turns out to be an unused and unnecessary config., then I'll just can it...

    George

  12. #12
    Join Date
    Mar 2001
    Location
    Keats, KS USA
    Posts
    435

    Default

    This has definetly been a good post to check up on.

    I may not have the "full" (ie- "Limted Edition" or 'LE') of Photoshop or Corel Draw/Photo-Paint since my talent lies in DAW work, but that test is pretty hip.

    For my basic "flier-n-card" creation, I always create a 140MB RAM Disk for my 'scratch' disk (my maximum printer output is 1440x720 for either 8 1/2" x 11" or legal-sized paper) since my files are usually no greater than 6120x7920ppi. I've pretty much ALWAYS use a lil' 2MB RAM Disk for Netscape (and Exploder if my wife is working on it) just so my pref's file doesn't get filled with useless CCache files while I'm posting here, checking my email and surfin.

    But this got me to thinking:

    Out of curiosity, (I'm not currently running X) is there no longer any means of creating RAM Disk's under X???


    ------------------
    Bill

    "I made a conscience decision in a semi-conscious state"

  13. #13
    Join Date
    Aug 2000
    Location
    Concord, CA
    Posts
    7,056

    Default

    Bill,

    I use ramBunctious 1.6.2 for OS9.2.2 and earlier but there is 2.0 for OSX http://www.versiontracker.com/morein...d=14621&db=mac with some interesting comments but I've yet to try it. k

  14. #14
    Join Date
    Feb 2001
    Location
    Carlisle, MA USA
    Posts
    174

    Default

    I ran another test with the same parameters as my second test below. Only this time Users and Canvas on one drive, system on a hardware stripe, image file on a cheetah, vm on the other cheetah...

    1. 00:36 one swapfile
    2. 08:35 22 "
    3. 06:05 22 "
    4. 06:02 26 "
    5. 23:00 38 "

    At this point, I abandoned the test realizing I was running out of room on my 3GB swap disk. Canvas took a full 20 minutes to quit. As you can see, the results were much worse than the previous test. I would have thought otherwise with the added drive buffers and busses...shows you how much I know about I/O!

    Anyway, I promise to stop torturing my poor little Quicksilver now
    (well, maybe for a little while)

  15. #15
    Join Date
    Aug 2001
    Location
    Grangeville, ID USA
    Posts
    9,142

    Default

    quote:
    Anyway, I promise to stop torturing my poor little Quicksilver now


    Yeah,????RIGHT

  16. #16
    Join Date
    Aug 2001
    Location
    Grangeville, ID USA
    Posts
    9,142

    Default

    ?I got to wonderin' (the cause of much pain and suff'rin, let me tell ya) if the swap files are put on a fast array and for some reason that array falls off the bus, like-for instance one forgets to turn on the power switch, does the OS on reboot lose the array location and go back to a default root disk location or does the OS crash?

    ?If it does go back to the root volume then do you have to go back and re-designate the array or will rebooting put you back with the array designated properly as the swap file location?

    ?Lack of knowledge is a dangerous thing.

    Rick

  17. #17
    Join Date
    Feb 2001
    Location
    Carlisle, MA USA
    Posts
    174

    Default

    In my case, I used Swap Cop to move the swap (I'm still a Terminal wimp), which was only successful after I checked the 'Ignore privileges on this volume' checkbox on the Privileges tab of the info window for my swap volume.

    The point of my story was that before I discovered the 'Ignore privileges..box, I switched the swap location. Swap Cop claimed success, but upon reboot and reopen of Swap Cop to remove 'old' swapfile, old one was removed sure enough, but new one was nowhere to be found! I rebooted again thinking surely a new /.../vm/swapfile0 would be produced since it appeared Swap Cop had failed in its mission, but no new vm- either in / or in /Volumes..

    So it appears on the surface I was operating briefly without vm. This as shown by SNAX showing invisibles, and again not listed in a FileBuddy search of invisibles.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •