Circuit breaker with java sdk


#1

Is there some sort of circuit-breaker functionality available with the java sdk for couchbase. Basically, if we are firing queries at our couchbase cluster and there are some issues with the cluster and queries start to fail, can we open the circuit and not send any queries for a while , then check if the issue with couchbase is fixed and if its fixed only then let the queries flow to it at full capacity.


#2

Not directly at the moment @silver.soul. This is challenging, as Couchbase isn’t just atomically available or unavailable. There are various failure modes that make functionality partially unavailable (until failover!) in most apps.

That said, this is something that can be done though at the app layer through the NodeLocatorHelper. What this does is allows you to determine which node would be used for a given KV operation. Then you can implement the kind of circuit breaker logic that makes sense for your app.

(note that the functionality there is labeled as uncommitted, so keep an eye on release notes for any changes)


#3

Ah I see , thanks for the suggestion