mysql – A backup persistence store. What are my options? – Education Career Blog

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 ?


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.


I recommend some sort of job queue server. I personally use Starling and have had great results with it. It speaks the memcache protocol so it is easy to use as a persistent queue.
Starling on Github


I’ve put a queue in SQLite for this before. Though, in my case, it was to protect against loss of the network link to the MySQL server — the data was locally-generated.


You can have a backup MySQL server, and switch your connection to that one in case primary one breaks down. If it’s going to be only fail-over store you could probably run it locally on the application server.

Leave a Comment