问题描述
我们为开发箱构建了一个 vagrant box,但面临一些延迟问题.
We've built a vagrant box for our development box and we are facing some latency issues.
问题:
- Assetic:手表速度很慢
- (app_dev.php) 中的整体应用程序访问速度很慢
- 在 vagrant box 上的共享文件夹中使用find"命令超级慢
关于盒子:
- 在 virtualbox 上运行(在 Mac 和 Linux 上运行)
- LAMP 环境 (ubuntu)
- 大型代码库(10K+ 文件)
- Symfony 2 应用程序
为提高性能而采取的措施:
- NTFS 的使用(使用 bindfs)
- 流浪配置:
config.vm.synced_folder "#{folder['source']}", "/mnt/vagrant-#{i}",id: "#{i}", type: 'nfs', mount_options: ['rw', 'vers=3', 'tcp', 'fsc','actimeo=2']
- 移动缓存并从共享文件夹中注销(AppKernel 更新)
我们可以清楚地看到,每次访问共享文件夹中的文件时,bindfs"进程都会消耗大量 CPU.
We can clearly see that any time a file from the shared folder is accessed the "bindfs" process is eating a lot of cpu.
首先,这正常吗?我期待 vagrant 复制盒子上的文件,并且每当这些文件被访问时都是在本地完成的.
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?
推荐答案
迟到了.对于新手来说,有 2 个插件可以提高蝙蝠右侧流浪盒的速度.
Late to the game. For newcomers there are 2 plugins which will increase the speed of the vagrant box right of the bat.
安装确保你有 Vagrant 1.4+ 并运行:vagrant plugin install vagrant-cachier
InstallationMake sure you have Vagrant 1.4+ and run: vagrant plugin install vagrant-cachier
vagrant plugin install vagrant-faster
我也在使用 MySQL-tuner-perl 这对 MySQL 微调非常有用.
I'm also using MySQL-tuner-perl which is quite good for MySQL fine tuning.
希望能帮到你
这篇关于缓慢的流浪箱,如何改进?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!