How to Improve Slow Wandering Public Folders

In my windows 7 I use:

  • VirtualBox 5.0.20
  • Vagrant 1.9.1
  • vagrant-share (1.1.6, system)
  • vagrant-winnfsd (1.3.1)

I have an ubuntu firewall with some PHP software (piwik) that, on a specific CLI command, does some processing that includes files. I measured how long it takes for the team to complete the various types of sharing from guest (ubuntu) to host (win7):

  • 30 seconds in a simple shared folder.
  • 5 seconds in the nfs shared folder (via config.vm.network "private_network", type: "dhcp" and config.vm.synced_folder "piwik", "/web-pub/piwik", :nfs => true, :mount_options => ['actimeo=2'] ).
  • 0.5 seconds without sharing by copying all the relevant files under /tmp , which is not shared.

I confirm proportionally similar numbers in different tasks (for example, drush cc all on a vanil drupal 7 installation).

Do you know how to make shared folders faster than 5 seconds? I would like to avoid rsync based solutions.

+6
source share
2 answers

Sharing a firewall is slower if by default you have thousands of files and a base directory of roaming monsters, so try disabling the default share:

 config.vm.synced_folder ".", "/vagrant", disabled: true 

You can try turning on the FS cache . I did not see much of the difference whether it was turned on or not, but in any case it remained turned on ... Install cachefilesd in the guest system and add fsc to the mount options:

 config.vm.synced_folder "src/", "/mnt/project", type: "nfs", mount_options: ['rw', 'vers=3', 'tcp', 'fsc'] 

And you will probably have NFS permissions issues, you can use the bindfs plugin to do this:

 config.bindfs.bind_folder "/mnt/project", "/var/www/drupal", owner: "www-data", group: "www-data" 

Here's the final Vagrantfile we use to develop drupal8:

 ["vagrant-bindfs", "vagrant-vbguest"].each do |plugin| unless Vagrant.has_plugin?(plugin) raise plugin + ' plugin is not installed. Hint: vagrant plugin install ' + plugin end end Vagrant.configure("2") do |config| config.vm.box = "geerlingguy/ubuntu1604" # Shared folders config.vm.synced_folder ".", "/vagrant", disabled: true config.vm.synced_folder "src/", "/mnt/drupal", type: "nfs", mount_options: ['rw', 'vers=3', 'tcp', 'fsc'] config.bindfs.bind_folder "/mnt/drupal", "/opt/drupal", owner: "www-data", group: "www-data" config.vm.network "private_network", ip: "192.168.33.20" config.vm.provider "virtualbox" do |v| v.memory = 2048 v.cpus = 2 end end 
+2
source

A couple of settings changes should help in the efficiency of file sharing:

  • Enable NFS

     config.vm.synced_folder ".", "/vagrant", :nfs => true 
  • Increase VirtualBox Memory

     config.vm.provider :virtualbox do |v| v.customize ["modifyvm", :id, "--memory", 2048] end 

I would suggest installing VirtualBox memory at a distance of 1/4 to 1/3 of the available memory on the server.

-one
source

Source: https://habr.com/ru/post/1015702/


All Articles