Schedule icon
Script icon
If icon
SlackIncomingWebhook icon
Log icon
Return icon

Aerospike Stop-Writes Headroom Sentinel

Audits Aerospike namespace RAM and storage capacity against stop-writes limits, calculating headroom and alerting DBAs on Slack.

Categories
DataInfrastructure

In ultra-low latency NoSQL architectures powered by Aerospike, each data namespace is configured with strict safety ceilings (stop-writes-pct and high-water-memory-pct). When memory utilization or storage device capacity crosses the configured stop-writes-pct threshold (typically 90%), Aerospike immediately enters a read-only protective state.

Once stop-writes is triggered, all subsequent incoming write transactions (inserts, updates, and deletes) fail with AS_ERR_FAIL_FORBIDDEN error codes. In mission-critical deployments such as payment authorization, fraud detection, and user profile stores, unexpected write rejection leads to catastrophic transaction processing halts across client microservices.

This blueprint provides an automated Aerospike capacity sentinel. Running on a recurrent ten-minute schedule, it communicates with Aerospike cluster nodes via standard info protocol sockets, calculates remaining memory and device headroom before stop-writes enforcement, and delivers proactive alerts to database administrators on Slack.

How it works

  1. Recurrent Pulse Trigger: The poll_aerospike_headroom trigger (io.kestra.plugin.core.trigger.Schedule) initiates the metric scan every ten minutes.
  2. Aerospike Info Protocol Query: The scan_namespace_headroom task (io.kestra.plugin.scripts.python.Script) opens a socket to the Aerospike daemon, querying namespace/<namespace> to extract memory-size, used-bytes-memory, stop-writes-pct, and current stop-writes flags.
  3. Headroom Gate: The evaluate_stop_writes_risk flowable task (io.kestra.plugin.core.flow.If) branches based on whether calculated headroom has eroded beneath the designated safety margin.
  4. Slack Incident Alert: When headroom breaches the threshold, alert_slack_stop_writes_breach (io.kestra.plugin.slack.notifications.SlackIncomingWebhook) delivers an actionable notification with current saturation percentages and dynamic CLI reconfiguration commands (asinfo set-config).
  5. Healthy Confirmation: When capacity reserves are abundant, log_healthy_namespace_capacity logs healthy operational state.
  6. Manifest Export: The export_stop_writes_manifest task records an execution summary for SRE telemetry ingestion.

Architecture diagram

flowchart TD
    A[Schedule: Every 10 Minutes] --> B[scan_namespace_headroom: Aerospike Info Protocol]
    B --> C{Stop-Writes Headroom Breached?}
    C -- Yes --> D[alert_slack_stop_writes_breach: Slack Webhook]
    C -- No --> E[log_healthy_namespace_capacity: Log]
    D --> F[export_stop_writes_manifest: Return JSON]
    E --> F

Use cases

  • High-Velocity AdTech and Bidding: Prevent stop-writes write rejections during real-time bid stream ingestion surges.
  • FinOps and Capacity Planning: Track rate-of-growth across in-memory namespaces to forecast RAM procurement schedules accurately.
  • Prevent Eviction Cascades: Alert engineers before secondary index allocations or TTL expirations trigger unexpected node memory exhaustion.

Inputs

Name Type Default Description
aerospike_host STRING "localhost" Hostname or IP address of the Aerospike cluster seed node.
aerospike_port INT 3000 Network communication port exposing Aerospike info commands.
target_namespace STRING "test" Name of the Aerospike data namespace to audit.
headroom_threshold_percentage INT 15 Minimum acceptable headroom percentage before alerting.
slack_channel STRING "#aerospike-reliability" Slack channel destination for distributed database alerts.

Expected outputs

  • {{ outputs.scan_namespace_headroom.vars.is_critical }}: Boolean flag indicating if headroom breached threshold or stop-writes triggered.
  • {{ outputs.scan_namespace_headroom.vars.headroom_pct }}: Remaining percentage headroom before write rejection.
  • {{ outputs.scan_namespace_headroom.vars.mem_usage_pct }}: Current namespace RAM utilization percentage.
  • {{ outputs.scan_namespace_headroom.vars.stop_writes_limit }}: Configured stop-writes limit percentage on the namespace.
  • {{ outputs.scan_namespace_headroom.outputFiles['aerospike_headroom_report.json'] }}: Structured diagnostic JSON artifact.

Prerequisites

  • Aerospike Database cluster node reachable over TCP on port 3000.
  • Incoming Webhook URL configured for your database reliability Slack channel.

Secrets

  • SLACK_WEBHOOK_URL: Slack Incoming Webhook endpoint URL with permissions to post messages.

Quick start

  1. Configure SLACK_WEBHOOK_URL in your Kestra namespace secrets.
  2. Import this flow YAML into your Kestra workspace.
  3. Update aerospike_host, aerospike_port, and target_namespace to reflect your cluster deployment.
  4. Click Execute in the UI to run an initial capacity audit.

Common pitfalls and troubleshooting

  • Aerospike TLS and Mesh Authentication: On secured production clusters with TLS enabled, ensure sockets use ssl.wrap_socket and authenticate with user credentials via the Aerospike binary protocol.
  • Device vs Memory Stop-Writes: In namespaces using persistent storage (storage-engine device), stop-writes can be triggered by either RAM or disk exhaustion; monitor both resources.

How to extend

  • Add automated dynamic memory resizing via asinfo -v "set-config:context=namespace;id=<namespace>;memory-size=<new_size>" after human approval.
  • Automate truncation of non-essential transient sets using asinfo -v "truncate:namespace=<ns>;set=<set_name>".
  • Loop across all cluster namespaces dynamically by querying namespaces info command.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.