[vbox-dev] API method execution sometimes extremely slow

email at thorstenschaefer.de email at thorstenschaefer.de
Thu Dec 12 14:07:36 GMT 2013

Hi Klaus,

Unfortunately, I cannot see any real pattern in when the big delays
happen. What I¹m doing is simulating user input to test software using the
Virtualbox API. So basically I¹m sending a lot of key downs and key up
messages to the VM (I know its possible to send key press events, but for
testing reasons I need to send separate events). I¹m always using the same
virtual machine and the load during tests is always low on the host.
Sometimes I get now issues at all and all events are send within a few
milliseconds each, but other times a single event can take more than a
second. Note that when this happens, I don¹t see any changes in memory
consumption, nor the average CPU load on the host. Also, the times
measured are only the API calls, i.e., I get a reference to the
VM/console/keyboard at the beginning and then just send hundreds of events
using this reference. Also, it is typically that a couple of events are
strongly delayed, but a few seconds later it can go back to normal speed.
I imagine its hard to figure out the cause based on these information; is
there a possibility to create a performance log so one can see which part
of the API call processing code causes the delay? Or can I provide other
information to help figuring out the cause?


PS: Also tried to use the Web service API instead of XPCOM, but it was the
same issue.

Am 12/11/13, 9:14 AM schrieb "Klaus Espenlaub" unter
<klaus.espenlaub at oracle.com>:

>Hi Thorsten,
>On 10.12.2013 14:44, email at thorstenschaefer.de wrote:
>> Hi,
>> I am using VirtualBox 4.3.4 on MacOS Maverick. The VM is a Windows 7
>> 64bit guest running on a Macbook Pro (8 cores, 16GB RAM). The issue I
>> have is as described at
>> https://forums.virtualbox.org/viewtopic.php?f=34&t=57685:
>> When using the API methods over Java using XPCOM, some method calls
>> randomly take a huge amount of time. For instance, things that are
>> typically done within 1-5ms sometimes take up to 2000ms! Even when these
>> delays happen, the CPU usage is never even near 100% and their is
>> sufficient free memory on the host available. I wonder if someone can
>> give me insights into what might cause these kind of delays and if its
>> maybe possible to communicate more quickly. For instance, if its caused
>> by interprocess scheduling, is it possible to ³open a stream² and then
>> just send the commands to it? Fwiw, if I perform the same stuff (e.g.
>> Key clicks) manually within the VM, there are never delays like this
>> observable.
>Never seen such problems, and as the Java/XPCOM combo in the end
>interfaces to the C++ API which is used by every VirtualBox component
>(the manager GUI and the VM processes) I doubt that there's a generic
>When does the big delay happen? Is it really for individual API calls,
>or do you count in the setup time (getting the VirtualBox reference,
>setting up a session)?
>We don't write much Java code, and don't actively use this way of
>talking to the API, but we're quite sure that more than only a few
>people go this way.
>> Cheers,
>> Thorsten
>vbox-dev mailing list
>vbox-dev at virtualbox.org

More information about the vbox-dev mailing list