Limit CPU Usage of created Virtual Boxes #625

Closed
dwt opened this Issue Jan 5, 2012 · 8 comments

Comments

Projects
None yet
3 participants

dwt commented Jan 5, 2012

If the box does something really heavy sometimes that can bring down the host system. While this is principally a bug in VirtualBox it seems they cannot easily fix it for now.

One really great workaround to the problem is to limit the created boxes to 99% cpu max, so there is always enough left to kill the box if need be.

So here's the request: Make that a default setting so I can be sure I still retain control of my computer, even if the box should misbehave. Then later when VirtualBox has finally fixed the issue (sorry, no bug number right now) remove it again.

Owner

mitchellh commented Jan 6, 2012

Hm, I'm not sure if this should be a default, but with the current git-version of Vagrant (to be version 0.9.0) you can just do the following in your Vagrantfile to achieve this result:

config.vm.customize ["modifyvm", :id, "--cpuexecutioncap", "90"]

Where "90" is whatever percentage of the host CPU you'd like to cap it at.

mitchellh closed this Jan 6, 2012

dwt commented Jan 6, 2012

Hm, I'm not sure if this should be a default, but with the current git-version of Vagrant (to be version 0.9.0) you can just do the following in your Vagrantfile to achieve this result:

config.vm.customize ["modifyvm", :id, "--cpuexecutioncap", "90"]

Where "90" is whatever percentage of the host CPU you'd like to cap it at.

I would argue that 1% performance degradation in the extreme case does not hurt you when developing, but is much more usefull than your host system becoming unusable should something go wrong with the vagrant box.

I'll try to add that to our vagrant files though as a workaround for now. I'm really hoping you might consider adding the cap of 99% as a standard.

dwt commented Jan 6, 2012

Hm, I'm not sure if this should be a default, but with the current git-version of Vagrant (to be version 0.9.0) you can just do the following in your Vagrantfile to achieve this result:

Damn, and I'm not on the dev version yet (and don't want to go there for my production environment).

Looking forward to that release. :)

Contributor

leth commented Jan 30, 2012

Thanks! This tip is useful to me as there appears to be a bug in the OSX version of virtualbox.
Heavy disk i/o can lock the host os at 100% cpu in kernel_task. I've seen it mostly when chef is installing stuff via apt.

Owner

mitchellh commented Jan 30, 2012

@leth Does the cpuexectuioncap fix this issue?

Contributor

leth commented Jan 30, 2012

It didn't happen every time, for some reason.
Since adding it I've also only provisioned a box once (which went ok), so I can't really be sure.
I'll let you know if it happens again.

Another symptom was commands on the guest erroring out with 'read-only filesystem' errors, but mount claimed they were all mounted "rw".

dwt commented Mar 7, 2012

I'd like to add that despite the cpu usage limits the box would completely block my machine and in one instance even crash it. So sadly this doesn't seem to help anymore or helped out of accident the first instance.

Contributor

leth commented Mar 7, 2012

A college of mine had to lower the limit to 75% to develop on his MacBook air, so perhaps there's not a default which will help for all systems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment