[X2go-Dev] libssh, nagle, and performance issues

Oleksandr Shneyder oleksandr.shneyder at obviously-nice.de
Mon Sep 19 13:44:15 CEST 2011


Am 19.09.2011 13:30, schrieb Mike Gabriel:
> Hi Alex,
> 
> On Mo 19 Sep 2011 09:51:16 CEST Oleksandr Shneyder wrote:
> 
>> Am 17.09.2011 03:39, schrieb John A. Sullivan III:
>>> On Fri, 2011-09-16 at 23:17 +0200, Mike Gabriel wrote:
>>>> Hi John, hi Alex,
>>>>
>>>> On Fr 16 Sep 2011 21:56:38 CEST "John A. Sullivan III" wrote:
>>>>
>>>>> Hello, all.  Since moving to the newer clients using libssh, I've
>>>>> noticed what appears to be a performance degradation.  It smells like
>>>>> Nagle coalescing packets, e.g., most of the screen will paint, then it
>>>>> will pause a moment, and then the rest will paint.  Is there any
>>>>> chance
>>>>> we have neglected to disable Nagle when invoking libssh?
>>>>>
>>>>> This appears to have affected the SNMP over SSH project:
>>>>> http://books.google.com/books?id=S62is2vVoVgC&pg=PA29&lpg=PA29&dq=libssh
>>>>>
>>>>> +nagle&source=bl&ots=F8Iw-pvQxd&sig=f5dfy0K0ewzSZOhqzTJRSKsDKZ8&hl=en&ei=KppzTrCZD4LJgQeMxLzzDA&sa=X&oi=book_result&ct=result&resnum=1&sqi=2&ved=0CBwQ6AEwAA#v=onepage&q=libssh%20nagle&f=false
>>>>>
>>>>>
>>>>> This is in section 4.1. The difference was a latency of over 800ms to
>>>>> one of under 60ms.  That seems to be about what I am seeing. There
>>>>> is a
>>>>> delay of roughly a second and then the rest of the screen comes
>>>>> through.
>>>>> Thanks - John
>>>>
>>>> Indeed the TCP_NODELAY (which means: turn Nagle off) is not set for
>>>> the ssh tunnel in X2goClient. It probably is for the SSH connection
>>>> itself, as the SNMP patch has been reported to libssh upstream and
>>>> their patch suggestion has been sensible. However, for the SSH tunnels
>>>> built up for X2go this TCP_NODELAY option does perhaps not get set.
>>>>
>>>> @Alex: would this patch fix that in x2goclient???
>>>>
>>>> diff --git a/sshprocess.cpp b/sshprocess.cpp
>>>> index 9e72e8f..03ee9b6 100644
>>>> --- a/sshprocess.cpp
>>>> +++ b/sshprocess.cpp
>>>> @@ -88,6 +88,7 @@ void SshProcess::tunnelLoop()
>>>>       const char y=1;
>>>>   #endif
>>>>       setsockopt(serverSocket, SOL_SOCKET, SO_REUSEADDR,&y,
>>>> sizeof(int));
>>>> +    setsockopt(serverSocket, IPPROTO_TCP, TCP_NODELAY,&y,
>>>> sizeof(int));
>>>>
>>>>       address.sin_family=AF_INET;
>>>>       address.sin_addr.s_addr=INADDR_ANY;
>>
>> I don't think that that can be helpful. This part of code is only for
>> reverse tunnel which is used for FS forwarding and Pulse Audio.
>>
> 
> I took another close look at the code of sshProcess.cpp. The patch is
> applied to the method sshProcess::tunnelLoop. This method only gets
> execute in sshProcess::startTunnel.
> 
> The call is:
> 
> <quote>
> if (!reverse)
>   tunnelLoop();
> else
> {
>     <blablabla>
> }
> </quote>
> 
> So this makes me think that tunnelLoop() is not for reverse tunneling
> but for the graphics tunnel.
> 
> Could you take another look please?
> 
> Thanks,
> Mike

hmmm, ok, seems you are right :) Can you apply this patch to source tree
and I'll try to build a windows binary tomorrow.

regards,
Alex
-- 
Oleksandr Shneyder
Dipl. Informatik
X2go Core Developer Team

email:  oleksandr.shneyder at obviously-nice.de
web: www.obviously-nice.de

--> X2go - everywhere at home

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://lists.x2go.org/pipermail/x2go-dev/attachments/20110919/c5937e37/attachment.pgp>


More information about the x2go-dev mailing list