Friday, May 14, 2010

Client Based RDP & GNOME Icon Launching

RDP Architecture Change

For many years we have integrated MS Windows applications into our GNOME desktop and delivered them to our thin clients. Various techniques have been used to do so, at first we used UIS (Unix Integration Services) which was wonderful but is no longer available. We used Citrix to deliver applications as well. Because the RDP protocol added high color support a few years ago, this now is becoming our primary delivery technique. It's always been our goal to run as little as possible on physical thin client hardware and keep as much on the server as possible. The more that you run at desktops, the greater the chance that you will have to touch them with updates. It also is harder to troubleshoot and resolve problems when it's offloaded from a server. So what we have done is run rdesktop on the server and this has worked great. Rdesktop talks with Windows and then the presentation is delivered to the thin clients with X. For most applications to date performance has been appropriate. But there are some things that are now making this design not work as well as we would like:
  • More and more users are getting dual and triple screens to do wide screen work with lots of real estate. This is a lot of data to push over X.
  • Certain CAD applications are becoming more sophisticated and are doing lots of movements and zoom that should deliver reasonable response times.
  • More applications are starting to deliver sound and video from Windows.
  • Products such as Aqua Connect allow you to deliver Mac OS X applications from servers which also require faster response times.
As seen in the diagram below, our current design kind of created a double hop. RDP screens and sound went to the server and then went to the thin client with X and pulse.

Rdesktop runs on the HP Thin clients fine, but obviously when you do so that then creates a more client/server environment and condition where if you want to make a change to that software package you are going to have to touch desktops. While rdesktop isn't changing heavily, an example of what might happen is the users finding a keysym problem after deployment that requires a change to the configuration files. When rdesktop is on the server, such a change takes 2 minutes.

The other problem is how to make an icon launched from the GNOME server initiate rdesktop running locally on the thin clients. The user account doesn't exist on the thin client and is simply running an X server and then using XDMCP to connect to the server.

What has been devised is a technique that seems like it will work well. The thin clients basically have 2 user accounts, 'root' and an account of 'user' with an ID of 1000. I set up an account called 'user' with ID of 1000 on both of the GNOME desktops and then have granted sudo permissions for all other users to have access to the rsh command as 'user'. When they click on the icon, it will sudo the rsh command and pass to the thin client instructions on all of the command line arguments to run and then initiate a local copy of rdesktop to display :0.

Performance is much faster running in this manner; X and PULSE are completely removed from the loop and the Windows servers now have a straight RDP hop right to the thin client as seen in the diagram below:


Full screen video works well with this design,sound is much less prone to breakups and applications are much faster. We continue to test this design, but it's showing promise.

GNOME Icon Launching

During the debugging stage of Evolution I have noticed certain user techniques which have been unknown to me and I have taken steps to improve the user experience. When a user clicks on an Evolution icon our launch script automatically kills any running sessions of that software and starts a new one. The reason it's designed this way is:
  • Regular users cannot be expected to understand how to kill applications with a GUI or to look at process lists. People have no idea what this means or how to do it.
  • Users understand reboots, and if they had a local computer would just reboot it. Obviously, they can't reboot the servers. Hundreds of other people would not be pleased. :)
  • There are 15 hours of the day and weekends when someone from IT is not here to kill processes that are stuck or not responding.
  • The regular GNOME dialog that comes up when an application is not responding very often does not halt all related processes. Yeah it might get evolution.bin, but it very likely will leave the data-server and alarm processes happy churning away.
  • Very often users log off without closing Evolution correctly and sometimes just turn off their thin clients. This leaves processes behind on the server.
So halting all prior instances is desirable. They click on the icon, it cleans up the process list and deletes any temp files that might be hanging around and ensures 100% that they will get a running instance. Sounds great, right? Apparently not. Certain techniques that I saw when I was scoping the server were revealed.

Users Click On Icons Multiple Times To "Speed It Up".

I guess the theory is that an icon is like a water pump. The harder you pump, the faster and more likely you are to get water? Users have been double and triple clicking on the icon. Each click was then halting and restarting Evolution. Nice. So what they see is Evolution blinking multiple times until they stop clicking and then finally it opens.

I installed a small script that I called 'gun slinger' that counts the number of seconds since the last click of certain icons and ignores repeated and quick clicking. Here is the popup they see :)




Users Use The Shortcut Icon To Replace The Window List GUI

Instead of finding an already running process in their window list, they just click on the shortcut icon again. If they have something maximized over the top of Evolution, they have no idea how to bring it to the front and have just been clicking on the shortcut again.

I installed a bit of code in the launch script for Evolution that if it detects an already running session, it uses wmctrl to give it a window manager hint. It comes to the front, un-minimizes and flips the cube to the right side to try and get them to run the already running session. They then get this dialog:




All of these techniques are being logged to a file and I'm seeing how many people have been doing this all along. I'm hoping these two steps will eliminate abnormally shutting down Evolution and also reduce the likelyhood of damaged files and perception of instability.

5 comments:

Richard said...

I think the correct solution is for Evolution to be more robust against hangs and be more memory efficient, so that it wouldn't need to be terminated. Given that it's Evolution, though, I think this solution is much more practical :D

Goran Rakić said...

Dave, thank you for great posts.

Unknown said...

This multiple click issue is fairly common, especially as people are confused by the fact thta :
- most icons are double-clicked except when on the panel
- they don't have fast feeback about the fact the application is running or have start.

By the way, I do think that evolution should be fixed to no let running processs and thus even if someone kill evolution with the close button.

Dave Richards said...

richard: In this case I wasn't picking on Evolution. I'm going to deploy this same code with other applications now too.

goran: Thanks, I always hope it gives people ideas.

fabrice: I knew the multiple clicks were happening but just never knew how much. The fact that people are using icons instead of their task list was not expected. Hopefully these changes will make things work better. Some users have massive calendars and they have been re-downloading them each time they clicked on the icon. :|

Wouter said...

On my system (pristine Debian) clicking an Evolution starter on my panel multiple times will just raise the existing window... i.e. Evolution already does exactly what your custom scripts seem to do, at least on my system.