Using a RAM disk for Photoshop CS4 CS4 scratch
Everyone gets excited about the magical solution: a scratch disk that’s based on memory. In theory, such a scratch disk should be ultra-fast. Take a cold shower now: the reality isn’t so sweet.
RAM disk vs Seagate NS 4 drive stripe: RAM disk loses
Testing using diglloydMedium on a 32GB Mac Pro showed that the 4-drive striped RAID (4 X Seagate 1TB NS) was actually a smidgen faster than eight 2.2GB RAM disks! See the full test results.
4 X Seagate 1TB NS: 70 seconds
8 X 2.2GB RAM disks: 72 seconds (slower!)
If you have a less than optimal scratch drive and plenty of memory on a Mac Pro, the RAM disk does appear to offer an advantage (try it). But it makes more sense to create a fast striped RAID for a scratch volume—then the hassle of creating and configuring the RAM disk(s) can be avoided.
Why isn’t a RAM disk faster than a fast striped RAID? Because the combination of the Mac OS X caching and a fast striped RAID is as fast or faster than Photoshop CS4 can utilize (internal Photoshop CS4 bottlenecks). Also, Mac OS X appears to also cache I/O to RAM disks, adding further overhead.
Note: the Mac OS X 10.5.5 'hdid' command used to create the RAM disks is a 32-bit program and cannot create a RAM disk larger than 2.2GB; that’s why eight smaller ones totaling 17.4GB of scratch space were used. That’s plenty for the diglloydMedium benchmark test, which generates a 15.7GB scratch file.
RAM disk caveats
There are some caveats with RAM disks. RAM disk are pageable memory (virtual memory). If the system runs short on physical memory, it will page RAM disk contents to disk and performance will grind to a halt, a self-defeating turn of events.
Observe the memory utilization below: this is after creating eight 2.2GB RAM disks: physical memory isn’t actually allocated until the RAM disk is used (written). It is never “wired” (locked down) so it can be paged at any time, self-defeating if and when it occurs.
Dumb and dumber being at work, Mac OS X 10.5 caches disk I/O for RAM disks! This not only degrades RAM disk speed, but effectively means that 4GB of memory (total) is scarfed up for a full 2GB RAM disk! Observe below the nearly 11GB of “Inactive” memory which is being used to cache the (RAM) disk I/O that’s occurred.
There is another hassle: creating and destroying the RAM disk(s), plus configuring and un-configuring Photoshop, which can entail some “fun” in some circumstances:
Try a RAM disk yourself
Download the diglloyd scripts if you’d like to “play”.
You should be comfortable using Terminal. If not, forget about it. Please don’t write and ask for support on this: you’re on your own.
The main script is named crd (“create ram disk”), but convenience scripts named crd1, crd2, ..., crd8 which create RAM disks RamDisk1, RamDisk2, ..., RamDisk8.
The crd-drop script drops (destroys) RAM disks 1 through 8, freeing up all their memory.
Example of creating RamDisk1 and then dropping it:
llcMP:~ lloyd$ cd diglloyd-crd llcMP:diglloyd-crd lloyd$ ./crd1 Creating 2250 MB ram disk named RamDisk1 hdid -nomount ram://4608000 New block device: /dev/disk12 Creating volume named: RamDisk1 Initialized /dev/rdisk12 as a 2250 MB HFS Plus volume Mounting in /Volumes/RamDisk1 Volume RamDisk1 on /dev/disk12 mounted To unmount the volume use: hdiutil detach /Volumes/RamDisk1 llcMP:diglloyd-crd lloyd$ ./crd-drop
Help us help you! You support the reviews and how-to articles on this site when you buy from trusted site sponsor Other World Computing (use the links/ads anywhere in this Guide).
OWC does not sell Macs, so when buying a Mac, please click here to go to the Apple store, but remember to save money by getting your memory and hard drives, backup systems, etc at OWC.
Please let others know about this site by posting a hyperlink to site page(s) in discussion forums, web sites, etc — thank you!


