Linux Virtual Machine on VirtualBox suddenly running slow

1

I am running a VM using Virtual Box (version 4.2.26, but had same issue with v4.3.14)

The VM was created using Vagrant. It runs headless, it just serves up websites and I use "vagrant ssh" to get to the command line.

It was running perfectly fine two weeks ago, then I restarted my computer and now it runs ridiculously slow for some things.

  1. The ls and cd commands have a noticeable 1 second delay before they do anything and I am sshed in.
  2. It takes 30 - 45 seconds to load a webpage served from the VM (if the script accesses MySQL). These pages used to take less than a second to load.
  3. "vagrant up" used to take a couple seconds to load the VM, now it takes almost 5 minutes.

I've rebuilt the VM several times. I've uninstalled VirtualBox and reinstalled it (both the newest version and the version that matches the .box image's version)

There is no code/database differences between when everything worked fine and when it started going slow.

MySQL is also running on the VM (MySQL, Apache, and Nginx are running on the VM).

The mysql CLI responds quickly. And MySQL Workbench connected remotely to the VM gets results from the DB quickly.

traceroute tells me that my scripts should be connecting directly to MySQL locally and are not getting routed outside of the VM.

A plain old .html or .php file loads quickly. Only if the script connects to the DB does it go slow.

My PC that is running the VM is working fine. And I have this speed issue even after a reboot and only attempting to run the VM by itself.

How do I even debug something like this?

hdctambien

Posted 2014-08-08T18:06:43.200

Reputation: 11

Any IP/hostname changes? – Marcelo – 2014-08-08T18:44:49.720

The IP of the VM is set in the .vagrant file and hasn't changed. The hostname of the VM also hasn't changed and is set in my HOSTS file. – hdctambien – 2014-08-08T19:43:06.553

Another note: my PC is running Windows 8. It has 16gb of RAM (currently 11 GB free) and an AMD quadcore 3.4Ghz processor. The VM is set to use 1GB of RAM. – hdctambien – 2014-08-08T19:45:42.130

I encountered similar issues, especially for point 2 on my Windows host and Ubuntu VM. It turned out that the main culprit of the slow down was that my laptop was on Power Saving Mode for its Power Plan. Switching it back to Balanced or High performance greatly improved response times. – Sun – 2014-09-01T17:38:18.127

Answers

0

Turns out my issue was that Windows 8 Hyper-V conflicts with Virtual Box.

I disabled Hyper-V and everything started working swimmingly.

My guess is that I had Hyper-V disabled initially, and maybe a windows update enabled it which is why everything worked one day and then pooped the bed the next.

hdctambien

Posted 2014-08-08T18:06:43.200

Reputation: 11