Search code examples
mysqlperformancearchitecturepersistenceuptime

A backup persistence store. What are my options?


I have a service that accepts callbacks from a provider. Motivation: I do not want to EVER lose any callbacks (unless of course my network becomes unreachable).

Let's suppose the impossible happens and my mysql server becomes unreachable for some time, I want to fallback to a secondary persistence store once I've retried several times and fail.

What are my options? Queues, in-memory cache ?


Solution

  • You say you're receiving "Callbacks" - you've not made clear what they are. What is the protocol? Is it over a network.

    If it were HTTP, then I would say the best way is that if your application is unable to write the data into permanent storage, it should return an error ("Try again later" if that exists in the protocol) to the caller, who should try again later.

    An asynchronous process like a callback should always be able to cope with failures downstream and queue its requests.

    I've worked with a payment provider where this has been the case (Paypal). If you're unable to completely process the request, just send an error back to the caller.