GUI, CLI, and benchmarks · Engineering

Monitoring a single-writer database

Health checks, metric scopes, latency histograms, queue depth, WAL alarms, and the signals that actually indicate trouble.

A single-writer database has a small set of failure modes: the writer stops, the queue grows, the disk fills, replication lags, or a long query holds a transaction. Monitoring should make those visible before users do.

NonoDB exposes liveness, readiness, JSON metrics, Prometheus metrics, and per-collection counters. The useful part is knowing which signal answers which question.

Health and readiness

Terminal window
curl -fsS http://127.0.0.1:7878/healthz
curl -fsS http://127.0.0.1:7878/readyz

/healthz is liveness. /readyz checks that the writer thread is running and opens a real LMDB read transaction. On replicas the writer is not required. It returns HTTP 503 with per-check details when a required check fails.

/readyz/write is the write-pool check: 200 only on a writable primary, otherwise 503 with a Location header for the known primary. A load balancer can use it to route writes without guessing.

Metric scopes

Do not scrape with an administrator token. Create a dedicated principal:

Terminal window
nonodb-cli auth principal add prometheus metrics:read
nonodb-cli auth token create prometheus > /etc/nonodb/prometheus-token
chmod 0640 /etc/nonodb/prometheus-token

metrics:read can read metrics but cannot read collections, manage databases, or change authorization. admin:db and *:* also imply metrics access.

Prometheus needs a TCP listener. Keep it on loopback or a private network with TLS.

The core signals

Signal What it tells you
nonodb_requests_total Request volume
nonodb_queue_len Writer queue depth
nonodb_errors_total Error rate
nonodb_request_duration_seconds End-to-end request latency
nonodb_commit_duration_seconds Commit latency
nonodb_disk_used_ratio Disk pressure by mount
nonodb_snapshot_age_seconds Backup/snapshot freshness
nonodb_ts_* Time-series retention and bucket growth
nonodb_replication_lag Replica lag by source
nonodb_wal_full PITR hard limit reached

Latency histograms cover the end-to-end /v1/exec request, including writer queue time for writes. Long-poll and streaming watches are excluded because their duration is client waiting time.

histogram_quantile(0.95, sum by (le, op) (rate(nonodb_request_duration_seconds_bucket[5m])))

A rising queue with stable latency is usually a burst that is draining. A rising queue with rising write latency is a writer bottleneck: large transactions, slow disk, or an index build.

Lookup metrics

Ordered point lookups have dedicated counters:

nonodb_lookup_requests_total
nonodb_lookup_documents_read_total
nonodb_lookup_index_entries_read_total
nonodb_lookup_bytes_read_total
nonodb_lookup_errors_total
nonodb_lookup_duration_seconds_bucket

nonodb_lookup_duration_seconds measures lookup execution, not the HTTP round trip. Use it to watch index coverage and document-fetch rates. A rising documents-read count per lookup suggests an index is missing or not selective.

Time-series signals

Metric Meaning
nonodb_ts_rows Live rows in time-series collections
nonodb_ts_deleted_rows Deleted rows still in bucket bitmaps
nonodb_ts_buckets Bucket count
nonodb_ts_encoded_bytes Encoded bucket bytes
nonodb_ts_raw_bytes Raw JSON bytes represented
nonodb_ts_retention_runs_total Retention passes
nonodb_ts_retention_errors_total Failed passes
nonodb_ts_compacted_bytes_total Bytes reclaimed

A rising deleted_rows with flat encoded_bytes means bitmap deletes are accumulating. Check the compaction threshold.

Replication and PITR

Alert on replication lag, transport errors, apply errors, and certificate expiry. Alert on wal_full == 1 and on pitr_available == 0 when PITR is enabled and the WAL has data.

A replica that is online but lagging is not a failover candidate. A primary that has lost quorum should self-demote; watch role and lease metrics, not only process liveness.

Alerts worth having

  1. up{job="nonodb"} == 0
  2. disk used ratio above 85%
  3. queue length growing for several minutes
  4. error rate sustained above baseline
  5. snapshot age above the expected interval
  6. auth failures and blocks
  7. certificate expiry within 14 days
  8. wal_full == 1
  9. PITR unavailable while the WAL has data
  10. replication lag above the target RPO/RTO

Avoid alerting on a single slow request. Use histograms and multi-minute windows.

Dashboards

A useful dashboard has four rows:

  • Traffic: requests, errors, p50/p95/p99 by op.
  • Writer: queue, commit duration, batch size, TTL work.
  • Capacity: disk, map usage, snapshot age, time-series bytes.
  • Replication/DR: role, lag, WAL, certificate expiry.

Keep the database and collection labels. A single global p95 hides the one collection that is slow.

Logs and audit

Metrics tell you that something is wrong; logs tell you what. The daemon logs warnings for quota soft limits and errors for rejections. The optional audit log records auth decisions and request metadata but not document bodies by default.

Do not put secrets, vault keys, or document bodies in logs. Protect the audit file as sensitive metadata.

What monitoring cannot tell you

  • Whether a backup restores. Only a drill can.
  • Whether a query plan is optimal. Use explain.
  • Whether the data is correct. Use application checks.
  • Whether a failover preserves every write. Measure the RPO.
  • Whether the host will run out of disk from another service.

The monitoring guide has the full metric list, Prometheus configuration, alerts, and OpenTelemetry notes.

All engineering notes →Read the docs