Enable Aerospike Strong Consistency (Read‑After‑Write) Across a Cluster
Set the ‘strong-consistency’ flag in Aerospike, verify it with asinfo and aql, and know how to roll back if write latency spikes.
02 May 2026, 11:32 UTC

Desired Outcome
Configure every node in an Aerospike cluster so that a read performed immediately after a write always returns the latest value. This linearizable, read‑after‑write guarantee is essential for applications that cannot tolerate stale data, such as financial transaction logs or real‑time inventory counters.
Prerequisites
- Aerospike Server 5.7 or newer installed on all nodes.
- SSD storage with a write‑buffer‑size large enough for your peak write rate (typical recommendation: 50 MiB or more).
- Network latency between nodes < 2 ms; high‑speed interconnects (e.g., Infiniband or 10 GbE).
- Replication factor of at least 2 (recommended 3 for production).
- Full cluster restart privileges (root or sudo).
Procedure
- Edit the namespace configuration
Open
/opt/aerospike/etc/aerospike.confon each node and locate the namespace block. Add the flag under thestorage-enginesection:[namespace test] replication-factor 2 storage-engine device device /dev/nvme0n1 file /opt/aerospike/data/test.db write-block-size 128 write-buffer-size 64 strong-consistency trueReplace
/dev/nvme0n1and/opt/aerospike/data/test.dbwith your actual SSD device and data file path. - Restart Aerospike
On each node run:
sudo systemctl restart aerospike # or if using init.d sudo service aerospike restartVerify that the service comes up without errors.
- Confirm the flag is active
Execute on every node:
sudo asinfo -v "strong-consistency:get-config=true" # Expected output: trueCheck the node log (
/var/log/aerospike/aerospike.log) for a line likestrong-consistency enabled. - Run a read‑after‑write test
Using Aerospike Query Language (AQL) or the client API, perform a write followed immediately by a read on the same key. Example with AQL:
aql -e "INSERT INTO test.myset (key) VALUES ('testkey', 123);" aql -e "SELECT * FROM test.myset WHERE key = 'testkey';" # The SELECT should return 123.Alternatively, use
asbenchmarkwith a read‑after‑write workload to measure latency percentiles.
Verification Checklist
- asinfo output shows
trueforstrong-consistency:get-config=trueon every node. - Cluster log entry confirms
strong-consistency enabledduring startup. - Read‑after‑write test returns the most recent value without error.
- Benchmark shows 99th‑percentile read latency within acceptable limits (e.g., < 5 ms for 2‑node cluster).
Recovery Options
- If write timeouts or high latency appear, revert the flag:
Then restart all nodes.[namespace test] ... strong-consistency false - Monitor the
strong-consistency-errorsmetric viaasinfo -v "metrics:strong-consistency-errors". Persistent errors suggest SSD write‑buffer under‑provisioning; increasewrite-buffer-sizeor add more SSD capacity. - Ensure no node in the cluster has a mismatched setting; otherwise, the cluster may experience split‑brain or inconsistent reads.
Limitations & Practical Tips
- Strong consistency increases write latency by up to 2× in high‑throughput workloads. Test under realistic traffic before deploying to production.
- All nodes must share the same setting; partial deployment is unsupported.
- SSD endurance matters: frequent writes under strong consistency can accelerate wear. Monitor
ssd-healthmetrics if available. - For workloads that tolerate eventual consistency, consider disabling the flag to regain throughput.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.