tags:

views:

21

answers:

1

Hi

In my ap we serilaize the data locally for offline use. To ensure the app is always up to date I fire off an update on launch.

To do this I have a set of WCF services that will get a delta for the requested data. Rather than complicate things I have a service to update events, a service to update stages, a service to update acts etc. Which means i have to daisy chain these calls in the callbacks so they run one after the other.

The problem with this is that they can take a short while to update and it seems a bit clunky chaining them like this.

What is the prefered/advised way of updating from multiple services to achieve what i need to here?

Cheers

w://

A: 

For Cracklytics (http://cracklytics.com) as well as a few other enterprise apps I've worked on, I run two service calls in parallel at the same time, instead of doing one after the other.

I spent quite a lot of time testing the performance of making calls one-at-a-time vs two-at-a-time vs three-at-a-time, etc, and I got the best results under 2G and 3G by running 2 threads at once. On wireless, I could start up like 8-10 threads together and they would run really fast.

Besides those two calls, Cracklytics also downloads a few charts from Google at the same time as those 2 calls, but I didn't notice any performance impact from that.

For the implementation, I have one main class that keeps track of all the webservices class and controls when they should be started and finished.

Just as important though is to figure out when web services calls should be canceled, though; for example, if you're downloading data for a table, but the user moves to another screen, you should cancel the call right away, so it doesn't impact the downloading of data for the next screen.

Hope this helps.

Eduardo Scoz
hey - thanks - thats a brilliant answer. I show a loading wait screen during the service calls so there is no way a user can be sent anywhere during the calls. I've also added an AutoUpdate config in the prefs so they can turn it off if it starts to annoy them.
cvista
Thanks, glad I could help.
Eduardo Scoz
one last question on this - to run them in parallell - do you just fore 2 off together and chain them from there or do you use threads to start them off?
cvista
Yeah. I'm using WCF, so it includes methods to start calls Async. I just run two of them right away, and wait for the responses. As I get the callbacks, I start off new threads.
Eduardo Scoz