Search code examples
macosvagrantvirtualboxvirtualizationnfs

Vagrant: extremely slow synced folder (Mac Host, Ubuntu Guest)


There are a lot of pages related to this problem and I've tried the commonly suggested switch to NFS-based shares. This actually doubled the latency. Rsync-based syncing is not a viable option as the shared folder is 18G and I don't want to have to manage it with --exclude files as the --exclude list would change at best weekly and be a management nightmare)

What's strange is that the performance is excellent on an Ubuntu Host running inferior hardware when compared to the Macbook Pro Host (OS/X El Cap).

Synced folder Size: 18G:

**Ubuntu Host**
    vagrant: 1.7.4 (installed via apt-get @ 15.10)
    VirtualBox: 5.0.14_Ubuntur105127 (installed via apt-get @ 15.10) 

    synced as: config.vm.synced_folder ENV['src'], "/src", create: false  
        cd /repo     // instant
        ls           // instant

**Mac Host**
    vagrant: 1.8.1 (installed via homebrew)
    VirtualBox: 5.0.16 (installed via binary at Oracle site)

    synced as: config.vm.synced_folder ENV['src'], "/src", create: false %
        % cd /repo     // 1 minute, 2 seconds
        % ls           // 27 seconds

    synced as: config.vm.synced_folder ENV['src'], "/src", type: "nfs", create: false
        % cd /repo     // 2 minutes, 43 seconds
        % ls           // 40 seconds

Solution

  • I did determine what was making it extremely slow, although I haven't figured out why.

    It was zsh (or oh-my-zsh).. As part of my provision script, I install zsh and make it the default shell. I noticed my other vagrant guests were pretty snappy and they were all sharing the same synced folder. The only difference was zsh. When I removed zsh the performance went right back to what was expected (cd into dir took <1 sec compared to taking between 1:02m-2:43m). Maybe it has something to do with zsh trying to index the contents for command completion? I'll report back if I get around to resolving it but for the moment leaving the shell set to bash has resolved this for me.