VirtualBox priority (NICE) - how to decicate 1 core to guest
Posted: 28. Jan 2009, 09:21
Hello!
I need to give my win2003 guest the maximum possible CPU performance - regardless of the host machine workload. I know that VBox cannot eat both CPU cores, it uses 1 core maximum for 1 VM. In fact, this could be even better condition for me than SMP.
Idea is to give the guest full access to 1 host cpu core by raising VBox process priority (niceness). This ensures that guest never be slow even if server runs some big workload (I plan to install OpenVZ-based web-server on host).
This is safe as well - in case of big workload inside guest, the host will still have 1 core because of VBox cannot use both cores.
Everything looks perfect, but see what is in real life (host - ubuntu 8.04):
1. I run "renice -10 ..." against VBoxHeadless process.
2. I run "stress -c 20", effectively starting 20 threads on HOST
3. I run "cpustres" inside GUEST and run 4 threads.
4. On the HOST - the "top" output shows:
* 20 'stress' with nice=0
* 1 'VBoxHeadless' with nice=-10
* all the 21 processes receives almost equal CPU amount! It looks like nice -10 has no effect at all.
If I run "nice +10 stress" on host, then VBoxHeadless has 40% CPU, but still not 100% (full 1 core).
It differs a lot from the way process priority works on windows.
Why it works as above? Is this how it should work or something is wrong? How could I guarantee that guest receives as much CPU as it wants (from 1 core)?
I need to give my win2003 guest the maximum possible CPU performance - regardless of the host machine workload. I know that VBox cannot eat both CPU cores, it uses 1 core maximum for 1 VM. In fact, this could be even better condition for me than SMP.
Idea is to give the guest full access to 1 host cpu core by raising VBox process priority (niceness). This ensures that guest never be slow even if server runs some big workload (I plan to install OpenVZ-based web-server on host).
This is safe as well - in case of big workload inside guest, the host will still have 1 core because of VBox cannot use both cores.
Everything looks perfect, but see what is in real life (host - ubuntu 8.04):
1. I run "renice -10 ..." against VBoxHeadless process.
2. I run "stress -c 20", effectively starting 20 threads on HOST
3. I run "cpustres" inside GUEST and run 4 threads.
4. On the HOST - the "top" output shows:
* 20 'stress' with nice=0
* 1 'VBoxHeadless' with nice=-10
* all the 21 processes receives almost equal CPU amount! It looks like nice -10 has no effect at all.
If I run "nice +10 stress" on host, then VBoxHeadless has 40% CPU, but still not 100% (full 1 core).
It differs a lot from the way process priority works on windows.
Why it works as above? Is this how it should work or something is wrong? How could I guarantee that guest receives as much CPU as it wants (from 1 core)?