Ubuntu in Virtualbox - WEBrick web server very slow when using local IP address
I'm using Ubuntu (Lucid Lynx) to learn Ruby On Rails. I'm running Ubuntu in VirtualBox (the host is Windows 7 Ultimate), using bridged networking.
When I run my Rails app and point the browser at it using localhost:3000, the app responds immediately and my page is rendered in a second or two.
However, if I use 10.0.0.5:3000 (where 10.0.0.5 is my IP address reported using ifconfig
), the response from my rails app is incredibly slow - maybe 30 seconds or more for the server to respond and render the page.
This happens in both Firefox and Chrome. Also, when I hit the Rails app from the host (to test it in IE), I get the same slooooooow response.
Any ideas what might be going on? I've tried it with two different routers, and on two different networks (work and home) with the same result.
Cheers all.
Try running
sudo service avahi-daemon stop
Also try setting WEBrick /usr/lib/ruby//webrick/config.rb
:DoNotReverseLookup => true
Also see: "Stackoverflow WEBrick slow from remote desktop"
It is WEBrick issue, no problems when you use other web servers.
I tried Mongrel and Thin with Ruby on Rails 3.0.x, both working great.
I suggest using Mongrel - simply add it to your Gemfile:
gem "mongrel"
or you can set it only for development and test, not to break production:
group :test, :development do
gem "mongrel"
end
Now start server same way as you did before and Mongrel starts instead of WEBrick.
If you prefer Thin, you need to start server with thin start
or WEBrick will be started.