Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[HOWTO] transparent lbxproxy X compression through ssh
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
ecatmur
Advocate
Advocate


Joined: 20 Oct 2003
Posts: 3595
Location: Edinburgh

PostPosted: Tue Jan 06, 2004 1:43 am    Post subject: [HOWTO] transparent lbxproxy X compression through ssh Reply with quote

lbxproxy can significantly increase the startup time of remote X applications (in my experience, by up to 50% on a 25ms latency connection). It runs on the client end and filters X traffic to the server - most X servers can decompress lbxproxy traffic.

The procedure to use lbxproxy via ssh is:
Code:
ssh me@client
DISPLAY=localhost:10.0 lbxproxy :63
export DISPLAY=:63


Obviously this gets a bit clumsy if you have to do this each time, so I have developed a way to automate it. On the remote client (the machine you ssh into) install lbxproxy and append to .ssh/rc:
Code:
#!/bin/bash
 
if read proto cookie && [ -n "$DISPLAY" ]; then
        if [ `echo $DISPLAY | cut -c1-10` = 'localhost:' ]; then
                # X11UseLocalhost=yes
                echo add unix:`echo $DISPLAY |
                    cut -c11-` $proto $cookie
        else
                # X11UseLocalhost=no
                echo add $DISPLAY $proto $cookie
        fi | /usr/X11R6/bin/xauth -q -
        # Find a port to run lbxproxy on
        for (( lbx_port=63; lbx_port < 1000; ++lbx_port )); do
                /bin/fuser $((6000 + lbx_port))/tcp >/dev/null && continue
                /usr/X11R6/bin/lbxproxy :$lbx_port -display $DISPLAY \
                        2>/dev/null &
                break
        done
        unset lbx_port
fi

Also append to .bashrc or whatever you use:
Code:
# lbxproxy magic - need command in ~/.ssh/rc or /etc/ssh/sshrc
if [ "$DISPLAY" ]; then
        lbx_display=$(expr match \
                "$(pgrep -l -U $UID -f "lbxproxy\>.* -display $DISPLAY\>")" \
                '.* \(:[[:digit:]]\+\)\($\| \)')
        if [ "$lbx_display" ]; then
                export DISPLAY=$lbx_display
        fi
        unset lbx_display
fi

The code in .ssh/rc is based on that in the sshd manpage.
You may need to correct paths if the remote machine is not a Gentoo box.

Hopefully you should see a speedup in remote X applications, for no incremental effort.
Back to top
View user's profile Send private message
puddpunk
l33t
l33t


Joined: 20 Jul 2002
Posts: 681
Location: New Zealand

PostPosted: Tue Jan 06, 2004 2:25 am    Post subject: Reply with quote

Thanks! Great tip, I'm making a note of this one as when I go back to work this is going to help a WHOLE lot.

Thanks Again,
Chris.
Back to top
View user's profile Send private message
MasonMouse
Tux's lil' helper
Tux's lil' helper


Joined: 26 Nov 2002
Posts: 146
Location: Texas, USA

PostPosted: Thu Jan 08, 2004 9:01 pm    Post subject: Reply with quote

Just out of curiousity, how does this differ from or compare to using "ssh -XC" to forward and compress X connections?
Back to top
View user's profile Send private message
ecatmur
Advocate
Advocate


Joined: 20 Oct 2003
Posts: 3595
Location: Edinburgh

PostPosted: Fri Jan 09, 2004 9:28 pm    Post subject: Reply with quote

MasonMouse wrote:
Just out of curiousity, how does this differ from or compare to using "ssh -XC" to forward and compress X connections?
From the openssh (1) manpage:
-C Requests compression of all data (including stdin, stdout,
stderr, and data for forwarded X11 and TCP/IP connections). The
compression algorithm is the same used by gzip(1)

lbxproxy uses a compression algorithm specifically designed for X traffic, and also caches data to eliminate requests and mimimise round-trip traffic.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum