viewof dlqTTL = Inputs.range([1000, 120000], {
value: 30000,
step: 1000,
label: "Message TTL (ms):",
width: 400
})
viewof dlqMaxLength = Inputs.range([100, 50000], {
value: 10000,
step: 100,
label: "Queue max-length:",
width: 400
})
viewof dlqFailRate = Inputs.range([0, 50], {
value: 5,
step: 1,
label: "Consumer failure rate (%):",
width: 400
})
viewof dlqIngestRate = Inputs.range([10, 5000], {
value: 500,
step: 10,
label: "Ingest rate (msg/sec):",
width: 400
})Try It: Dead Letter Queue Simulator
Try It: Dead Letter Queue Simulator
animation
amqp
protocols
messaging
Try Set consumer failure rate to 5% and change queue max-length.
Observe Watch Rejected/sec, TTL Expired/sec, and Overflow Risk at 500 msg/sec.
Explain Explain why DLQ % of Traffic can exceed the 5% warning threshold.
Technical boundaries. Rejected messages are calculated from ingest rate and failure rate. TTL expiration uses ingest rate, queue max-length, and TTL; DLQ growth adds rejected and expired messages.
NoteTry It: Dead Letter Queue Simulator
Adjust the message TTL, queue max-length, and consumer failure rate to see how messages flow between the main queue and the dead letter queue. Watch how different failure scenarios affect message loss and recovery.
dlqColors = ({
navy: "#2C3E50",
teal: "#16A085",
orange: "#E67E22",
blue: "#3498DB",
gray: "#7F8C8D",
purple: "#9B59B6",
red: "#E74C3C"
})
dlqAnalysis = {
const ttlSec = dlqTTL / 1000;
const failFraction = dlqFailRate / 100;
const rejectedPerSec = dlqIngestRate * failFraction;
const ttlExpiredPerSec = Math.max(0, dlqIngestRate - dlqMaxLength / ttlSec) ;
const totalDLQPerSec = rejectedPerSec + Math.max(0, ttlExpiredPerSec);
const mainQueueSteadyState = Math.min(dlqIngestRate * ttlSec * (1 - failFraction), dlqMaxLength);
const dlqGrowthPerHour = totalDLQPerSec * 3600;
const overflowRisk = dlqIngestRate * ttlSec > dlqMaxLength;
const dlqPercentOfTraffic = (totalDLQPerSec / dlqIngestRate) * 100;
return {
ttlSec, failFraction, rejectedPerSec, ttlExpiredPerSec: Math.max(0, ttlExpiredPerSec),
totalDLQPerSec, mainQueueSteadyState, dlqGrowthPerHour, overflowRisk, dlqPercentOfTraffic
};
}
html`
<div style="background: linear-gradient(135deg, ${dlqColors.purple} 0%, ${dlqColors.navy} 100%); padding: 25px; border-radius: 12px; color: white; margin: 10px 0; font-family: Arial, sans-serif;">
<h3 style="margin-top: 0; color: white; border-bottom: 2px solid rgba(255,255,255,0.3); padding-bottom: 10px;">Dead Letter Queue Analysis</h3>
<div style="display: flex; gap: 20px; margin: 20px 0; flex-wrap: wrap;">
<div style="flex: 1; min-width: 200px;">
<svg viewBox="0 0 320 180" style="width: 100%; max-width: 320px;">
<rect x="10" y="20" width="120" height="60" rx="6" fill="${dlqColors.teal}" opacity="0.9"/>
<text x="70" y="45" text-anchor="middle" fill="white" font-size="11" font-family="Arial" font-weight="bold">Main Queue</text>
<text x="70" y="62" text-anchor="middle" fill="white" font-size="9" font-family="Arial">${Math.round(dlqAnalysis.mainQueueSteadyState).toLocaleString()} msgs</text>
<rect x="190" y="20" width="120" height="60" rx="6" fill="${dlqColors.red}" opacity="0.9"/>
<text x="250" y="45" text-anchor="middle" fill="white" font-size="11" font-family="Arial" font-weight="bold">Dead Letter Q</text>
<text x="250" y="62" text-anchor="middle" fill="white" font-size="9" font-family="Arial">${dlqAnalysis.totalDLQPerSec.toFixed(1)} msg/s</text>
<line x1="130" y1="40" x2="190" y2="40" stroke="${dlqColors.orange}" stroke-width="2" marker-end="url(#dlq-arrow)"/>
<text x="160" y="35" text-anchor="middle" fill="${dlqColors.orange}" font-size="8" font-family="Arial">nack/TTL</text>
<line x1="70" y1="95" x2="70" y2="130" stroke="${dlqColors.teal}" stroke-width="2" stroke-dasharray="4"/>
<text x="70" y="145" text-anchor="middle" fill="white" font-size="9" font-family="Arial" opacity="0.8">${(dlqIngestRate * (1 - dlqAnalysis.failFraction)).toFixed(0)} msg/s processed</text>
<line x1="250" y1="95" x2="250" y2="130" stroke="${dlqColors.red}" stroke-width="2" stroke-dasharray="4"/>
<text x="250" y="145" text-anchor="middle" fill="white" font-size="9" font-family="Arial" opacity="0.8">${dlqAnalysis.dlqGrowthPerHour.toFixed(0)} msg/hour</text>
<defs><marker id="dlq-arrow" markerWidth="8" markerHeight="6" refX="8" refY="3" orient="auto"><path d="M0,0 L8,3 L0,6" fill="${dlqColors.orange}"/></marker></defs>
</svg>
</div>
<div style="flex: 1; min-width: 220px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px;">
<div style="background: rgba(255,255,255,0.1); padding: 12px; border-radius: 8px; border-left: 3px solid ${dlqColors.orange};">
<div style="font-size: 0.8em; opacity: 0.8;">Rejected/sec</div>
<div style="font-size: 1.5em; font-weight: bold;">${dlqAnalysis.rejectedPerSec.toFixed(1)}</div>
</div>
<div style="background: rgba(255,255,255,0.1); padding: 12px; border-radius: 8px; border-left: 3px solid ${dlqColors.blue};">
<div style="font-size: 0.8em; opacity: 0.8;">TTL Expired/sec</div>
<div style="font-size: 1.5em; font-weight: bold;">${dlqAnalysis.ttlExpiredPerSec.toFixed(1)}</div>
</div>
<div style="background: rgba(255,255,255,0.1); padding: 12px; border-radius: 8px; border-left: 3px solid ${dlqAnalysis.dlqPercentOfTraffic > 5 ? dlqColors.red : dlqColors.teal};">
<div style="font-size: 0.8em; opacity: 0.8;">DLQ % of Traffic</div>
<div style="font-size: 1.5em; font-weight: bold;">${dlqAnalysis.dlqPercentOfTraffic.toFixed(1)}%</div>
</div>
<div style="background: rgba(255,255,255,0.1); padding: 12px; border-radius: 8px; border-left: 3px solid ${dlqAnalysis.overflowRisk ? dlqColors.red : dlqColors.teal};">
<div style="font-size: 0.8em; opacity: 0.8;">Overflow Risk</div>
<div style="font-size: 1.5em; font-weight: bold;">${dlqAnalysis.overflowRisk ? 'YES' : 'No'}</div>
</div>
</div>
</div>
<div style="padding: 12px; background: rgba(255,255,255,0.06); border-radius: 8px; font-size: 0.85em;">
<strong>Analysis:</strong>
${dlqAnalysis.overflowRisk
? `Queue max-length (${dlqMaxLength.toLocaleString()}) will be exceeded -- messages arriving after the limit will be dead-lettered or dropped. Increase max-length to ${Math.ceil(dlqIngestRate * dlqAnalysis.ttlSec / 1000) * 1000} or reduce TTL.`
: dlqAnalysis.dlqPercentOfTraffic > 5
? `DLQ rate (${dlqAnalysis.dlqPercentOfTraffic.toFixed(1)}%) exceeds 5% threshold. Investigate consumer failures or reduce TTL to ${Math.round(dlqTTL * 0.5)}ms.`
: `System is healthy. DLQ captures ${dlqAnalysis.dlqPercentOfTraffic.toFixed(1)}% of traffic (below 5% warning threshold).`}
</div>
</div>
`