We've built a vagrant box for our development box and we are facing some latency issues.
Issues:
About the box:
Things done to improve perfs:
config.vm.synced_folder "#{folder['source']}", "/mnt/vagrant-#{i}", id: "#{i}", type: 'nfs', mount_options: ['rw', 'vers=3', 'tcp', 'fsc' ,'actimeo=2']
We can clearly see that any time a file from the shared folder is accessed the "bindfs" process is eating a lot of cpu.
First of all is that normal? I was expecting vagrant to copy files on the box an whenever those files were being accessed things were done locally.
We can see that the box itself works fine as when accessing cache data (outside of shared folder) things are going fast enough so what can I do to improve the box performances and avoid those latency issue?
Late to the game. For newcomers there are 2 plugins which will increase the speed of the vagrant box right of the bat.
vagrant-cachier
Installation
Make sure you have Vagrant 1.4+ and run: vagrant plugin install vagrant-cachier
Vagrant-faster
vagrant plugin install vagrant-faster
I'm also using MySQL-tuner-perl which is quite good for MySQL fine tuning.
I hope it helps
You need also to don't share vendor folder between host and vagrant, if you are doing that. Because reading of shared files are slow. Take look at this link. In order to do that you will need to change composer.json file inside you symfony2 project :
"config": {
...,
"vendor-dir": "/some_new_location/vendor"
},
and also change app/autoload.php
.
$loader = require '/some_new_location/vendor/autoload.php';
After doing that run composer install.
There are also some resources for reading :
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With