Faster Remote Gemstone
By Ramon Leon - 23 October 2010 under Databases, Linux, Performance, Smalltalk, Gemstone
Just a quick post to document some knowledge for myself and for anyone using Gemstone on a remote server like SliceHost or my preference Linode and trying to run GemTools locally through a ssh tunnel. It's slow, very slow, several seconds per mouse click. OmniBrowser is just to chatty. Fortunately Linux has a better way to do it: X11Forwarding. Run the GemTools client on the remote server and forward the UI for just that app to your workstation.
Now, if you have a mostly Windows background like I do, this might be something new to you, it certainly was to me. I'd kind of heard of it, but didn't realize what it was until today after I got it working. Just one more frakking cool thing Linux can do, much nicer than VNC/Remote Desktop because it means you don't have to install any window manager and the other hundred dependencies that go with it on the server. Every piece of software installed on a remote server is a piece of software that needs updated and/or could be hacked or make the next upgrade not go smoothly, so the less stuff installed on a server the better as far as I'm concerned.
I happen to be running the latest 64bit Ubuntu 10.4 LTS on a Linode server, so if you're running something else the steps might be slightly different. To prep the server, which I'm assuming is a headless server managed via ssh, you'll only need to install two packages. One to enable the X11 forwarding and one to install a library that the Squeak VM needs for its UI that's not installed by default on a headless server.
sudo aptitude install xauth libgl1-mesa-dev ia32-libs
You'll also need to enable X11Forwarding in /etc/ssh/sshd_config by ensuring this line exists.
X11Forwarding yes
Restart sshd if you had to change this because it wasn't enabled.
sudo /etc/init.d/ssh restart
Now just upload the GemTools one click image and unzip it.
scp GemTools-1.0-beta.8-244x.app.zip glass@serverName: ssh glass@serverName unzip GemTools-1.0-beta.8-244x.app.zip
And everything is ready to go. Now ssh in again but this time with forwarding and compression enabled.
ssh -X -C glass@serverName
Now any graphical program started on the server from this session, will run on the server, but its UI will display as a window on the client as if it were running directly on the client. Now fire up GemTools on the server...
cd GemTools-1.0-beta.8-244x.app ./GemTools.sh
And GemTools will start up and it'll appear to run locally, but it's actually running remotely which means OmniBrowser can be as chatty as it likes, it's all runnning from localhost from its point of view. The X display, which is built to do this much better, is running on your machine. Now GemTools will run fast enough that you could actually develop directly in Gemstone if you like. Not that I actually would, Pharo has much better tool support.
I think this will be the first of a run of posts about Gemstone, there's a lot to learn when switching dialects. I can tell you this, well tested code ports easier, so apparently I've got a lot of tests to write that I probably should have written from the start. Oh well, live and learn.
Comments (automatically disabled after 1 year)
Hi Ramon,
A follow-up to my previous post in that now I'm using X11 forwarding from a remote Centos installation to my local Mac I've some keyboard mapping issues. I'm finding that X11/Unix squeak maps ctrl, rather than the Mac cmd key for the Squeak/Pharo modifier key ie ctrl-b rather than cmd-b to browse. Have you had to remap keys and if so where to focus - GemTools, X11 preferences or ~/.Xmodmap?
I've also noticed that when I start a blocking web server from within GemTool I can't kill it via ctrl-. or cmd-. or for that matter interrupt any foreground process with ctrl-. Have you noticed anything similar?
Nick
You lost me at Mac. I develop in Linux, I've not ever had to remap my keys. However, if you check System>Settings in Pharo and search for swap, you'll find a swap control and alt keys option that may be what you're looking for.
As for killing a process, I can't tell if you're talking about on the Gemstone server or in the Pharo client. I think those commands only work in the client.
For future reference, the Mac <=> X11 key mapping solution I've found to create an ~/.Xmodmap file with the contents:
remove Mod2 = Meta_L Meta_R
keysym Meta_L = Control_L
keysym Control_L = Meta_L
keysym Meta_R = Control_R
keysym Control_R = Meta_R
add Mod2 = Meta_L Meta_R
add Control = Control_L Control_R
Also in the Mac X11 application preferences disable:
- Follow system keyboard layout
- Enable key equivalents under X11
Now restart X11 and Ctrl key is mapped to the Cmd key.
Hi Ramon,
Really helpful post - prior to your post I assumed I'd need a headful Linux installation for X11 forwarding.
I discovered that on a VMWare minimal installation of Ubuntu 10.04 64bit server, in-addition to the libraries you mention, I needed to install the 32bit compatibility libraries in order to run GemTools (or any other squeak based distribution):
without the compatibility libraries I got the less than helpful message:
".../squeak No such file or directory"
I've also experimented with the Amazon supported Linux EC2 image, which is (currently) based on a modified Centos 5.x distribution. With some experimentation using strace to work out which libraries were missing I managed to get X11 forwarding working by installing the following:
Ah, the ia32-libs, I needed those too, just forgot to put that step in the post; fixed.