In this lesson · topic 1 of 7
Topic 1
Why queues form
4 min read
One server is a ceiling
A server can finish only so much work per second. Past that point requests wait, and a request that waits is a slow request. So you add servers, and now you need a rule for which request goes where. That rule is the load balancer.
The obvious worry is that the servers together are too small for the traffic. That is real, but it is not the interesting problem. The interesting problem is that you can have enough total capacity and still make users wait.
Arrivals are not evenly spaced
Requests do not arrive in a neat line. They arrive at random, sometimes two in the same instant, sometimes none for a while. The lab models this as a Poisson process, which is the standard model for independent arrivals at a steady average rate.
Requests also differ in cost. Most are cheap and a few are expensive. When an expensive one starts on a server, everything queued behind it waits. The lab controls how uneven the cost is with the service-time variance setting.
Two facts together cause the trouble. Arrivals are bursty, and a server works through its queue one request at a time. A burst that lands on one server stays there.
Utilization is the dial
Divide the arrival rate by the total capacity and you get utilization. Near zero, servers are mostly idle and a queue is rare. As it approaches one, every server is nearly always busy, and a small burst takes a long time to drain. Above one, the queue grows without bound.
Below is the first thing to predict. Take eight similar servers at 85 percent utilization overall, and assign each request to a uniformly random server.
Predict first
What the numbers look like
Under that exact setup the lab reports a median latency of 5.7 tmeasured and a 99th percentile of 56.7 tmeasured for random assignment. The median request waits a little. One request in a hundred waits many times longer. That gap, with no server overloaded on average, is the cost of queueing luck.
The next topic looks at the cheap tricks that close most of that gap.