Aerospike offers Strong Consistency (SC) mode, which prioritizes data integrity over availability.
SC mode ensures that successful writes are never lost, and reads always return the latest data.
According to the CAP theorem, a distributed database can guarantee only two out of three:
| Property | Description |
|---|---|
| C: Consistency | Every read receives the most recent write or an error |
| A: Availability | Every request receives a response (may not be the latest data) |
| P: Partition Tolerance | The system functions despite node failures |
| Mode | Description |
|---|---|
| CA | High consistency and availability, nodes never go down (Not realistic!) |
| AP | High availability, allows eventual consistency across nodes |
| CP | Strong consistency, scalable, but some downtime during node failures |
Key Differences:
โ
No Dirty Reads โ Clients always see the latest committed value.
โ
Writes/updates are never lost.
โ
Linearizable Reads:
SC mode partitions can be in the following states:
| State | Description |
|---|---|
| Available | All records in this partition can be read and written consistently. |
| Unavailable | The partition is temporarily unreachable (e.g., network partitioning). |
| Dead | Partition data is corrupted or deleted, making it untrustworthy. |
| State | Description |
|---|---|
| OK | Normal state, replicated to all nodes within replication factor (RF). |
| Replicating | Master is actively writing to proles (replica nodes). |
| Re-Replicating | Master retries replication if acknowledgments are missing. |
| Un-Replicated | Data failed to replicate: On master if replication fails, on prole if RF > 2 but missing confirmation. |
โ
Reads always go to the partition master.
โ
Aerospike ensures data consistency at all times.
| Scenario | Behavior |
|---|---|
| Case 1 | Record is OK on master โ Returns data to client. |
| Case 2 | Record is UNREPLICATED โ Master node retries replication before responding. |
| Failure | If replication fails, client times out instead of getting stale data. |
โ
SC Mode prioritizes consistency over availability
โ
Reads always return the latest committed data
โ
Cluster modifications require manual intervention
โ
No dirty reads, no stale data
โ
Passes Jepsen tests for distributed consistency