Monday, November 30, 2009

VNC vs X11 Forwarding

Image via Wikipedia
Did some research around and compiled following, they are pretty interesting:

  • VNC typically uses fewer round-trips than X, particularly as an application starts up. Your link is quite high bandwidth, but if the latency is high, you may find things appear more quickly if you use VNC than if you use X.
  • X, however, generally requires much less bandwidth once the application is up and running. This is because it makes more use of resources at the terminal (fonts, cursors, etc). With VNC these are all rendered at the server and copied over the network. So X will often be faster, but VNC works across more platforms and is less dependent on the facilities at the terminal.
  • X applications will die when the connection is broken, whereas a VNC viewer can disconnect and reconnect as many times as it likes and the applications keep running. This is particularly useful if you have long-running apps, or if you wish to connect from more than one place.
  • People seem to be forgetting one of the more important factors - normally when you run an X server (such as XWin32 for Windoze) the heavy memory usage is at the user's end. The applications you start on the server and that connect to your X server are relatively light-weight. With VNC you reverse that role again, not only will you most likely run your apps on your server, but also the X server itself will then be on that server. With a few users running (VNC) X servers memory usage could be significant.
  • Previously I used XWin32 at work, but everytime the machine (or just XWin32) crashed I would lose all my sessions. Also, XWin32 can be quite heavy for your PC - depends a bit on how much memory you have and all that. Nowadays (ever since I learned of VNC) I and several colleagues run VNC X servers on our admin server and connect there with the VNC clients. With SSH and port forwarding we're also able to pick up our sessions from home (mostly through dial-up ISDN, usable but not fast) as well.
  • I also use VNC at home to access the VNC server on my Linux box. Speed is good (would be better even with 100Mbit ethernet instead of 10Mbit) and again it doesn't matter whether my W98 box crashes, the server will stay up.
  • I've used VNC a long time ago too when I first tested it over a 2Mbit connection, and I recall that as very usable. X connections over that connection are slow anyway. :) Your mileage may vary - what window manager and the like you use matters a lot too. The simpler the graphics the less data, etc. It can't be put as simple as you think.

Updates: VNC is much much faster than X forwarding, as observed from the testing.