Ram Disk apps?

jtara

macrumors 68000
Original poster
Mar 23, 2009
1,826
432
Interested in advice/experience with Ram Disk apps for MacOS, especially for software development.

Yes, I realize it's built-in, if you want to fiddle in the console and write some scripts to automate....

But would be nice to have a little menu bar utility with a GUI, and built-in ability to mount Ram disks in common places where they are useful. (e.g. XCode Derived Data).

I just did an experiment on my late 2012 Mac Mini which is already maxed out with 16GB ram and 1GB flash (400MB/sec, the best you can do in a 2012 Mini due to SATA interface.)

I set up two RAM disks (the "hard way") mounting one on the XCode Derived Data directory, and another on my build directory for a hybrid mobile platform (Rhodes) that I do development in. Reduced iOS full build time for my project from 5 minutes to 3 minutes. (Haven't tested Android build yet.)

From Google searches, I see some are putting iOS simulator files on RAM Disk too, I'm thinking that might speed up my simulator startups.

Am getting an iMac Pro and obviously that will speed things up as is! But my experiment made me decide to up the memory on the iMac Pro from 32 to 64GB. Besides speeding builds up even more, it will help preserve the flash. (Build cycles have got to be brutal on flash! But suppose the ultimate flash-killer is video editing...)

Should give me two things app developers can use in any quantity:

- fast build times (for compiled languages)
- pixels

There are some ollllllld Ram Disk utilities, that have mostly faded away.

There's Ultra Ram Disk in the App Store, but gets horrible reviews.

There's an app called RAMDisk, but no reviews at all, and apparently doesn't work on MacOS.

There's iRamDisk, but apparently not in the U.S. App Store?

Desirable plusses:

- built-in list of useful mount points for development and other purposes
- copy data from storage on startup
- copy data to storage on (normal) shutdown
 

Crunch

macrumors 6502a
Jun 26, 2008
701
74
Crazy L.A.
I used to use iRamDisk, but ever since PCIe SSDs, and now PCIe 3.0 x4 SSDs, I haven't. I'd also like to know if anyone is still using RAM disks. I do realize that RAM is still significantly faster than even the latest SSDs. Not sure if it would matter to me much anymore.
 

jtara

macrumors 68000
Original poster
Mar 23, 2009
1,826
432
On my 2012 i7 Mac Mini, Black Magic gets me

~400mB/sec r/w on my OCZ Vector 180
~ 1000-3000 w, 3700r on the ram disk

Interesting, the writes ramp up from 1000 to 3000 over a few BlackMagic cycles. I suppose some physical cache artifact and BlackMagic not being able to outsmart it?

I realize that these are similar to the speeds that might be expected on the iMac Pro pciE flash. (or 2018 Mac Mini, or any current Macbook Pro).

But should be faster still on the iMac Pro. Will report when I get it.

----
FWIW I created it with:

☺ ➜ ~ diskutil partitionDisk $(hdiutil attach -nomount ram://4096000) 1 GPTFormat APFS 'build' '100%'
Started partitioning on disk8
Unmounting disk
Creating the partition map
Waiting for partitions to activate
Formatting disk8s1 as APFS with name build
Mounting disk
Finished partitioning on disk8
/dev/disk8 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme +2.1 GB disk8
1: Apple_APFS Container disk9 2.1 GB disk8s1


☹ ➜ ~ diskutil apfs list

... (skipped real disks)

+-- Container disk9 70D646F0-0F8E-485D-86E6-B9C5E8CB5A85
====================================================
APFS Container Reference: disk9
Size (Capacity Ceiling): 2097111040 B (2.1 GB)
Capacity In Use By Volumes: 8384512 B (8.4 MB) (0.4% used)
Capacity Not Allocated: 2088726528 B (2.1 GB) (99.6% free)
|
+-< Physical Store disk8s1 387DCA86-AC2A-4B84-9A75-5F89303D0BBD
| -----------------------------------------------------------
| APFS Physical Store Disk: disk8s1
| Size: 2097111040 B (2.1 GB)
|
+-> Volume disk9s1 32D3398F-68E9-4D8B-8761-806AE208DDB7
---------------------------------------------------
APFS Volume Disk (Role): disk9s1 (No specific role)
Name: build (Case-insensitive)
Mount Point: Not Mounted
Capacity Consumed: 32768 B (32.8 KB)
FileVault: No

(dismount drive in Finder. For some reason, it ignore the nomount option...)

☺ ➜ ~ sudo diskutil mount -mountPoint ~/workspace/spatvis/mobile_app/build /dev/disk9s1
Volume build on /dev/disk9s1 mounted

----
I think RAM Disk is still useful, but seems mostly forgotten. There's a considerable amount of temporary read/write activity in many common work flows where there is absolutely no reason to ever write to non-volatile storage.

BTW, my observation is that XCode (at least on my Mac Mini) is throttled by disk performance. It barely uses the CPU. In contrast, Android toolchain builds seems to be throttled by CPU. Again, for my specific configuration! Android builds use 300% of CPU (keep in mind, 4 cores) while my XCode builds use ~25%. (50% now with the Ramdisk!)
 
  • Like
Reactions: ElectronGuru

cruisin

macrumors 6502a
Apr 1, 2014
956
215
Canada
https://www.macrumors.com/2018/07/13/2018-macbook-pro-fastest-laptop-ssd-ever/

This says that BlackMagic reports an average write speed of 2,682 MB/s for the 2018 MacBook Pro models.

https://macperformanceguide.com/iMacPro_2017-flashDriveSSD.html

The iMac Pro is pushing 3 GB/s writes at larger sizes.

The RAM disk is becoming less useful over time, especially since it needs a custom setup and stable power compared to a modern SSD. Unless you need to perform a high number of writes or most of your files are small, the RAM disk might not be worth the hassle.
 

Seoras

macrumors 6502
Oct 25, 2007
357
490
Scotsman in New Zealand
I'm a developer and I use Xcode almost daily.
I've been using iRamDisk for a couple of years now and it seems to work fine.
I forget I've got it running so I suppose that's a good recommendation there - in the background, doing it's job and easily forgotten.
What I also like about using that ram disk is that I do a (brutal) "make clean" just by clicking on the iRamDisk icon on the dock, ejecting and re-creating.
 
  • Like
Reactions: Isamilis

Isamilis

macrumors 6502a
Apr 3, 2012
606
98
I used to use iRamdisk when using El Capitan, to store browser's cache file. Now, since using Mojave, I am unsure to keep using it. The benefit (reducing read/write in SSD) looks still hypothetical.

I'm a developer and I use Xcode almost daily.
I've been using iRamDisk for a couple of years now and it seems to work fine.
I forget I've got it running so I suppose that's a good recommendation there - in the background, doing it's job and easily forgotten.
What I also like about using that ram disk is that I do a (brutal) "make clean" just by clicking on the iRamDisk icon on the dock, ejecting and re-creating.
 
  • Like
Reactions: Seoras

Seoras

macrumors 6502
Oct 25, 2007
357
490
Scotsman in New Zealand
I used to use iRamdisk when using El Capitan, to store browser's cache file. Now, since using Mojave, I am unsure to keep using it. The benefit (reducing read/write in SSD) looks still hypothetical.
Yep, I'm not sure it really speeds up anything significantly but if it's giving me a few % quicker compiles, allows me to massacre the derived data with a few clicks, reduces the wear and tear on my SSD and runs quietly in the background then I'll keep using it. I put 40G of DRAM in my iMac and I allocate about 10% of it to the ram disk.
 

jtara

macrumors 68000
Original poster
Mar 23, 2009
1,826
432
Results on iMac Pro are less than I'd hoped for, but still an improvement over flash, and in a development environment where you have lots of writes of intermediate files on every build, will help save flash life.

With APFS I get 4300W/4600R, somewhat poorer results (around 4000) with HFS+.

Still, that's 1/3 faster than flash.

"Stress" size 1GB - 5GB doesn't make any difference.

I realize Blackmagic is an unsophisticated storage test, focused on simple sequential read/write. Will do some testing with a better benchmark later. I had done the test with HFS+ the other day, and just wanted to run another test before boxing the iMac Pro up for return. (It arrived with a DOA screen, I was running on an external display working with Apple to diagnose.)
 

jtara

macrumors 68000
Original poster
Mar 23, 2009
1,826
432
I did some more experimentation.

I found this application for creating a RamDisk in kernel memory:

https://github.com/coruus/osx-tmpfs

It's just a wrapper around command-line utilities, so I was able to try e.g.:

sudo /usr/sbin/hdik -nomount ram://4000000
-> /dev/disk2
sudo diskutil partitionDisk /dev/disk2 1 GPTFormat APFS 'mnt/ramdisk' '100%'

I can see in Activity Monitor that this does indeed increase wired memory by the size of the disk.

Problems:

- It's actually quite a bit SLOWER than not using kernel memory! I got about 750MB/sec on an iMac Pro. I got 4000-5000 without using kernel memory.

- On the other hand, it IS clear that it is not writing-through to backing store on the flash. The write performance, although poor (less than that of the flash drive) is consistent. It does not ramp up with each test cycle like it does when not using kernel memory.

- It seems limited to about 2GB. Anything above that get error 0xc6e = 110