All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] QEMU websockets support is laggy?
@ 2017-01-24 22:02 Brian Rak
  2017-01-26 20:06 ` Dr. David Alan Gilbert
  2017-01-27  9:35 ` Daniel P. Berrange
  0 siblings, 2 replies; 6+ messages in thread
From: Brian Rak @ 2017-01-24 22:02 UTC (permalink / raw)
  To: qemu-devel

We've been considering switching over to using qemu's built in 
websockets support (to avoid the overhead of needing websockify 
running).  We've been seeing very poor performance after the switch (it 
takes the console 4-5 seconds to update after pressing a key).  So far, 
I haven't been able to find any indication of why this is happening.  
The exact same configuration works perfectly when running with 
websockify, but laggy when hitting qemu directly.

I've tried a few things (disabling encryption, bypassing our usual nginx 
proxy, even connecting via a ssh tunnel), and haven't made any sort of 
progress here.  Has anyone else seen this?  Any suggestions as to where 
I should start looking?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] QEMU websockets support is laggy?
  2017-01-24 22:02 [Qemu-devel] QEMU websockets support is laggy? Brian Rak
@ 2017-01-26 20:06 ` Dr. David Alan Gilbert
  2017-01-27  9:35 ` Daniel P. Berrange
  1 sibling, 0 replies; 6+ messages in thread
From: Dr. David Alan Gilbert @ 2017-01-26 20:06 UTC (permalink / raw)
  To: Brian Rak, berrange; +Cc: qemu-devel

* Brian Rak (brak@gameservers.com) wrote:
> We've been considering switching over to using qemu's built in websockets
> support (to avoid the overhead of needing websockify running).  We've been
> seeing very poor performance after the switch (it takes the console 4-5
> seconds to update after pressing a key).  So far, I haven't been able to
> find any indication of why this is happening.  The exact same configuration
> works perfectly when running with websockify, but laggy when hitting qemu
> directly.
> 
> I've tried a few things (disabling encryption, bypassing our usual nginx
> proxy, even connecting via a ssh tunnel), and haven't made any sort of
> progress here.  Has anyone else seen this?  Any suggestions as to where I
> should start looking?


copying in Dan Berrange who knows the websocket code.

Dave

--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] QEMU websockets support is laggy?
  2017-01-24 22:02 [Qemu-devel] QEMU websockets support is laggy? Brian Rak
  2017-01-26 20:06 ` Dr. David Alan Gilbert
@ 2017-01-27  9:35 ` Daniel P. Berrange
  2017-01-27 18:08   ` Daniel P. Berrange
  1 sibling, 1 reply; 6+ messages in thread
From: Daniel P. Berrange @ 2017-01-27  9:35 UTC (permalink / raw)
  To: Brian Rak; +Cc: qemu-devel

On Tue, Jan 24, 2017 at 05:02:25PM -0500, Brian Rak wrote:
> We've been considering switching over to using qemu's built in websockets
> support (to avoid the overhead of needing websockify running).  We've been
> seeing very poor performance after the switch (it takes the console 4-5
> seconds to update after pressing a key).  So far, I haven't been able to
> find any indication of why this is happening.  The exact same configuration
> works perfectly when running with websockify, but laggy when hitting qemu
> directly.
> 
> I've tried a few things (disabling encryption, bypassing our usual nginx
> proxy, even connecting via a ssh tunnel), and haven't made any sort of
> progress here.  Has anyone else seen this?  Any suggestions as to where I
> should start looking?

Can you clarify the exact setup you have ?  As mentioned on IRC, I don't
see any degradation in performance betweeen builtin websockets vs a
websockets proxy - if anything the builtin websockets is marginally less
laggy.  I was connecting over TCP localhost, however, so would not see
any effects of network latency. My test was QEMU git master, with noVNC
git master.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://entangle-photo.org       -o-    http://search.cpan.org/~danberr/ :|

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] QEMU websockets support is laggy?
  2017-01-27  9:35 ` Daniel P. Berrange
@ 2017-01-27 18:08   ` Daniel P. Berrange
  2017-01-30 10:51     ` Daniel P. Berrange
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel P. Berrange @ 2017-01-27 18:08 UTC (permalink / raw)
  To: Brian Rak; +Cc: qemu-devel

On Fri, Jan 27, 2017 at 09:35:38AM +0000, Daniel P. Berrange wrote:
> On Tue, Jan 24, 2017 at 05:02:25PM -0500, Brian Rak wrote:
> > We've been considering switching over to using qemu's built in websockets
> > support (to avoid the overhead of needing websockify running).  We've been
> > seeing very poor performance after the switch (it takes the console 4-5
> > seconds to update after pressing a key).  So far, I haven't been able to
> > find any indication of why this is happening.  The exact same configuration
> > works perfectly when running with websockify, but laggy when hitting qemu
> > directly.
> > 
> > I've tried a few things (disabling encryption, bypassing our usual nginx
> > proxy, even connecting via a ssh tunnel), and haven't made any sort of
> > progress here.  Has anyone else seen this?  Any suggestions as to where I
> > should start looking?
> 
> Can you clarify the exact setup you have ?  As mentioned on IRC, I don't
> see any degradation in performance betweeen builtin websockets vs a
> websockets proxy - if anything the builtin websockets is marginally less
> laggy.  I was connecting over TCP localhost, however, so would not see
> any effects of network latency. My test was QEMU git master, with noVNC
> git master.

It turns out that to see the problem you have a wait a while - the
connection is initially fine, but gets worse over time. Using a TCP
connection seems to make it get worse more quickly.

After a painful debugging session I've discovered the problem is that
QEMU is reading data off the socket, decoding a websockets packet and
then processing it. The problem is if the read off the socket gets
multiple websockets packets at once, it only decodes the first packet.
The remaining packets aren't decoded until more data arrives on the
socket. This gets progressively worse & worse. I'll send a patch for
this next week...


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://entangle-photo.org       -o-    http://search.cpan.org/~danberr/ :|

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] QEMU websockets support is laggy?
  2017-01-27 18:08   ` Daniel P. Berrange
@ 2017-01-30 10:51     ` Daniel P. Berrange
  2017-01-30 16:16       ` Brian Rak
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel P. Berrange @ 2017-01-30 10:51 UTC (permalink / raw)
  To: Brian Rak; +Cc: qemu-devel

On Fri, Jan 27, 2017 at 06:08:20PM +0000, Daniel P. Berrange wrote:
> On Fri, Jan 27, 2017 at 09:35:38AM +0000, Daniel P. Berrange wrote:
> > On Tue, Jan 24, 2017 at 05:02:25PM -0500, Brian Rak wrote:
> > > We've been considering switching over to using qemu's built in websockets
> > > support (to avoid the overhead of needing websockify running).  We've been
> > > seeing very poor performance after the switch (it takes the console 4-5
> > > seconds to update after pressing a key).  So far, I haven't been able to
> > > find any indication of why this is happening.  The exact same configuration
> > > works perfectly when running with websockify, but laggy when hitting qemu
> > > directly.
> > > 
> > > I've tried a few things (disabling encryption, bypassing our usual nginx
> > > proxy, even connecting via a ssh tunnel), and haven't made any sort of
> > > progress here.  Has anyone else seen this?  Any suggestions as to where I
> > > should start looking?
> > 
> > Can you clarify the exact setup you have ?  As mentioned on IRC, I don't
> > see any degradation in performance betweeen builtin websockets vs a
> > websockets proxy - if anything the builtin websockets is marginally less
> > laggy.  I was connecting over TCP localhost, however, so would not see
> > any effects of network latency. My test was QEMU git master, with noVNC
> > git master.
> 
> It turns out that to see the problem you have a wait a while - the
> connection is initially fine, but gets worse over time. Using a TCP
> connection seems to make it get worse more quickly.
> 
> After a painful debugging session I've discovered the problem is that
> QEMU is reading data off the socket, decoding a websockets packet and
> then processing it. The problem is if the read off the socket gets
> multiple websockets packets at once, it only decodes the first packet.
> The remaining packets aren't decoded until more data arrives on the
> socket. This gets progressively worse & worse. I'll send a patch for
> this next week...

I've just sent a patch & would appreciate your testing to confirm that
it fixes the problem for you too.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://entangle-photo.org       -o-    http://search.cpan.org/~danberr/ :|

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] QEMU websockets support is laggy?
  2017-01-30 10:51     ` Daniel P. Berrange
@ 2017-01-30 16:16       ` Brian Rak
  0 siblings, 0 replies; 6+ messages in thread
From: Brian Rak @ 2017-01-30 16:16 UTC (permalink / raw)
  To: Daniel P. Berrange; +Cc: qemu-devel



On 1/30/2017 5:51 AM, Daniel P. Berrange wrote:
> On Fri, Jan 27, 2017 at 06:08:20PM +0000, Daniel P. Berrange wrote:
>> On Fri, Jan 27, 2017 at 09:35:38AM +0000, Daniel P. Berrange wrote:
>>> On Tue, Jan 24, 2017 at 05:02:25PM -0500, Brian Rak wrote:
>>>> We've been considering switching over to using qemu's built in websockets
>>>> support (to avoid the overhead of needing websockify running).  We've been
>>>> seeing very poor performance after the switch (it takes the console 4-5
>>>> seconds to update after pressing a key).  So far, I haven't been able to
>>>> find any indication of why this is happening.  The exact same configuration
>>>> works perfectly when running with websockify, but laggy when hitting qemu
>>>> directly.
>>>>
>>>> I've tried a few things (disabling encryption, bypassing our usual nginx
>>>> proxy, even connecting via a ssh tunnel), and haven't made any sort of
>>>> progress here.  Has anyone else seen this?  Any suggestions as to where I
>>>> should start looking?
>>> Can you clarify the exact setup you have ?  As mentioned on IRC, I don't
>>> see any degradation in performance betweeen builtin websockets vs a
>>> websockets proxy - if anything the builtin websockets is marginally less
>>> laggy.  I was connecting over TCP localhost, however, so would not see
>>> any effects of network latency. My test was QEMU git master, with noVNC
>>> git master.
>> It turns out that to see the problem you have a wait a while - the
>> connection is initially fine, but gets worse over time. Using a TCP
>> connection seems to make it get worse more quickly.
>>
>> After a painful debugging session I've discovered the problem is that
>> QEMU is reading data off the socket, decoding a websockets packet and
>> then processing it. The problem is if the read off the socket gets
>> multiple websockets packets at once, it only decodes the first packet.
>> The remaining packets aren't decoded until more data arrives on the
>> socket. This gets progressively worse & worse. I'll send a patch for
>> this next week...
> I've just sent a patch & would appreciate your testing to confirm that
> it fixes the problem for you too.
>
> Regards,
> Daniel
Confirmed, with the patch the built in websockets support performs just 
as well as vnc + websockify.  Thanks for the help!

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-01-30 16:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-24 22:02 [Qemu-devel] QEMU websockets support is laggy? Brian Rak
2017-01-26 20:06 ` Dr. David Alan Gilbert
2017-01-27  9:35 ` Daniel P. Berrange
2017-01-27 18:08   ` Daniel P. Berrange
2017-01-30 10:51     ` Daniel P. Berrange
2017-01-30 16:16       ` Brian Rak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.