-
-
Notifications
You must be signed in to change notification settings - Fork 641
Benchmark # of CPU cores for default config #855
Comments
This is something that should be optimized for the host machine and in my experience I've found the best performance is when the VM cpu's are the same as the host. From Seth a maintainer of Vagrant -- https://sethvargo.com/faster-rails-development-with-vagrant/ see "Use all CPUs and half your RAM" |
Yeah, but two of his references regarding the CPUs now show different results. How to make Vagrant performance not suck has
The The problem appears to be Virtualbox itself. FWIW, on a 4-core Mac / Virtualbox |
I typically use VMware Fusion, which handles things a bit differently, and definitely feels faster with 2 CPUs than 1... but it would be good to have more hard data on whether 1 or 2 would be the best default. 2 seems at least safe since like 99.9% of all dev laptops have a 2+ core CPU nowadays. |
Yeah, seems safe. Though, I gather from the reports that the primary factor is using the Virtualbox provider, not the number of host cores. Is it possible to set the default value based on the provider (like, Here are my simple benchmark results on a 2.3 GHz 4-core MacBook Pro: ab -c1 -n100 http://example.com/
Manual page reloads, devel page timer
wrk -t1 -c1 -d30s http://example.com/
|
Interesting results! I'll have to run them locally on VirtualBox to confirm/reproduce, and if it's the same, I'll definitely bump back to 1 vcpu and stick a note in the config that if using VirtualBox, consider leaving it unless you have a specific need for multi-core emulation (which could be slower). |
Testing on my i7 2013 MacBook Air (average of 3 runs, after discarding one):
VirtualBox:
Delta: ~8.2% performance increase when using 1 CPU on VirtualBox. VMware:
Delta: ~1.1% performance increase when using 1 CPU on VMware. So it seems 1 CPU is a sane default—no real regression on VMware, and makes it faster on VirtualBox. Might as well switch it! |
@kentr - Thanks again for all the benchmarking! I've attributed the commit to you :) |
Awesome. I'm surprised it's also slightly faster on VMware. |
Oh, I misread the VMware results. Now I see 2 CPUs is slightly faster. |
@kentr - Yeah, just barely... not worth defaulting to 2 IMO. |
Didn't find this in the issue queue...
There are reports that VMs with multiple cores are slower than VMs with 1 core, even with KVM:
Have you tested this? Perhaps it's worthwhile to set
vagrant_cpus: 1
in the default config.The text was updated successfully, but these errors were encountered: