Symfony2 +Vagrant performance - running slow - spe

2019-02-11 04:46发布

问题:

I have started using vagrant with Symfony2.* to develop Web projects. I am using Windows, performance is very slow, because nfs mount isn't supported.

I've put cache into memory, which gave exotic boost, disabled xdebug (as posted here). However page still loads in more than 14 seconds in dev enviroment on windows machines. Any help would be appreciated.

Symfony >=2.3, PHP >= 5.4, Windows 7, Dell Precission m6700 quad-core i7/16GB/SSD

回答1:

I've had the same performance problems, although with developing Drupal sites (also PHP based). Lately I've had quite some success by using the new rsync folder feature, which was introduced in Vagrant 1.5.

If you're working with a large number of files (10.000 - 100.000), I experienced that the built-in rsync-auto feature had a hard time keeping up. Switching to this neat little plugin saved my day. Just as the vagrant rsync folder feature, the gatling rsync plugin also only provides a one way sync (host -> guest). Since a lot of Drupal tools and compass generate files on guest, this plugin will help to sync the changes from guest to host.

If you're looking for a comparison: here you can find a recent benchmark blog post on rsync vs NFS.



回答2:

  • Under Windows you absolutely need to use NFS OR RSYNC for sharing folder with Vagrant.
  • RSYNC is an good solution when automatic mode is activated but it's not bidirectional.

Try this config.yaml (make with PuPHPet): https://github.com/comexpertise/PuPHPet-config-lamp-webdev Optimized for Windows: use NFS shares OR RSYNC.

Very speed but not free: Swith VirtualBox to VMWare with the Vagrant VMWare plugin (and use NFS or RSYNC sharing types).

Another solution (best performances): need to disable Vagrant sharing folders for use local file system of VM, and configure your favorite IDE/FTP for use SFTP and simply upload modified files (Netbeans can automatically upload new created/modified files)

Edit: Read my comment #2 before about newest versions of Vagrant. You need more speed? Try VMware + Vagrant VMware plugin, it's the best (y)



回答3:

there is a great plugin enabling NFS on windows for Vagrant: vagrant-winnfsd

$ vagrant plugin install vagrant-winnfsd

https://github.com/GM-Alex/vagrant-winnfsd