Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '10.4: Move swap files to another drive' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: Move swap files to another drive
Authored by: TigerKR on Feb 10, '06 07:02:51PM

To maximize performance: you typically want your swap/vm to be on the fastest part of the HD, and you want your vm files to be unfragmented. You can accomplish this by partitioning your boot drive into two partitions, the first (the first partition is faster) for vm/swap, and the second for your boot disk.

You also typically want your scratch to be on the fastest part of the HD, and you want your scratch files to be unfragmented. Basically scratch is vm for specific applications (such as photoshop). You also want your scratch partition on a separate HD (and a separate bus if you can) from your vm and boot disk (your boot disk also contains the application). But it is advantageous to keep your scratch and your data storage on the same HD because an inner-drive copy is going to be faster than an inter-drive copy (once photoshop is done with a file - which is temporarily stored in scratch - it then will write the file to a more permanent file).

Of course, if you can have multiple HDs (and possibly have multiple busses) you might want to consider RAID0 (striping) for even more speed.



[ Reply to This | # ]
10.4: Move swap files to another drive
Authored by: TigerKR on Feb 10, '06 07:11:28PM

On the hardware side, more RAM should always be your first upgrade, so you can avoid VM swapping as much as possible. Faster spinning HDs (more Rpm) with more lanes for traffic (more MBps) are also a good upgrade (although they can get expensive) so that when you do swap, at least it won't take as long. Besides, with a faster HD, everything is faster, from boot-up, to app launch, to file reads, to file writes.

Another way to keep your system Snappy™ is to keep your files and filesystem de-fragmented. Tiger has some limited de-fragmentation built in.



[ Reply to This | # ]
10.4: Move swap files to another drive
Authored by: DavidRavenMoon on Feb 14, '06 07:59:45AM

Just keep in mind that the performance you might gain from having a VM partition on the same physical drive as your OS, as far as not having fragmented files, is (probably) lost by the drive head having to travel farther.

This is true of partitions in general. You keep files organized and unfragmented (maybe), but you make the drive do more work.

You also have to make sure the VM partition is large enough. Five times the installed RAM is ideal... double is the bare minimum.

And that brings me to the last point... load up your Mac with enough RAM and you won't have to worry about swap files. I have 1.5 GB on this G5 (my work machine), and right now, with a bunch of apps open, including Photoshop CS2, Illustrator CS2, Quark 6.5, Acrobat 7 Pro, Classic, Safari, Entourage, etc. I have one 64 MB swap file. Putting that file on another partition, or drive for that matter, won't speed up a thing!

:)

---
G4/Digital Audio/1GHz, 1 GB, Mac OS X 10.4.4
www.david-schwab.com
www.imanicoppola.net



[ Reply to This | # ]
10.4: Move swap files to another drive
Authored by: TigerKR on Feb 14, '06 06:07:05PM

Forgive me, but I'm not following you. How would reading a non-continuous stream of data be just as fast as reading a continuous stream?

In a continuous stream of data, the read-head does not need to jump around the platter. Every time the read-head jumps around the platter, your performance is decremented. If you have a really large file that is in many different chunks in different places of your drive's platter, then that theoretical decrement of performance increases in magnitude. If you have several large files that you are currently using, that are in many different chunks in different places of your drive's platter, then your read-head is doing a virtual square dance, and you have to wait for it to finish the Do-si-do. That's not even considering the overhead of having a file-system b-tree that's so bogged with extents branches that it looks like willow tree.

I'm not saying that any of this matters for most users - it doesn't matter for most users. But this hint isn't for most users.



[ Reply to This | # ]
10.4: Move swap files to another drive
Authored by: TigerKR on Feb 14, '06 06:36:44PM

I'm not sure where you have come up with the idea of having 5x RAM as a size for your VM partition. I have always read that 2x RAM is ideal.

"Choosing the right amount of swap space can be a bit of an art. A good rule of thumb is that your swap space should be two or three times as much as the available physical memory (RAM). You should also have at least 64 MB of swap, so if you have less than 32 MB of RAM in your computer then set the swap amount to 64 MB." - FreeBSD install guide

"Your swap partitions should total at least twice the size of the amount of RAM memory you have installed in your machine." - vmunix install guide

"Many people follow an old rule of thumb that your swap partition should be twice the size of your main system RAM. This rule is nonsense. On a modern system, that's a LOT of swap, most people prefer that their systems never swap. Use what is appropriate for your needs... your swap space should be [at least] slightly larger than the amount of main memory you are likely to ever have in the system." - OpenBSD FAQ

I used to have 1.5 GB of RAM and I used to use swap a bunch. I have 3 GB of dedicated swap space, but I've never hit the ceiling on that. Since I've upgraded to 2 GB of RAM, I almost never go beyond the initial 64 MB swapfile. But occasionally I do. And when I do, I'm usually on a deadline, and I need things to move as quickly as possible.

I think that you may be confusing swap space with scratch space. Applications like photoshop use scratch files (basically VM for a specific application). And yes, for photoshop, it is recommended that you allocate at least 5x - of your largest file size that you'd ever work with in photoshop. So if you work with 5 200 MB photoshop files concurrently (200MB is a really big file - for comparison a 7.1 megapixel RAW file is about 10 MB), you should have 5 GB of dedicated scratch space. But you should not typically have your swap and scratch in the same place. In fact, no only do you want them on different partitions, but if you can, you want them to be on different drives, or better yet, different busses.



[ Reply to This | # ]