Rails VERY slow in development using Ubuntu VVM

左心房为你撑大大i 提交于 2020-01-01 19:00:15

问题


I have the following config

Ubuntu server 10.04 running on a VirtualBox VM (RAM and cpu usage are low) ruby 1.9.3 rails 3.2.12 webrick

If I do any of the things below the system seems to wait for about 15 seconds before executing the command - rake taks - rails s - navigating to a new page in the app

Things I have looked at - this is before the sprockets section, and does the same with rake, so at the moment I am not looking at things such as dev-tweaks - I have changed the webrick config.rb to have the line :DoNotReverseLookup => true - I have host entries for my host machine on the VM. ping is very fast between both machines - I have tried Thin and experienced the same issue. I haven't tried mongrel but am thinking I will see the same

But still it is excruciatingly slow.

Any thoughts?

Michael


回答1:


If you're using VirtualBox shared folders (vboxfs), disk I/O is probably the issue. vboxfs is really slow, and Ruby on Rails does a lot of files operations in development mode (checking if any files changed etc.).

If you're not using Windows, sharing folders with NFS is the way to go.

Check this link: http://meta.discourse.org/t/shared-folder-performance-on-vagrant/2443/14




回答2:


I had this issue using VirtualBox shared folders. As soon as I switched to NFS, I couldn't really make a difference between running natively or in the VM. I imagine Rails autoloading in dev mode is the culprit here. See here on how to configure vagrant to use NFS: https://coderwall.com/p/uaohzg

If you can't setup NFS properly (on OSX 10.7 I had to install NFS Manager to make it work), you can always script away and rsync your rails folder every time you modify files locally in your editor. You don't want to run rails on a VirtualBox shared folder.



来源:https://stackoverflow.com/questions/15295298/rails-very-slow-in-development-using-ubuntu-vvm

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