I have a Java based web app hosted on AWS. It is read-mostly so it makes a lot of sense to cache objects retrieved from the database for performance.
When I do update an object, I would like to be able to broadcast to all the servers that the object was saved and it should be invalidated from all local caches.
The does not need to be real time. Stale objects are annoying and need to be flushed within about 20 seconds. Users notice if they stick around for minutes. Cache invalidation does not have to happen the millisecond that objects get saved.
What I've thought about
- I've looked into broadcast technologies just as jGroups, but jGroups isn't supported on AWS.
- I don't think that Amazon's SQS messaging service can be made into a broadcast service.
- I'm considering using the database for this purpose: I'd write events to a database table and have each server poll this table every few seconds to get a new list items.