2

我有 Ubuntu 12.04 的 VirtualBox。我使用 Vagant 来设置我的环境。我在 Thin (rails s) 上运行 Rails 3.2.9,并从主机上的浏览器访问 VirtualBox 的 IP 地址 (10.10.11.xxx:3000)。此时我遇到了麻烦 - 页面加载非常缓慢,在 Rails 控制台上我看到它响应文件(css、js、图像)的速度有多慢:每个最多 5 秒!但是:如果我在 Ubuntu 中使用 0.0.0.0:3000 - 它可以完美运行。

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

问题出在哪里?在哪里寻找解决方案?

人们说这与反向DNS查找问题有关。我该如何解决?有人知道吗?

4

2 回答 2

6

确保不要将项目放在同步文件夹中(默认情况下,vboxsf当文件/目录数量很大时,它会使用已知的性能问题)。

Webrick 反向 DNS 查找

看起来你正在使用 Webrick(瘦似乎没有这个问题),编辑它config.rb以禁用反向 DNS 查找以加快它。

对于 rbenv 管理的 ruby​​,例如 =>~/.rbenv/versions/1.9.3-p448/lib/ruby/1.9.1/webrick/config.rb

更改:DoNotReverseLookup => nil:DoNotReverseLookup => true

注意:人们提到停止avahi-daemon,如果你使用它,你可以尝试停止它。我的理解是默认情况下它没有安装在 Ubuntu 服务器(或其他基本安装)(但桌面)上。

更多细节的类似问题

于 2013-10-09T23:21:38.330 回答
0

在 virtualbox 中运行 Ubuntu 12.10 和 13.04 时性能很慢?这是因为 Ubuntu 不能使用显卡进行加速,ubuntu 使用 CPU 通过 LLVMpipe 渲染图形。它使得在 virualbox 中运行 ubuntu 真的很慢。http://namhuy.net/951/how-to-fix-slow-performance-ubuntu-13-04-running-in-virtualbox.html

检查您的 Ubuntu 12.10 或 13.04 客户机是否使用 3D 加速

/usr/lib/nux/unity_support_test -p

你应该看到这样的东西

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

如果你看到“不是软件渲染”和“Unity 3D 支持”都说不。这意味着 Unity 正在使用慢速 LLVM 管道。

要启用 3D 支持,首先您需要更新 linux-headers

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

现在从设备插入 vitualbox guest iso 并手动安装

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

将 vboxvideo 插入 /etc/modules

sudo nano /etc/modules

在文件末尾添加“vboxvideo”

loop
lp
vboxvideo

重启机器

sudo reboot
于 2013-11-27T06:37:21.477 回答