New to Kestra?
Use blueprints to kickstart your first workflows.
Monitors Couchbase bucket item resident ratios, calculating RAM saturation and alerting NoSQL database administrators on Slack.
In high-throughput Couchbase Server clusters, memory resident ratio (ep_resident_items_rate) represents the percentage of active cached documents held directly in RAM versus persisted on disk storage. Couchbase uses a memory-first architecture where sub-millisecond key-value operations require documents to reside in memory.
When document ingestion surges or cluster RAM quotas are insufficiently provisioned, the resident ratio drops below operational thresholds (typically 15% to 20%). As documents get evicted to disk, subsequent point reads trigger synchronous disk seeks rather than instantaneous RAM cache lookups. This causes p99 application latency to spike by orders of magnitude, saturating NVMe IOPS queues and degrading downstream consumer SLAs.
This blueprint provides an automated Couchbase performance sentinel. Running on a recurrent fifteen-minute schedule, it queries the Couchbase REST API statistics engine, evaluates active bucket resident percentages against defined performance thresholds, and dispatches real-time alerts with actionable scaling guidance.
audit_resident_ratio trigger (io.kestra.plugin.core.trigger.Schedule) initiates the metric scan every fifteen minutes.scan_bucket_resident_ratio task (io.kestra.plugin.scripts.python.Script) inspects /pools/default/buckets/<bucket>/stats, extracting recent samples of ep_resident_items_rate, active document count, and memory consumption.evaluate_resident_ratio flowable task (io.kestra.plugin.core.flow.If) evaluates whether the active resident ratio has dropped below the configured SLA.alert_slack_resident_ratio_drop (io.kestra.plugin.slack.notifications.SlackIncomingWebhook) dispatches an actionable triage alert with bucket memory statistics and quota expansion recommendations.log_healthy_resident_ratio records nominal memory capacity.export_resident_ratio_manifest task emits structured telemetry JSON for SRE dashboards.flowchart TD
A[Schedule: Every 15 Minutes] --> B[scan_bucket_resident_ratio: Couchbase REST Stats]
B --> C{Resident Ratio Degraded?}
C -- Yes --> D[alert_slack_resident_ratio_drop: Slack Webhook]
C -- No --> E[log_healthy_resident_ratio: Log]
D --> F[export_resident_ratio_manifest: Return JSON]
E --> F
| Name | Type | Default | Description |
|---|---|---|---|
couchbase_endpoint |
STRING | "http://localhost:8091" |
Base REST API URL of the Couchbase management cluster endpoint. |
bucket_name |
STRING | "default" |
Target Couchbase data bucket name to inspect. |
min_resident_ratio_percentage |
INT | 20 |
Minimum percentage of active documents held in RAM before alerting. |
slack_channel |
STRING | "#nosql-reliability" |
Slack channel destination for distributed database notifications. |
{{ outputs.scan_bucket_resident_ratio.vars.is_degraded }}: Boolean flag indicating if resident ratio dropped below SLA.{{ outputs.scan_bucket_resident_ratio.vars.resident_ratio }}: Current active document resident ratio percentage.{{ outputs.scan_bucket_resident_ratio.vars.total_items }}: Total document count in the target bucket.{{ outputs.scan_bucket_resident_ratio.vars.ram_used_mb }}: Total memory consumed by the bucket in megabytes.{{ outputs.scan_bucket_resident_ratio.outputFiles['couchbase_resident_ratio_report.json'] }}: Structured JSON diagnostic report.SLACK_WEBHOOK_URL: Slack Incoming Webhook endpoint URL with permissions to post messages.SLACK_WEBHOOK_URL in your Kestra namespace secrets.couchbase_endpoint and bucket_name to match your production database topology.Authorization: Basic <base64>) or configure client certificates.POST /pools/default/buckets/<bucket> to dynamically expand RAM during surge traffic./pools/default/buckets for fleet-wide governance.