Our front-end developers have requested that the RESTful Java web services to support delta queries. The use case for this is to handle periodic ajax refresh of the screen to bring in new data (deltas). I can see a few advantages of this:

Makes front-end logic simple (i.e. no complicated deduping logic)

Reduce network traffic (i.e. response size is smaller)

However, there are some concern as well:

supporting delta will require the service to be stateful, which
impact scalability

heavy use of caching (results cached per user per query, to determine
the delta)

heavy processing on the server

My questions are:

Are there additional advantages of the delta queries?

What's a good implementation to for delta queries that would
eliminate some of the disadvantages (you can assume we are welling
to drastically refactor our code)

1 Answer
1

supporting delta will require the service to be stateful, which impact scalability

Not necessarily. The front-end can provide state information back. After all, a list of results that's sent in pages is a kind of "delta" query. A request merely has to include a "maximum" key or timestamp. Something like ?max=last_seen_key. Everything after this is part of the delta refresh.

heavy use of caching (results cached per user per query, to determine the delta)

Not necessarily. See above. The client can send state information back to determine what was already seen.