[Semibug] Use mount_mfs to speed up programs
nick at holland-consulting.net
Tue Nov 30 08:15:21 EST 2021
On 11/30/21 4:00 AM, Jonathan Drews wrote:
> Hi Folks:
> I used Michael's book "Absolute OpenBSD" to setup MFS (Memory File
> System). It is also in man 8 mount_mfs. I did:
> # mount_mfs -s 2048m /dev/sd0b /mnt
> My question is will this speed up C programs that I run there? Will
> Ruby run faster in the MFS? Michael says it will speed up compile
> times by compiling programs in memory. Will the run times be faster
> too or do I need to copy libraries over ? The C programs read very
> little data from disk. They are programs that manipulate huge
Quoting D. J. Bernstein: "Benchmark, don't speculate"
Having an MFS be 100x faster than your hard drive only matters if
your hard drive is a significant bottleneck.
If your program does little from the disk, you are more likely to
spend more time setting up the loading of the MFS than you will gain
from program execution. And a LOT more time recreating data /when/
you forget to put the data back on real disk when you are done with
it. So if you see the hard disk light blinking a lot, it might be
worth testing. If you don't see that hard disk light blinking,
don't waste your time.
Note also, that modern SSDs are very fast -- you may not see a huge
difference between an SSD and an MFS for many applications. Add
a noatime and softdep option to the mount, and improve performance
even more for the real disks.
I say this as a user of MFSs -- my OpenBSD mirrors in Toronto have
at least two where I see a big performance gain -- a tmp directory
in a chroot in the anoncvs server and the cvsweb server has the
entire CVS tree in an MFS (guess it is time to stop hoarding 9G
hard drives when I manage a 10G MFS, eh?). But I saw real bottlenecks,
and solved real problems by putting things in an MFS, didn't just
do it for speculative benefit.
More information about the Semibug