Kit Ho
Kit Ho

Reputation: 26968

Running Rails very slow inside Virtual Box Ubuntu 12.04

I have VirtualBox with Ubuntu 12.04. I use Vagant to setup my environment. I run Rails 3.2.9 on thin (rails s) and go to VirtualBox's IP adrress (10.10.11.xxx:3000) from browser on my host machine. At this moment I face troubles - page loads very very slowly, on Rails console i see how slowly it responses files (css, js, images): up to 5 seconds for each! But: if I go 0.0.0.0:3000 inside Ubuntu - it works perfect.

Inside VM, there are two Network interface
eth0 --> it is set by Vagrant (NAT)
eth1 --> bridge, has an external IP 10.10.11.xxx

Where is the problem? Where to look for a solution?

People said it is related to reverse DNS lookup problem. How can I solve it? anyone has idea?

Upvotes: 2

Views: 2279

Answers (2)

Don
Don

Reputation: 9

Having very slow perform when running Ubuntu 12.10 and 13.04 in virtualbox? It’s because Ubuntu can’t use graphics card for acceleration, ubuntu uses CPU for rendering graphics trough LLVMpipe. It makes running ubuntu in virualbox really slow. http://namhuy.net/951/how-to-fix-slow-performance-ubuntu-13-04-running-in-virtualbox.html

To check if your Ubuntu 12.10 or 13.04 guest is using 3D acceleration

/usr/lib/nux/unity_support_test -p

You should see something like this

Not software rendered: no
Not blacklisted: yes
GLX fbconfig: yes
GLX texture from pixmap: yes
GL npot or rect textures: yes
GL vertex program: yes
GL fragment program: yes
GL vertex buffer object: yes
GL framebuffer object: yes
GL version is 1.4+: yes
Unity 3D supported: no

If you see “Not software rendered” and “Unity 3D supported” both say no. This means Unity is using slow LLVMpipe.

To enable 3D supported, fist you will need to update linux-headers

uname -r
sudo apt-get install linux-headers-$(uname -r)
sudo apt-get autoremove
sudo apt-get install build-essential

Now insert vitualbox guest iso from devices and to install manually

cd /media
ls
cd username
ls
cd VBOX*
ls
sudo ./VBoxLinuxAdditions.run

Insert vboxvideo to /etc/modules

sudo nano /etc/modules

Add “vboxvideo” at the end of the file

loop
lp
vboxvideo

Reboot the machine

sudo reboot

Upvotes: 0

Terry Wang
Terry Wang

Reputation: 13920

Make sure you don't place your project in synced folder (by default it uses vboxsf which has known performance issues when number of files/directories are large).

Webrick Reverse DNS Lookup

Looks like you are using Webrick (thin doesn't seem to have this problem), edit its config.rb to disable reverse DNS lookup to speed it up.

For rbenv managed ruby, e.g. => ~/.rbenv/versions/1.9.3-p448/lib/ruby/1.9.1/webrick/config.rb

Change :DoNotReverseLookup => nil to :DoNotReverseLookup => true

NOTE: People mentioned stopping the avahi-daemon, you can try to stop it if you use it. My understanding is that it is NOT installed by default on Ubuntu Server (or other base installs) (but desktop).

Similar problems for more details

Upvotes: 6

Related Questions