| Linode Forum https://forum.linode.com/ |
|
| SSH X11 forwarding has delay https://forum.linode.com/viewtopic.php?f=19&t=4807 |
Page 1 of 2 |
| Author: | AtomicDog [ Sat Nov 07, 2009 8:35 pm ] |
| Post subject: | SSH X11 forwarding has delay |
I have enabled X11 forwarding in my SSHD config and am tunneling my connection using PuTTY along with Xming to display. When I run xv <test.jpg> there is a huge initial delay. I don't think it is just the regular "encrypted tunneled connections are slow" thing because what happens is that there is a > 1 minute delay before the window appears. Once the window is open, I see the image get painted slowly (around 8 sec) but that is "believably slow" as opposed to this huge delay before the window even appears. The JPG file is only ~50k. Approximately the same behavior occurs with the display command from ImageMagick too. (Although it doesn't paint incrementally) If I run xclock, it takes about 1 second for the window to appear. Any ideas? |
|
| Author: | trader2828 [ Sat Nov 07, 2009 11:57 pm ] |
| Post subject: | |
Atomicdog, Have a look at my post and tell me if you think they are a little similar? My problem is that SSH terminal basically freezes up when browser data is forwarded through it. If I wait long enough and don't use the browser (socks mode), then the SSH term goes back to normal and accepts input again. http://www.linode.com/forums/viewtopic.php?t=4806 |
|
| Author: | trader2828 [ Sun Nov 08, 2009 1:38 am ] |
| Post subject: | |
Is your SSHD port set to one above 1024? Try one below if so... see if it makes a difference. |
|
| Author: | AtomicDog [ Sun Nov 08, 2009 1:49 am ] |
| Post subject: | |
Yeah, I saw your post out there, but I don't think it's the same because yours always works fine at first and mine always has a delay initially. Yours seems more intermittent. SSHD is running on the standard port. Unfortunately, I can't even narrow this down as to whether it is something that needs to be changed on the SSHD side or the XMing side yet... |
|
| Author: | AtomicDog [ Sun Nov 08, 2009 4:44 am ] |
| Post subject: | |
Here is some useful information from an ltrace of xv: Code: % time seconds usecs/call calls function Investigating why this is so slow... |
|
| Author: | AtomicDog [ Sun Nov 08, 2009 5:47 am ] |
| Post subject: | |
Tried removing xcb, per https://bugs.launchpad.net/ubuntu/+bug/241063 Code: $ ldd `which xv` This did not fix the issue. |
|
| Author: | AtomicDog [ Sun Nov 08, 2009 6:00 am ] |
| Post subject: | |
Sniffing the network shows that during the long delay period, I am getting lots of very small packets sent back and forth across the tunnel. The following is an example of log messages that occur for the majority of the wait time. Code: <Linode> --> <Client> SSH Encrypted response packet len=68 |
|
| Author: | sweh [ Sun Nov 08, 2009 12:22 pm ] |
| Post subject: | Re: SSH X11 forwarding has delay |
AtomicDog wrote: I have enabled X11 forwarding in my SSHD config and am tunneling my connection using PuTTY along with Xming to display. When I run xv <test.jpg> there is a huge initial delay.
... If I run xclock, it takes about 1 second for the window to appear. Any ideas? The X protocol has been described as the worst remote display solution, except for every other one. It's not so much that it works badly, but everything else works worse. If you're X tunnelling then your remote X application is talking to your local X server (your desktop). Starting up an application can involve a _lot_ of small requests from the application to the server (your desktop), and a lot of communication back from the server to the application. If your home upload speed is slow or saturated then this can cause massively long application startup delays, depending on the number of widgets in the application, and so on. In 1995 I attempted to run Netscape - I forget which ancient version - remotely; my local machine was a Sparc IPC and the machine running netscape was a Sparc 4. The connection... a 28.8K PPP modem dialup. It took over 10 minutes for the application to start (a lot of resources got thrown over the modem link; it was 100% busy), but once it had started then it was actually quite usable. I think you may be seeing similar. X is a great protocol in that remote programs are considered equivalent in terms of desktop access; whether a program runs on your local machine, a LAN away, a WAN away, over the internet... they all interact similarly to the X server and are equal. This si why all other remote desktop solutions are worse. Unfortunately the result can be painfully slow startup times and network intensive communication; this is why X is the worst. (Ok, that hasn't helped you....) You might want to look into an X protocol analyser (google for one); this can tell you what X calls the application is making and might give you an idea of the problem. You might also want to consider a different remote display technology where a remote desktop is displayed as blocks (eg VNC). It's not as well integrated into your desktop, but may be faster. |
|
| Author: | Vance [ Sun Nov 08, 2009 12:49 pm ] |
| Post subject: | |
NX may also be an option. I haven't used it other than to play around with connecting to NoMachine's demo server, but it was actually usable over a dialup link. Some more reading: http://tuxarena.blogspot.com/2009/04/co ... chine.html http://www.linuxplanet.com/linuxplanet/ ... ls/6567/1/ http://www.ubuntugeek.com/how-to-setup- ... repid.html http://www.linux.com/archive/feature/116354 |
|
| Author: | btmorex [ Sun Nov 08, 2009 6:26 pm ] |
| Post subject: | |
NX works significantly better than standard X forwarding over WANs. |
|
| Author: | AtomicDog [ Sun Nov 08, 2009 8:48 pm ] |
| Post subject: | |
I realize that X forwarding may not be the best solution for remote control of a desktop. The reason I want to use X forwarding, though, is to view image attachments easily. I could set up xv in my mailcap, and then it would display the images locally on my PC as long as I have PuTTY with X11 Forwarding configured correctly. This would be better for me than trying to use a VNC client just to check my e-mail. I am not even running an X desktop. I am using a cable modem, not a dialup connection, and I would think the bandwidth would be more than sufficient. I just ran another ltrace on a 1 pixel jpeg (631 bytes): Code: % time seconds usecs/call calls function I think the issue is that it is making a crazy amount of roundtrips on startup, so the latency is adding up. I am not sure if I can somehow adjust this with a buffer setting or if this is just the way the X protocol is designed. I looked into an X protocol analyzer but I didn't see one available for Windows... |
|
| Author: | AtomicDog [ Sun Nov 08, 2009 8:53 pm ] |
| Post subject: | |
Maybe I just need to switch to a different program... This URL had some relevant discussion. http://fixunix.com/xwindows/358974-xquerycolor.html |
|
| Author: | Vance [ Mon Nov 09, 2009 1:51 pm ] |
| Post subject: | |
I'm not too familiar with netcat, but perhaps something like this might serve your needs rather than using X? Code: desktop$ while true ; do nc -l 12345 | display - ; done & Then you could have your mail reader run this instead of xv: Code: linode$ nc 12345 < image.jpg Not sure exactly if the way display handles standard input would allow this, but may be worth trying. Failing that, it seems like there must be some image viewer out there that will accept images being pushed to it over a network port. |
|
| Author: | Guspaz [ Mon Nov 09, 2009 1:53 pm ] |
| Post subject: | |
nx still forwards NX, but it does compression and caching to eliminate most of the X round-trips: http://en.wikipedia.org/wiki/NX_technology It's generally a lot faster than VNC while providing similar functionality to X. You can forward just a single app (or all apps). For example, when my friend comes over to my house to do some coding, he fires up NX and connects to his box back home. Up on his Windows desktop pops up KDevelop, kate, konsole, etc. They each show up as separate windows, as if they were local apps. |
|
| Author: | AtomicDog [ Mon Nov 09, 2009 3:03 pm ] |
| Post subject: | |
Yeah, I could use something like netcat to shove the data back and forth over the connection, but it's a little kludgy. Honestly, after more investigation it seems like those programs are just using a poor implementation for running via remote X. (If you are using a TrueColor display, for example, I don't think that there is a need to make all those round trips for XAllocColor.) Code: ltrace -c xv -vis TrueColor test.JPG I just installed gpicview and it opens the 50k JPG file in around 4 seconds. I guess that would be my recommendation for anyone else wanting this functionality. |
|
| Page 1 of 2 | All times are UTC-04:00 |
| Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |
|