Skip to main content

C Client Best Practices

Enable Client Log

Each Aerospike C client instance runs a background cluster tend thread that periodically polls all nodes for cluster status. This background thread generates log messages that reflect node additions/removal and any errors when retrieving node status, peers, partition maps and racks. It's critical that user applications enable this log to receive these important messages.

See Enable Log.

Circuit Breaker

Employ a circuit breaker that activates when a maximum error count is reached for a node and rejects transactions to that node until the specified error window expires. The following ClientPolicy fields can create a circuit breaker.


Maximum number of errors allowed per node per error_rate_window. Errors include connection errors, timeouts and device overload. If maximum errors are reached, further transactions to that node are retried to another node depending on replica policy. If maxRetries are exhausted, the backoff error code AEROSPIKE_MAX_ERROR_RATE is returned.


The number of cluster tend iterations that defines the window for max_error_rate. One tend iteration is defined as the tend interval (default 1 second) plus the time to tend all nodes. At the end of the window, the error count is reset to zero and backoff state is removed on all nodes.

The user application could optionally use a fallback cluster to handle traffic when the circuit breaker is employed.