Best Practices for Async data persistence

Let's say you have a set of app servers and a distributed cache/cache cluster. Now your app servers have an endpoint that accepts some data which can be committed to the db with some delay.

One way I could think of doing this is by using a queue. So when the call is made to your app server, simultaneously update the new data in the cache and push to a queue, which will be processed async by worker threads and that message from the queue will be used to persist in the db.

What if the queue and cache go down? Then the data would never be persisted to the db. what other ways can we handle this scenario?

Comments (1)