RabbitMQ KEDA Consumer Autoscaling Design Prompt
Design a KEDA-driven autoscaler that scales RabbitMQ consumer deployments on queue depth without thrashing, starving prefetch, or breaking message ordering.
- Target user
- Platform engineers running RabbitMQ consumers on Kubernetes
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT, Cursor
The prompt
You are a senior platform engineer who runs high-throughput RabbitMQ consumers on Kubernetes and has tuned KEDA ScaledObjects to track queue depth without oscillation. I will provide: - The queue(s) to scale, their type (classic, quorum, stream), and typical vs. peak depth - Current consumer Deployment spec (replicas, prefetch/QoS, ack mode, processing time per message) - RabbitMQ topology (cluster size, connection/channel limits, management endpoint or AMQP) - SLOs (max acceptable queue latency, cost ceiling on replica count) Your job: 1. **Choose the trigger metric** — decide between the `rabbitmq` KEDA scaler modes `queueLength` (ready messages) and `messageRate` (publish/deliver rate via the management API), and explain why unacked messages must be excluded so prefetch backlog doesn't inflate the metric and cause runaway scaling. 2. **Set the ScaledObject math** — compute `value` (target messages per replica) from processing time and prefetch so N replicas drain the SLO backlog; show the full ScaledObject YAML including `pollingInterval`, `cooldownPeriod`, `minReplicaCount`, `maxReplicaCount`, and the trigger `metadata` (host or management protocol, queueName, vhost, mode, value). 3. **Prevent thrashing** — tune `cooldownPeriod`, HPA `stabilizationWindowSeconds`, and scale-up/down policies so a bursty publisher doesn't flap replicas; explain the interaction between KEDA's ScaledObject and the underlying HPA behavior block. 4. **Protect the broker** — cap `maxReplicaCount` against connection/channel/FD limits, recommend per-consumer channel and prefetch settings, and warn where scale-out multiplies connection churn. 5. **Handle ordering and drain** — flag when scaling breaks per-key ordering (use single-active-consumer or a stream with one consumer), and design graceful shutdown (`terminationGracePeriodSeconds`, stop consuming + ack in-flight) so scale-down never loses or double-processes messages. 6. **Secure the trigger** — store the management/AMQP credentials in a TriggerAuthentication + Secret, never inline in the ScaledObject. Output as: (a) trigger-metric decision with rationale, (b) complete ScaledObject + TriggerAuthentication YAML, (c) anti-thrash tuning table, (d) broker-limit safety check, (e) drain/ordering checklist. Show the queue-depth-to-replica math explicitly so the target value can be re-derived when processing time changes.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
RabbitMQ on Kubernetes Cluster Operator Deployment Design Prompt
Design a production RabbitMQ deployment on Kubernetes using the RabbitMQ Cluster Operator, covering StatefulSet sizing, quorum queues, persistence, anti-affinity, and safe rolling upgrades.
-
RabbitMQ Poison Message & Redelivery Loop Triage Prompt
Diagnose endless requeue/redelivery loops caused by poison messages, nack-without-DLX, and missing delivery-limit handling so a single bad message stops poisoning a consumer group.
-
RabbitMQ Single Active Consumer Ordering Prompt
Use single active consumer (SAC) to preserve strict message ordering with hot-standby failover, and understand exactly what ordering guarantee you get versus what you don't.
-
RabbitMQ Consumer Prefetch & QoS Tuning Prompt
Tune consumer prefetch (basic.qos) so work is spread evenly across consumers, throughput is high, and no single consumer hoards or starves while others sit idle.
More RabbitMQ prompts & error guides
Browse every RabbitMQ prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.