php - Multiple Ajax request and it's downside -


i building mobile application (phone, jquery mobile) android.

it requires user sending message server side script using ajax request. implemented system such messages sent not sent immediately, instead stored in sqlite database (this because, want user think message sent if network bad) , iteration runs every 15 seconds in background picks , send it. therefore, if 5 messages in sqlite database, sent every 15 seconds apart.

the above system works fine when tested android phone connected wamp via wi-fi.

the problem foresee when deploy on production server, ajax response server won't fast.

is there way avoid potential problem?

note: response server via json , essential because used delete message phone sqlite database.

here how read question:

  1. a user interacts app , generates actions need updated on backend. (for example, "like post", "upvote coment" etc.)

  2. you have decided action not need complete synchronously , user not need wait around action completed/acknowledged; user can continue on new actions. @ point, user see actions have been processed immediate updates aren't important.

  3. your polling loop in app responsible sending actions backend completed. backend acknowledges action has been completed sending response app delete pending action.

my answer based on above:

  1. since app waiting on custom protocol complete , not user waiting on synchronous action complete, have lot of flexibility in server's response times.

  2. more important little protocol makes sure process action on backend , notify client app. dealing concept of things becoming "eventually consistent" , need design little protocol around that:

    http://en.wikipedia.org/wiki/eventual_consistency


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -