Skip to content

Resilience

For the complete documentation index see: llms.txt

All documentation pages available in markdown.

This page describes how Aerospike optimizes disk writes by grouping record writes. It throttles writes when thresholds past the baseline are exceeded.

Overview

Aerospike optimizes writing to disk by grouping multiple record writes together. If a namespace is configured to store data on an SSD device, or is in-memory with persistence to a device or filesystem, the new version of the record is placed in a 8MiB streaming write buffer (SWB) pending a flush to the storage device. The record’s metadata entry in the primary index is adjusted, updating its pointer to the new location of the record. Aerospike performs a copy-on-write for create/update/replace.

Flush size and cache sizes

The flush-size configuration parameter defines the size in bytes of each I/O unit that is written to disk. A flush event happens either when the 8MiB SWB is full, or when the flush-max-ms period expires. At this point, the most recently written data is flushed from the SWB to disk in a series of flush-size units. These writes are appended to each other until the write block is full.

Each device associated with a namespace has a write queue, and a cache. The configuration max-write-cache controls the number of bytes of pending write blocks that the system is allowed to keep before failing writes, if the write queue can’t immediately flush a streaming write buffer to a write block on the disk.

Writes throttling circuit-breaker

The size of the write cache is calculated using the number of devices in the namespace multiplied by the max-write-cache. This value is a baseline, not a limit. The system throttles various write types at specific thresholds past the baseline with Error Code 18: Device overload returned to the client when appropriate. Each threshold has its own “queue too deep” errors in the server logs. The ‘max’ number listed in the following example log messages assumes the example baseline is 512 write blocks.

  1. At baseline, the calculated write cache size, the master writes fail with an error message in the server logs - write fail: queue too deep: exceeds max 512.
  2. At baseline, User-Defined Function (UDF) calls fail with an error message in the server logs - udf fail: queue too deep: exceeds max 512. This applies to every UDF call, including UDFs that only read, because the server can’t tell in advance whether a UDF writes.
  3. At baseline, duplicate resolutions fail with an error message in the server logs - dup-res fail: queue too deep: exceeds max 512.
  4. At baseline, transaction roll-forwards and roll-backs (Enterprise Edition only) fail with an error message in the server logs - mrt-roll fail: queue too deep: exceeds max 512.
  5. At baseline + 32 write blocks, durable deletes (Enterprise Edition only) fail with this error message in the server logs - durable delete fail: queue too deep: exceeds max 544. The same limit applies to all client deletes in a namespace that Cross-Datacenter Replication (XDR) ships to a datacenter with ignore-expunges set to false.
  6. At baseline + 64 write blocks, immigration writes stop with this error message in the server logs - immigrate fail: queue too deep: exceeds max 576. This causes retransmits until the write queue gets below the threshold.
  7. At baseline + 128 write blocks for SSD storage (changed in 5.7.0 from 100), or baseline + 100 write blocks for memory and PMem storage, defrag writes stop. The defrag process sleeps until the cache is back under the limit. There’s no associated log message for this throttling.
  8. At baseline + 192 write blocks, replica writes stop with this error message in the server logs - replica write fail: queue too deep: exceeds max 704. When replication-compression-mode is delta-zstd (see Wire compression), replica writes sent as deltas fail at the same limit with this error message - replica delta fail: queue too deep: exceeds max 704.

Introduced in v.5.7

Various write types are throttled at margins greater than the write cache baseline.