Why is my Symfony 2.0 site running slowly on Vagrant with Linux host?

前端 未结 5 1031
北恋
北恋 2020-12-24 14:51

I\'ve got a Symfony 2.0 application running using Vagrant with a Linux guest and host O/S (Ubuntu). However, it runs slowly (e.g. several seconds for a page to load, often

5条回答
  •  攒了一身酷
    2020-12-24 15:18

    I've seen similar problem on my OS X host, I forgot to enable NFS! On windows Host, the performance impact is less true... For my very small website, I have kickly 12649 files... So the 1000+ files limit is quite easily reached.

    So my two cents: enable NFS like this in your Vagrantfile:

    config.vm.share_folder "v-root", "/vagrant", ".." , :nfs => true
    

    And from the experts:

    It’s a long known issue that VirtualBox shared folder performance degrades quickly as the number of files in the shared folder increases. As a project reaches 1000+ files, doing simple things like running unit tests or even just running an app server can be many orders of magnitude slower than on a native filesystem (e.g. from 5 seconds to over 5 minutes).

    If you’re seeing this sort of performance drop-off in your shared folders, NFS shared folders can offer a solution. Vagrant will orchestrate the configuration of the NFS server on the host and will mount of the folder on the guest for you.

    Note: NFS is not supported on Windows hosts. According to VirtualBox, shared folders on Windows shouldn’t suffer the same performance penalties as on unix-based systems. If this is not true, feel free to use our support channels and maybe we can help you out.

    Edit:

    On windows, I have found another solution, I am using symlinks (ln -fs) on vendor folders within my projects that links to non-shared folders. This reduce the amount of files seen by the windows host, the antivirus, etc.

提交回复
热议问题