Hello!
We would like to contribute to VirtualBox under MIT license. We want to suggest our changes for multiple VMs starting speed-up.
The basic idea is to take out getting of host interfaces from write lock on host object. When many VMs are starting at the same time then FindHostNetworkInterfaceByName is called for every machine and it updates network interfaces. So if umount of VMs is large enough then execution time of this function greatly increases due to lock wait.
There are two VBoxSVC logs in attach: before applying our changes and after it. In every case we started 80 VMs at the same time. Statistic of FindHostNetworkInterfaceByName execution time before changes is:
Min: 0.38 s (nspr-31)
Med: 14.13 s (nspr-82)
Max: 37.70 s (nspr-188)
Avg: 15.07 s
Statistic after changes is:
Min: 1.12 s (nspr-85)
Med: 6.56 s (nspr-228)
Max: 17.27 s (nspr-7)
Avg: 5.82 s
Regards,
========
by Alexander Urakov, from Dr.Web, 08.Apr.2015 (retrieved from ML)
Updating network interfaces list speed-up
-
- Volunteer
- Posts: 3342
- Joined: 10. May 2007, 16:59
- Location: Israel
Updating network interfaces list speed-up
- Attachments
-
- HostImpl.patch.txt
- (6.68 KiB) Downloaded 39 times
-
- Volunteer
- Posts: 3342
- Joined: 10. May 2007, 16:59
- Location: Israel
Re: Updating network interfaces list speed-up
Test 100 VMs bridged to Host interface "eth0". They have empty hard disk, so non-bootable.
3:39 min for 100 VMs, without patch.
Command to clone 1 VM:
$ VBoxManage clonevm "ZeroVM" --mode all --register --name "ZeroVM Clone"
Command to clone 100 VMs:
$ for i in `seq 1 100`; do VBoxManage clonevm "ZeroVM" --mode all --register --name "ZeroVM Clone $i"; done
70 VMs, Host-interface mode:
unpatched:
2:30 min boot. -- 2:33 min (2nd run)
patched:
2:35 min boot. .. 2:34 (2nd run)
more commands:
creating host-ifs:
for i in `seq 1 70`; do VBoxManage hostonlyif create; done
attaching VMs:
for i in `seq 1 70`; do VBoxManage modifyvm "HostifrVM Clone $i" --hostonlyadapter1 vboxnet$i; done
adding it all to /etc/network/interfaces :
for i in `seq 1 80`; do echo "iface vboxnet$i inet dhcp" >> /etc/network/interfaces; done
VBoxHeadless - 70 VMs:
Starting 70 VMs:
$ for i in `seq 1 70`; do VBoxManage startvm "HostifrVM Clone $i" --type headless; done
Stopping 70 VMs:
for i in `seq 1 70`; do VBoxManage controlvm "HostifrVM Clone $i" poweroff; done
(unpatched)
25 sec... 25 sec (2nd run)
(patched)
23 sec. ... 25 sec (2nd run)
3:39 min for 100 VMs, without patch.
Command to clone 1 VM:
$ VBoxManage clonevm "ZeroVM" --mode all --register --name "ZeroVM Clone"
Command to clone 100 VMs:
$ for i in `seq 1 100`; do VBoxManage clonevm "ZeroVM" --mode all --register --name "ZeroVM Clone $i"; done
70 VMs, Host-interface mode:
unpatched:
2:30 min boot. -- 2:33 min (2nd run)
patched:
2:35 min boot. .. 2:34 (2nd run)
more commands:
creating host-ifs:
for i in `seq 1 70`; do VBoxManage hostonlyif create; done
attaching VMs:
for i in `seq 1 70`; do VBoxManage modifyvm "HostifrVM Clone $i" --hostonlyadapter1 vboxnet$i; done
adding it all to /etc/network/interfaces :
for i in `seq 1 80`; do echo "iface vboxnet$i inet dhcp" >> /etc/network/interfaces; done
VBoxHeadless - 70 VMs:
Starting 70 VMs:
$ for i in `seq 1 70`; do VBoxManage startvm "HostifrVM Clone $i" --type headless; done
Stopping 70 VMs:
for i in `seq 1 70`; do VBoxManage controlvm "HostifrVM Clone $i" poweroff; done
(unpatched)
25 sec... 25 sec (2nd run)
(patched)
23 sec. ... 25 sec (2nd run)
- Attachments
-
- vbox-5.0.0-beta1-hostimpl.patch.txt
- patch ported to vbox 5.0-beta1
- (9.13 KiB) Downloaded 35 times