[vbox-dev] API method execution sometimes extremely slow

email at thorstenschaefer.de email at thorstenschaefer.de
Thu Dec 26 17:16:31 GMT 2013


I checked this but GC is not the cause: it happens even if no GC takes
One thing which I observed and cannot explain is the following:
I wrote a tiny program that just creates 1000 keydown/keyup events
(http://pastebin.com/cqUuCfq6). If I
let it run in a VM where I minimize the VM window (no screen visible),
every click takes less than 3ms, which is the expected behavior. However,
if the window is not minimized and the keys are sent to a notepad window,
a lot of calls take way more time, up to 30 times as much. Furthermore, if
I run the code in a non-minimized window but don’t open notepad as a
consumer of the keys (hence, the keys get sent to the VM but they don’t
have any affect), it’s as fast as in the minimized case.
I suspect that the issue is as follows: I sent key events and those key
events affect the graphics, which causes an update in some other part of
the VM (in order to render an updated view). The latter may take longer
and is blocking the key sending through the API. Can anyone confirm that
this is what is going on within the implementation and is there any way to
get rid of the blocking?


Am 12/24/13, 6:25 PM schrieb "Nikolay Igotti" unter <igotti at gmail.com>:

>Hi Thorsten,
>Couldn't it be GC pauses in your JVM? Try appropriate JVM logging or
>JConsole to see if
>there's correlation between slow calls and GC.
>11.12.2013 16:14, Klaus Espenlaub пишет:
>> 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
>>> 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.
>> Klaus
>>> Cheers,
>>> Thorsten
>> _______________________________________________
>> vbox-dev mailing list
>> vbox-dev at virtualbox.org
>> https://www.virtualbox.org/mailman/listinfo/vbox-dev
>vbox-dev mailing list
>vbox-dev at virtualbox.org

More information about the vbox-dev mailing list