viewof targetThroughput = Inputs.range([1000, 100000], {
value: 20000,
step: 1000,
label: "Target throughput (msg/sec)"
})
viewof diskIOLatency = Inputs.range([1, 50], {
value: 10,
step: 1,
label: "Disk I/O latency (ms)"
})
viewof memoryLatency = Inputs.range([0.1, 2], {
value: 0.5,
step: 0.1,
label: "Memory latency (ms)"
})
// Calculate throughput limits
persistentMaxThroughput = 1000 / diskIOLatency
transientMaxThroughput = 1000 / memoryLatency
persistentAchievable = Math.min(targetThroughput, persistentMaxThroughput)
transientAchievable = Math.min(targetThroughput, transientMaxThroughput)
persistentBottleneck = targetThroughput > persistentMaxThroughput
transientBottleneck = targetThroughput > transientMaxThroughput
html`<div style="background: #f8f9fa; padding: 20px; border-radius: 8px; border-left: 4px solid #3498DB;">
<h3 style="margin-top: 0; color: #2C3E50;">Persistence Impact on Throughput</h3>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-top: 15px;">
<div style="background: white; padding: 15px; border-radius: 6px; border: 1px solid ${transientBottleneck ? '#E74C3C' : '#16A085'};">
<h4 style="color: #7F8C8D; margin-top: 0;">Transient (Memory)</h4>
<p style="font-size: 28px; font-weight: bold; color: ${transientBottleneck ? '#E74C3C' : '#16A085'}; margin: 10px 0;">
${transientAchievable.toLocaleString()}<span style="font-size: 16px; font-weight: normal;"> msg/sec</span>
</p>
<p style="color: #7F8C8D; margin: 5px 0;">Latency: ${memoryLatency}ms</p>
<p style="color: #7F8C8D; margin: 5px 0;">Max capacity: ${transientMaxThroughput.toLocaleString()} msg/sec</p>
${transientBottleneck ?
`<p style="color: #E74C3C; font-weight: bold; margin-top: 10px;">BOTTLENECK: Target exceeds capacity</p>` :
`<p style="color: #16A085; font-weight: bold; margin-top: 10px;">✓ Sufficient capacity</p>`
}
</div>
<div style="background: white; padding: 15px; border-radius: 6px; border: 1px solid ${persistentBottleneck ? '#E74C3C' : '#16A085'};">
<h4 style="color: #2C3E50; margin-top: 0;">Persistent (Disk)</h4>
<p style="font-size: 28px; font-weight: bold; color: ${persistentBottleneck ? '#E74C3C' : '#16A085'}; margin: 10px 0;">
${persistentAchievable.toLocaleString()}<span style="font-size: 16px; font-weight: normal;"> msg/sec</span>
</p>
<p style="color: #7F8C8D; margin: 5px 0;">Latency: ${diskIOLatency}ms</p>
<p style="color: #7F8C8D; margin: 5px 0;">Max capacity: ${persistentMaxThroughput.toLocaleString()} msg/sec</p>
${persistentBottleneck ?
`<p style="color: #E74C3C; font-weight: bold; margin-top: 10px;">BOTTLENECK: Target exceeds capacity</p>` :
`<p style="color: #16A085; font-weight: bold; margin-top: 10px;">✓ Sufficient capacity</p>`
}
</div>
</div>
<div style="margin-top: 20px; padding: 15px; background: white; border-radius: 6px; border: 1px solid #ddd;">
<h4 style="color: #2C3E50; margin-top: 0;">Throughput Reduction</h4>
<p style="font-size: 18px; margin: 5px 0;">
Persistent vs Transient:
<strong style="color: #E67E22;">${((persistentMaxThroughput / transientMaxThroughput) * 100).toFixed(1)}%</strong>
of transient throughput
</p>
<p style="font-size: 18px; margin: 5px 0;">
Latency overhead:
<strong style="color: #E67E22;">${((diskIOLatency / memoryLatency) - 1).toFixed(1)}x</strong>
slower than memory
</p>
<p style="color: #7F8C8D; font-size: 0.95em; margin-top: 15px;">
<strong>Recommendation:</strong> ${
persistentBottleneck ?
'Use transient messages or add more brokers with sharding to distribute disk I/O load.' :
transientBottleneck ?
'Even transient mode cannot meet target - consider message batching or rate limiting.' :
persistentMaxThroughput >= targetThroughput * 2 ?
'Persistent mode has plenty of headroom - use it for data durability.' :
'Persistent mode meets target but with limited headroom - monitor disk I/O carefully.'
}
</p>
</div>
</div>`Interactive: Throughput vs Latency Tradeoff
Interactive: Throughput vs Latency Tradeoff
animation
amqp
protocols
messaging
Try Change disk I/O latency to 20 ms.
Observe Compare Persistent (Disk) and Transient (Memory) Max capacity at 20 ms disk I/O latency.
Explain Explain why 10 ms disk latency limits throughput to 100 msg/sec per connection.
Technical boundaries. This serial-latency model calculates maximum throughput as 1000 divided by latency. Achievable throughput is limited to the target or maximum capacity.