Author Topic: Touch Orbiter and Web Orbiter speed improvements  (Read 1195 times)

esev

  • Veteran
  • ***
  • Posts: 87
    • View Profile
    • Eric Severance
Touch Orbiter and Web Orbiter speed improvements
« on: October 20, 2010, 10:56:16 am »
The Touch Orbiters, including the Web Orbiter feel slightly less responsive than a normal DCE Orbiter.  This is because they are polling once per second to see if any updates have taken place.  If an Orbiter update takes place while they are not polling there is a delay before the updates are shown.

Currently, to poll for changes, a Touch Orbiter client issues a "ANYNEWS?" request to the Proxy Orbiter.  This is a short lived call which simply returns "yes" if changes have been made since the last poll, or "no" if there haven't been any changes.  If "no" is returned, the client typically waits a second, then makes another "ANYNEWS?" request.

A slight tweak to the ANYNEWS? request can be made in order both speed things up and to eliminate having to poll every second.  The tweak would make the request look like this: ANYNEWS? [<lastImageSent> <maxWaitMs>] (ex: ANYNEWS? 1 30000)  Where the two extra parameters are optional so as to not break existing clients.  The response could also be tweaked to return lastImageSent (which is just a one up counter that increments each time the Orbiter screen changes) instead of "yes" or "no".  This has the added advantage that the Proxy Orbiter never gets out of sync with the client and the client knows that the Proxy Orbiter supports the extra paramters.

When calling ANYNEWS with these extra parameters, the semantics of the call change. If there has been a change since the last poll, the call will return immediately.  If there haven't been any changes, the call will block until either an Orbiter update occurs or <maxWaitMs> milliseconds have expired.  If an Orbiter update occurs while the request is blocked, the request will immediately unblock and reply with the new lastImageSent number.  This cuts down on the number of ANYNEWS requests that need to be made and at the same time also allows the client to know immediately when an Orbiter change occurs.

If you'd like to experiment with these changes, please see the attached patch file.  I'm not sure all the bugs are worked out yet, but the Web Orbiter is a lot more responsive with these changes.

Edit: Deleting the patch file. Use the patches in the message below
« Last Edit: October 20, 2010, 05:47:09 pm by esev »
Eric Severance
My setup

esev

  • Veteran
  • ***
  • Posts: 87
    • View Profile
    • Eric Severance
Re: Touch Orbiter and Web Orbiter speed improvements
« Reply #1 on: October 20, 2010, 04:26:54 pm »
Sorry, just realized that patch won't work for anyone who is running the latest version of the Web Orbiter code from Subversion.  If you are running the latest, the attached WebOrbiter patch will work for you.

One change I made to the web orbiter is that clicking on the Orbiter screen doesn't cause the UI image to reload. The two events, clicking and reloading, are independent of one another.  This is done because the RefreshImage ajax query will block till the Proxy_Orbiter actually generates the new screen.  At that point the UI image will be refreshed.

Eric
Eric Severance
My setup

totallymaxed

  • LinuxMCE God
  • ****
  • Posts: 4463
  • Smart Home Consulting
    • View Profile
    • Dianemo - at home with technology
Re: Touch Orbiter and Web Orbiter speed improvements
« Reply #2 on: October 20, 2010, 04:37:54 pm »
The Touch Orbiters, including the Web Orbiter feel slightly less responsive than a normal DCE Orbiter.  This is because they are polling once per second to see if any updates have taken place.  If an Orbiter update takes place while they are not polling there is a delay before the updates are shown.

Currently, to poll for changes, a Touch Orbiter client issues a "ANYNEWS?" request to the Proxy Orbiter.  This is a short lived call which simply returns "yes" if changes have been made since the last poll, or "no" if there haven't been any changes.  If "no" is returned, the client typically waits a second, then makes another "ANYNEWS?" request.

A slight tweak to the ANYNEWS? request can be made in order both speed things up and to eliminate having to poll every second.  The tweak would make the request look like this: ANYNEWS? [<lastImageSent> <maxWaitMs>] (ex: ANYNEWS? 1 30000)  Where the two extra parameters are optional so as to not break existing clients.  The response could also be tweaked to return lastImageSent (which is just a one up counter that increments each time the Orbiter screen changes) instead of "yes" or "no".  This has the added advantage that the Proxy Orbiter never gets out of sync with the client and the client knows that the Proxy Orbiter supports the extra paramters.

When calling ANYNEWS with these extra parameters, the semantics of the call change. If there has been a change since the last poll, the call will return immediately.  If there haven't been any changes, the call will block until either an Orbiter update occurs or <maxWaitMs> milliseconds have expired.  If an Orbiter update occurs while the request is blocked, the request will immediately unblock and reply with the new lastImageSent number.  This cuts down on the number of ANYNEWS requests that need to be made and at the same time also allows the client to know immediately when an Orbiter change occurs.

If you'd like to experiment with these changes, please see the attached patch file.  I'm not sure all the bugs are worked out yet, but the Web Orbiter is a lot more responsive with these changes.

Hi esev,

This looks like a very nice idea. We will look at testing it in the iOS Orbiter asap. Foxi352, Uplink or I will post something here when we have something tested.

All the best


Andrew
Andy Herron,
Convergent Home Technologies Ltd

My Blog; http://ellipticalcurve.com

Get RaspSqueeze-CEC Wifi enabled for Dianemo/LinuxMCE: http://wp.me/P4KgIc-7C

Contact me for Smart Home consulting advice here;
@herron on Twitter, inquiries@ellipticalcurve.com via email or PM me here.

Get a Dianemo License: http://forum.linuxmce.org/index.php?topic=8880.msg100221#msg100221
Follow us on Facebook: https://www.facebook.com/pages/Dianemo-Home-Automation/226019387454465

Sales & Info:
http://www.dianemo.co.uk

esev

  • Veteran
  • ***
  • Posts: 87
    • View Profile
    • Eric Severance
Re: Touch Orbiter and Web Orbiter speed improvements
« Reply #3 on: October 20, 2010, 04:46:54 pm »
This looks like a very nice idea. We will look at testing it in the iOS Orbiter asap.

Glad you can make use of it!  I figured it might help conserve battery life with the iPhone and Android clients.
Eric Severance
My setup

phenigma

  • NEEDS to work for LinuxMCE
  • ***
  • Posts: 1006
    • View Profile
Re: Touch Orbiter and Web Orbiter speed improvements
« Reply #4 on: October 23, 2010, 06:38:40 am »
Excellent idea!  I'll try to test this against the linux based touch orbiter(s) as well.  The n800/810/900 could probably benefit from this.

J.