Zombie.js running slowly in VirtualBox shared folder

喜你入骨 提交于 2020-01-04 21:29:48

问题


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.

Suppose I have the following in zombie_test.js:

require("zombie");

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

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

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?


回答1:


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.

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.



来源:https://stackoverflow.com/questions/23319680/zombie-js-running-slowly-in-virtualbox-shared-folder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!