views:

49

answers:

2

Hello ! Every one.

I have some query. First of all let's have an iPhone application flow which a normal application has. ( Content based application )

  • Application launches & checks for the network availability
  • If network is available - iPhone downloads the data using web services or APIs
  • We can store these response ( web service response / api response ) into a *.plist file.
  • When we need to update the data, again web service is called & again entire data is stored *.plist file.

  • Now, assume that - I have a table 'eBooks' on Server & It has more than 500 entries.

  • Calling a API/web service will give response of 500 records.
  • OK - first time it is ok to wait for all response ( we might use LIBXML2 for chunks )
  • But what if when we frequently download this using web service.

Here there are two disadvantages

  • Wifi unnecessary usage
  • iPhone CPU overhead
  • Server CPU overhead.

Are you getting me ?

Assume that there is no change on server why iPhone need to call API again. Means there are no change in entries & entries are 500 as it is then why to download it again ?

Let me clarify again - the problem.

Assume that

  • an application has a Server + database = Customers ( 500 records currently )
  • there are 5 iPhone which retrieves this data
  • all iPhones have downloaded 500 records offline
  • Now, server has added a new record 501
  • iPhone must download only 1 record not 501 at all.

How is that possible ?

Thanks in advance for sharing your knowledge. Please add comments for any queries.

Sagar.

A: 

You can very easily implement paging on your server app to let your clients limit the number of entries retrieved. You can also implement some kind of unique identifier that you can cache on the iPhone client and then when you request an update you send the unique identifier of the last item you have cached. When your server sends the response, it should only serve items newer than the last item you have cached.

nduplessis
Why is wifi required for paging?
nduplessis
A: 

You could add a timestamp to each of the entries. This timestamp is updated every time a change, addition or deletion is made on the server side.

When doing a query, you supply a field indicating the latest timestamp known to the client. For the first query, this would be something like Epoch. For subsequent queries it would be the last known update.

The server would then have to filter the entries, so it only returns those entries that have changed since the provided timestamp.

Claus Broch
@Claus Broch - idea is great - would you please give some more brief ?
sugar
sugar
I presume you ave the data in some sort of database, so it would simply be a matter of constructing a SQL statement that does the filtering (e.g. something similar to "SELECT * from TABLE mydata WHERE timestamp >= querystamp") . Probably the server will be less loaded with filtering than it would by serving full content every time.This is however only a rough guestimate, you mileage may vary.
Claus Broch
sugar
For "deleted" records you actually don't delete them, but instead you mark them as deleted in the database. You will need to design your tables in the database, so this only takes up space for the fields used for change management. The actually data could then be located in different tables.
Claus Broch
Ok ! I got the answer - very great support like a sales team. Thank you very much. +1 +accepted.
sugar
Actually - I am getting message - "you last voted on this answer2 hours agoYour vote is now locked inunless this answer is edited". will u please edit your question, so that I can up vote you.
sugar