Using a ramdisk for faster port compiling

Has anyone tried using a ramdisk for optimized/faster compilation of ports? I added eight GB of RAM to this machine rather whimsically, (it's so cheap now), and am trying to come up with different ways of using it. I liked the idea of a ramdisk to speed up compilation, but I have no idea where to mount it.
 
Sounds interesting, but I don't understand why with the above given path in /var the work directory is moved into RAM? What am I missing?
 
cabriofahrer said:
Sounds interesting, but I don't understand why with the above given path in /var the work directory is moved into RAM? What am I missing?

/var/ports/tmp/ is the mountpoint where the RAM disk is mounted on. But it's just an example. You can mount it anywhere you like as long as WRKDIRPREFIX points to it.
 
I'll give you one local example:

/etc/fstab
Code:
tmpfs			/staging	tmpfs	rw		0	0

/etc/make.conf
Code:
WRKDIRPREFIX=/staging

That's all you need.

[cmd=]df -h[/cmd]
Code:
tmpfs           9.9G    4.0k    9.9G     0%    /staging

[cmd=]ls -ld /staging[/cmd]
Code:
drwxr-xr-x  3 root  wheel  40 Jun 15 12:19 /staging

Just ran make on a test port with some dependencies to show what happens:

[cmd=]$ find /staging -type d[/cmd]
Code:
/staging
/staging/usr
/staging/usr/ports
/staging/usr/ports/misc
/staging/usr/ports/misc/unclutter
/staging/usr/ports/misc/unclutter/work
/staging/usr/ports/misc/unclutter/work/unclutter
/staging/usr/ports/devel
/staging/usr/ports/devel/imake
/staging/usr/ports/devel/imake/work
/staging/usr/ports/devel/imake/work/imake-1.0.4
/staging/usr/ports/devel/imake/work/imake-1.0.4/.deps
/staging/usr/ports/devel/gccmakedep
/staging/usr/ports/devel/gccmakedep/work
/staging/usr/ports/devel/gccmakedep/work/gccmakedep-1.0.2
/staging/usr/ports/devel/makedepend
/staging/usr/ports/devel/makedepend/work
/staging/usr/ports/devel/makedepend/work/makedepend-1.0.3
/staging/usr/ports/devel/makedepend/work/makedepend-1.0.3/tests
/staging/usr/ports/devel/makedepend/work/makedepend-1.0.3/tests/28045
/staging/usr/ports/devel/makedepend/work/makedepend-1.0.3/.deps
/staging/usr/ports/x11
/staging/usr/ports/x11/xorg-cf-files
/staging/usr/ports/x11/xorg-cf-files/work
/staging/usr/ports/x11/xorg-cf-files/work/xorg-cf-files-1.0.4
 
Time a big port compile both from RAM and off disk. Reboot before each to clear filesystem cache. With buildworld, I found essentially zero difference putting /usr/obj in a tmpfs.
 
This is a somewhat tangential observation/question...

Running ZFS with 8GB (total) RAM, I note that even on heavy builds (world etc), the HD light only pulses very briefly and occasionally - e.g. one single short flash every few seconds. (I can't remember what it used to be like when I used to run UFS). So, assuming there's a decent caching infrastructure in place, like ZFS's L2ARC, is there something to be said for letting the system use memory as it sees fit? Is there much to be gained by manually specifying a RAM disc these days?

sim
 
Back
Top