Zombie.js在VirtualBox共享文件夹中运行缓慢 [英] Zombie.js running slowly in VirtualBox shared folder
问题描述
我正在尝试在 Zombie ="nofollow"> Node.js 项目.该项目在VirtualBox VM上的共享文件夹中运行.我注意到将Zombie安装到共享文件夹而不是全局安装时的性能大大下降.
I am trying to use Zombie in my Node.js project. The project runs in a shared folder on a VirtualBox VM. I am noticing a big drop in performance when Zombie is installed to the shared folder rather than globally.
假设我在zombie_test.js中具有以下内容:
Suppose I have the following in zombie_test.js:
require("zombie");
如果我全局安装僵尸,则require语句将在不到一秒钟的时间内运行:
If I install zombie globally, the require statement runs in less than a second:
$ sudo npm install zombie -g
...
$ time node zombie_test.js
real 0m0.651s
user 0m0.464s
sys 0m0.116s
如果我在本地安装软件包,则需要6秒钟.
If I install the package locally, the require takes 6 seconds.
$ npm install zombie --no-bin-links
...
$ time node zombie_test.js
real 0m5.933s
user 0m0.992s
sys 0m1.424s
我尝试过的任何其他节点模块都不会发生这种速度下降.如果将本地npm-install本地安装到VM上的非共享目录,也不会发生这种情况.
This drop in speed does not happen with any other node modules I've tried. It also doesn't happen if I local npm-install to a non-shared directory on the VM.
有人知道为什么僵尸会出现这种减速吗,还是我可以做些什么来改善它?
Does anybody know why this slowdown occurs for zombie, or if I can do something to improve it?
推荐答案
Mitchell Hashimoto (the developer of vagrant) put together some test results that show the speeds of different virtual machine file systems. Long story short, native (non shared folders) >>>>>> NFS >> Virtual Box shared folders.
因此,切换到NFS是一个很好的改进.但是,最新版本的Vagrant添加了对 Rsync同步文件夹的支持.使用它们与普通的共享文件夹有些不同,但是好处是在VM文件系统中访问迅速.它应该等同于他的第一篇博客文章中报道的"Native Virtual Box"性能.
So switching to NFS is a good improvement. However, the latest version of Vagrant added support for Rsync Synced Folders. Using them is a little different from normal shared folders, but the benefit is that in VM file system access is blazing fast. It should be equivalent to the "Native Virtual Box" performance reported in his first blog post.
这篇关于Zombie.js在VirtualBox共享文件夹中运行缓慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!