Is there a way to set a timeout on calls like zk.get_children so that if the server is overloaded, the client application can proactively backoff? Backing off when connection is lost is also useful, but waiting for the connection to drop is sometimes too late.
For example, if there are many clients and only a small amount of data available in zk for them to operate on, then the clients need a way of backing off.
Let me provide more context:
So, I see two solutions:
Any other ideas?
Forgive me if I'm wrong, I only started using Kazoo recently, but doesn't kazoo.retry.RetrySleeper do exactly what you want? Also, note that you can create a custom KazooRetry that automatically retries with a backoff as per the RetrySleeper.
- Issue #62, #92, #89, #101, #102: Allow KazooRetry to have a
max deadline, transition properly when connection fails to LOST, and
setup separate connection retry behavior from client command retry
behavior. Patches by Mike Lundy.
KazooRetry now supports time deadlines, so after backoff if it takes too long, thats now handled. This should address this situation.