Terminal Services and Graphically Intensive Applications

Hello AskPerf, my name is Subheet Rastogi and I am a Technical Lead on the Performance team in Bangalore.  Today, we’re going to take a quick look at issues that typically arise when using graphic intensive applications or media streaming in a Remote Desktop Session.  Some common examples where you might encounter issues in an RDP session include Java applets embedded into web pages, Adobe Breeze, CAD-type programs and of course – playing games.  Why?  Because RDP was oroginally designed to flush the video frame buffer to the client about once every 100 milliseconds.  While this is fine for most Windows GDI applications, graphic intensive applications, 3D applications and applications requiring audio / video synchronization don’t fare so well.  With respect to streaming media in particular, RDP is only meant to cache the bitmap files (compressed) not the audio which is uncompressed over the wire.

When we generate a large amount of screen update information it requires a lot of CPU power and very efficient drawing routines.  At some point we will reach the limitation of the device and the drawing operations will back up in the queue.  Sometimes we have to reset our session to regain normal operation because we have so much data in the update queue that it will take some time for it to catch up.  Some research shows that most of the CPU time is being spent in drawing most of the time.

Regardless of whether or not you are using graphic intensive applications or streaming media across RDP, there are some things that you can do that may provide some performance benefits in your environment:

  • Display driver optimization – this is probably the most important component, particularly on the Windows CE platforms that tend to have a lot less CPU power than their desktop counterparts.  The display “device driver interface”, we provide in Windows CE uses only the basic graphics engine functions; where software acceleration is provided through emulation libraries, and hardware acceleration is limited to two-dimensional graphics operations.  If at all possible, hardware acceleration should be used.
  • Ensure that your video and network card drivers are up to date based on the manufacturer’s recommendations.
  • Enable bitmap caching on your RDP session.  This can result in some significant bandwidth saving, and can also improve the refresh speed.  However, this does not mean that graphic intensive applications will run at the same performance level as they would in a non-RDP session.
  • Understanding how font exchange works can also lead to some opportunities for performance improvements.  Font exchanges occur between the client and server to determine which common system fonts are installed.  The client notifies the Terminal server of all installed system fonts to enable faster text rendering during an RDP session.  When the Terminal Server knows what fonts the client has available, passing compressed fonts and Unicode character strings rather than larger bitmaps to the client can save network bandwidth
  • If network bandwidth is not as much of a concern, you can increase the frame rate on the client side via a registry modification.  However – please ensure that you test this change thoroughly before implementing it in a production environment.

    Windows Registry Editor Version 5.00
    [HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client]
    "Min Send Interval"=dword:00000001
    "Keep Alive Interval"=dword:00000001
    "Order Draw Threshold"=dword:00000001

That’s about it for this post – one final note though is that there are improvements on the horizon.  Check out this presentation from the 2008 Professional Developers Conference (PDC 2008) on Graphics Remoting (RDP) Today and Tomorrow.  Take care!

Additional Resources:

– Subheet Rastogi