Strong Consistency commit-to-device durability and drive cache interaction
0 reputation · 17 Jul 2023, 02:51 UTC
0 reputation · 17 Jul 2023, 02:51 UTC
Aerospike Strong Consistency (SC) mode utilizes a consensus protocol to ensure linearizability. When the commit-to-device configuration is set to true, the system is intended to force an fsync() to the storage device before acknowledging a write to the client, ensuring that acknowledged data survives an unclean shutdown.
The effectiveness of this durability guarantee depends heavily on the underlying hardware. While enterprise-grade SSDs with Power Loss Protection (PLP) ensure that data in the volatile write cache is flushed to non-volatile media during power failure, consumer-grade drives may report a successful sync to the OS while the data remains in a volatile buffer.
There is currently no built-in mechanism within the strong-consistency statistics to verify if a specific acknowledged write reached the physical platter/cell versus the kernel page cache or a volatile drive cache.
fsync implementation to ensure commit-to-device=true provides actual durability on drives without PLP?35775 reputation · 17 Jul 2023, 07:39 UTC
Aerospike does not validate the storage device's fsync implementation. When commit-to-device=true, the server issues an fsync() system call and treats the OS return value as the durability signal. If fsync() returns 0, the write is acknowledged; any non-zero return aborts the acknowledgement. There is no built-in statistic, API, or health check in Strong Consistency mode that confirms a write reached non-volatile media versus a volatile drive cache or kernel page cache.
commit-to-device=true forces an fsync() on the namespace's storage file/device before replying to the client.fsync() return code is the only durability gate inside Aerospike; the engine does not query SMART, PLP status, or drive cache state.asinfo -v 'statistics') expose replication latency, quorum counts, and transaction metrics, but nothing about physical media persistence.On drives without Power Loss Protection (PLP), a successful fsync() may only mean the data reached the drive's volatile write cache. If power fails before the drive flushes that cache to non-volatile cells, the acknowledged write can be lost. Aerospike assumes the OS and block layer honor fsync() semantics; it cannot detect a drive that lies about completion.
hdparm -W /dev/nvme0n1 (or sdparm for SATA). Output Write cache = 0 means the volatile cache is disabled; = 1 means it is enabled and data may be at risk without PLP.nvme id-ctrl, smartctl -a) report Power Loss Protection or Volatile Write Cache features. Enterprise drives typically expose a PLP capacitor health indicator.fsync latency: iostat -x 1 or bpftrace -e 'tracepoint:syscalls:sys_enter_fsync { @start[tid] = nsecs; } tracepoint:syscalls:sys_exit_fsync /@start[tid]/ { @lat = hist(nsecs - @start[tid]); delete(@start[tid]); }' shows whether fsync completes in microseconds (cache ack) or milliseconds (media flush).What is the exact drive model (or cloud instance storage type) and its PLP status? The recommendation changes from "enable commit-to-device and monitor" to "disable drive write cache or use PLP-backed storage" if the device lacks PLP.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.