Rails VERY slow in development using Ubuntu VVM
Asked Answered
H

2

2

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

Hite answered 8/3, 2013 at 13:40 Comment(3)
The rake/rails s slowness I would expect on a small VM, due to having to spin up the Rails environment before running the command. Navigating to a new page shouldn't do it though.Bumble
Can you post the log of one single request?Cablet
Which log do you want? When I run rake or rails s it just sits there for about 21s and then starts committing to the development log about what it is doing. If I run time rails r "puts 1" the user time is 21s...Hite
D
3

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

Diabolize answered 19/8, 2013 at 13:49 Comment(2)
This was the issue for me—I moved my server to a non-vboxfs folder and everything became fast. I originally tried the DoNotReverseLookup fix as well but it didn't work. Turns out that vboxfs shared folders are very slow: forums.virtualbox.org/viewtopic.php?f=1&t=14447&start=0Equilibrant
How can this be the answer? Rails server is being accessed over the network, not via shared folders.Cleliaclellan
E
0

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.

Enteritis answered 4/10, 2013 at 15:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.