views:

993

answers:

2

In our scenario, we have a wpf application that is used by users over remote desktop, and we found the user experience is very slow.

Any suggestions for improving the user experience in this scenario? One point might be to disable any animation/storyboards, and avoid using gradients in the UI. More thoughts are appreciated.

+3  A: 

For gradients it's not as much of an issue as multiple rendering layers, such as if you have a bunch of nested controls all partially opaque. Take a look through the WPF Performance Optimization guides available. There's a lot of information in there to digest, but with the tips on rendering in there and the performance tools you should definitely be able to make some improvements.

UPDATE:
Jamie Rodriguez will post some of the internal discussions on WPF at Microsoft. There was a new post today, that includes tips and discussions on performance when remoting.

All versions of WPF since WPF 3.5 SP1 have remoted (both with Remote Desktop and Terminal Server) using Bitmap Remoting.

Bitmap remoting works as follows:

  • The application is rendered on the server using WPF’s software rasterizer
  • As the application runs, the server keeps track of which regions of the application’s window are newly dirty and need to be updated
  • When a region needs to be updated, the server creates a compressed bitmap of just the dirty region and sends that to the client
  • Once the client has drawn that bitmap to the appropriate place on its own window, the client window is up-to-date

Given how this remoting mechanism works, performance can be maximized in several ways:

  • Dirty regions should be kept as small as possible so the least amount of data is sent over the wire
  • Ambient animations should be turned off
    • For instance, setting a window background to an animating gradient would cause the entire window to be invalidated / redrawn every frame
  • The system does not optimize away occluded parts of the application
    • For instance, an animation that is completely hidden behind some other opaque element will still cause dirty region invalidation / bitmap generation to occur. Remove these from your application.
  • Dirty regions should be created as infrequently as possible
    • Turn off as many animations as possible
    • For those animations that can’t be eliminated completely, lower the animation framerate using the DesiredFramerate property
  • Dirty Region Bitmaps should be as simple as possible to maximize their compression
    • Application running over TS should favor solid colors over gradients or other exotic fills (unnecessary images, etc), especially for application pieces that will be redrawn frequently
  • Avoid operations that are especially slow when rendered in software
    • BitmapEffects / Effects / ShaderEffects, especially blurs and drop shadows with large radii, are quite slow in software
    • 3D – the 3D software rasterizer is substantially slower than rendering in hardware
rmoore
We are talking performance over a remote desktop. When run from a direct desktop box, it's working well and good.
amazedsaint
Yes, but it all still depends on the rendering of the UI. Performance issues are just compounded. Re-loading large graphics and controls takes a heavy hit as well. Check here for some similar discussion. http://stackoverflow.com/questions/198030/are-there-problems-with-rendering-wpf-over-remote-desktop-under-windows-xp/198232
rmoore
A: 

You can query for the WPF performance tier (http://msdn.microsoft.com/en-us/library/ms742196.aspx) and ratchet down your animations / graphical trickery as appropriate, so that your app still looks great locally while runs fast over RDP.

Paul Betts