Choosing Strong Consistency in Aerospike Namespaces: Latency, Availability, and Design Trade‑offs
Learn how to enable Aerospike strong consistency per namespace, measure its latency impact, and decide when to use it for critical metadata while keeping other data eventually consistent.
20 Dec 2025, 16:48 UTC

Problem: Mixed Consistency Needs in a Single Aerospike Cluster
Many applications store both latency‑sensitive user profile data and critical metadata such as session IDs or financial ledgers in the same Aerospike cluster. Treating all namespaces with the same consistency model forces a compromise: either you accept stale reads for important transactions, or you incur unnecessary latency for high‑traffic reads. The decision point is whether to enable Aerospike’s per‑namespace strong‑consistency flag for only the data that requires linearizable guarantees.
How Strong Consistency Works in Aerospike
When strong-consistency true is set for a namespace, every write must be synchronously replicated to the master node and all configured replicas before the client receives an acknowledgment. Reads that use the CONSISTENT_ALL policy are guaranteed to read from the master after a write quorum, eliminating stale‑read anomalies. This mode is orthogonal to XDR; it affects intra‑cluster replication only, while XDR continues to ship changes asynchronously to remote datacenters.
Impact on Write Latency and Availability
Enabling strong consistency adds the round‑trip time of the slowest replica to each write. In practice, write latency typically rises 2‑5× compared with the default eventual‑consistency (CONSISTENCY_LEVEL_ONE) mode, and write throughput drops proportionally, especially under high inter‑node latency or packet loss. Availability is also affected: during a network partition, if any replica cannot be reached, the write fails and the client sees a timeout or error, whereas eventual‑consistency mode would still succeed by writing to the reachable master.
Practical Configuration and Verification
- Edit the configuration file (requires root or the
aerospikeuser):
sudo vi /etc/aerospike/aerospike.confAdd or modify the namespace block:namespace test { strong-consistency true replication-factor 2 ... } - Restart the node** to apply the change:
sudo systemctl restart aerospike(Ensure you have permission to manage the service; a rolling restart is recommended in production to avoid downtime.) - Verify the flag is active**:
asinfo -v 'strong-consistency'asinfo -v 'namespace/test/strong-consistency'Both should returntrue. You can also check the Aerospike log for lines likestrong-consistency enabled for namespace test. - Benchmark latency difference** (run from a client machine with the Aerospike Java client library):
Record the average latency for each setting; the strong‑consistency run should show higher latency. No specific numbers are claimed here—your environment will determine the exact delta.WritePolicy wp = new WritePolicy(); wp.consistencyLevel = ConsistencyLevel.CONSISTENT_ALL; // strong mode // measure 10,000 writes with wp wp.consistencyLevel = ConsistencyLevel.ONE; // eventual mode // measure same workload
Worked Example: Two Namespaces, Different Consistency
Suppose you have a cluster with three nodes and a replication factor of 2. You create:
ns_meta– stores user session IDs; strong consistency enabled.ns_profile– stores user profile pictures; eventual consistency (default).
When a client writes a session ID to ns_meta with CONSISTENT_ALL, the write waits for both replicas to acknowledge before returning. A simultaneous write to ns_profile with CONSISTENT_ONE returns after the master acknowledges, achieving lower latency. Reads from ns_meta using CONSISTENT_ALL are linearizable; reads from ns_profile can use CONSISTENT_ONE for faster response.
Trade‑off and Limitation
The primary trade‑off is increased write latency and reduced write throughput for the strong‑consistency namespace, coupled with a higher risk of write errors during network partitions. If your application cannot tolerate write failures, you must either increase the replica count (which adds more latency) or accept eventual consistency for that data. Operationally, you must monitor both the strong-consistency flag and latency metrics; a mis‑typed flag or missing restart will silently fall back to eventual consistency, giving a false sense of safety.
Actionable Closing
- Identify which data requires linearizable reads (e.g., transactional ledgers, lock tokens).
- Enable
strong-consistency trueonly for those namespaces. - Restart nodes with a rolling upgrade plan and verify the flag via
asinfoand the logs. - Benchmark write latency with
CONSISTENT_ALLversusCONSISTENT_ONEto quantify the impact. - Set up alerts for write‑error rates and latency spikes in the strong‑consistency namespaces.
By applying strong consistency selectively, you preserve the performance benefits of Aerospike’s eventual‑consistency model for the majority of your workload while guaranteeing correctness for the data that truly needs it.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.