Queue capacity
Make your prediction before each command, and only then compare. That’s where the learning happens.
Fictional scenario: 100 messages per second, 200 ms of service time, 6,000 messages in the backlog. Open the calculator in the browser or use the terminal.
-
20 consumers: does the backlog drain? Each consumer processes 5 per second.
Janela do terminal npx -y moretes-builder-workshops queue --arrivals 100 --service-ms 200 --consumers 20 --backlog 6000 --lang en -
30 consumers: how long does it take?
Janela do terminal npx -y moretes-builder-workshops queue --arrivals 100 --service-ms 200 --consumers 30 --backlog 6000 --lang en -
What if the provider accepts only 80 per second?
Janela do terminal npx -y moretes-builder-workshops queue --arrivals 100 --service-ms 200 --consumers 30 --backlog 6000 --dependency-limit 80 --lang en
The answer key
Section titled “The answer key”Try to answer before you open it.
See results
| Scenario | Capacity | Utilization | Surplus | Drain |
|---|---|---|---|---|
| 20 consumers | 100/s | 100% | 0/s | never |
| 30 consumers | 150/s | 66.7% | 50/s | 120 s |
| 30, 80/s ceiling | 80/s | 125% | -20/s | never |
With 20, capacity equals the input: nothing is left to drain. With the 80/s ceiling, adding consumers doesn’t create capacity at the provider, and the backlog grows by 20 messages per second.
The math
Section titled “The math”consumer capacity = consumers × concurrency × 1000 ÷ service time (ms)effective capacity = the lower of consumers and dependencyutilization = arrivals ÷ effective capacitydrain time = backlog ÷ (effective capacity − arrivals)To discuss
Section titled “To discuss”- What would you measure first in a real system?
- Does more pressure on a saturated provider make things better or worse?
- What would you tell the customer while the queue drains?
Independent community project by Fernando Azevedo, AWS Community Builder. Not official AWS material, and not endorsed by AWS. AWS and related names are trademarks of Amazon.com, Inc. or its affiliates. MIT license.