Homestead: Fix slow I/O access

I recently saw really poor performance on my homestead vagrant box. Pages that on other machines load in 100ms would load in +1sec.

After a lot of playing around I found the issue to be I/O access. At that point it was easy to discover that enabling NFS on vagrant machines can increase I/O performance quite a bit.

Enabling NFS for shared folders

In homestead.yaml for your shared folders add the type: nfs option like so:

- map: "/path/to/project/on/host"
  to: "/home/vagrant/homestead"
  type: nfs

Then run: vagrant reload to make the new settings go in effect.

Increase CPU core usage

Couldn’t help but search for other potential speed improvements now that I was at it. It was suggested to increase the number CPU cores in use. At least for my uses cases this won’t really result in any gains, but oh well it’s worth a mention.

For most people setting this to the number of cores on your machine will be the right choice. The full explanation of why can be found here.

In case you don’t know how many cores you have you can use sysctl -n hw.ncpu to find out.