Section 14.38

Queueing delay

Definition

Queueing delay is the time a request, packet or job spends waiting in a queue before a server, meaning any resource that handles requests, such as a processor or a link, starts to work on it. It excludes the service time, the time the server then spends on the request; waiting plus service is the time in the system. Queueing delay depends on the arrival pattern, the service times, the number of servers and the order of service. It grows sharply as the arrival rate approaches the service rate.

The idea

A device handles requests one at a time and needs 0.1 s for each, so it can complete 10 requests per second. Requests arrive at 9 per second on average. On average the device keeps up, yet requests often wait, because arrivals are irregular: several can arrive close together, and the device still serves only one at a time. A backlog shrinks only through spare capacity. At 9 arrivals per second, only 10−9=110 - 9 = 1 request per second of capacity is left for the backlog, so, counting average rates only, a backlog of 10 requests takes about 10/1=1010 / 1 = 10 s to clear while new requests keep arriving. At 5 arrivals per second, 10−5=510 - 5 = 5 requests per second are spare, and the same backlog clears in about 10/5=210 / 5 = 2 s.

A supermarket checkout is the everyday picture. At a quiet hour a queue that forms empties quickly. Near full load the queue rarely empties, so each new group of customers lands on a queue left over from the last one. The waiting time behaves like 1 divided by the spare fraction of capacity, which grows without limit as that fraction goes to zero. The picture stops at one point: customers can see the queue and walk away, while requests in a computer usually wait until they are served or until a full buffer turns them away.

How it works

A queueing model names five parts.

For one server, the utilization ρ=λ/μ\rho = \lambda / \mu (rho) is the fraction of time the server is busy. If ρ≥1\rho \ge 1, requests arrive at least as fast as they can be served, there is no steady state §11.27, and the queue tends to grow without limit; for ρ>1\rho > 1 it grows by about λ−μ\lambda - \mu requests per second.

Waiting comes from variability, not from load alone. If requests arrive exactly every 1/λ1/\lambda seconds and every service takes exactly 1/μ1/\mu seconds, with λ<μ\lambda < \mu, each request finishes before the next one arrives, and no request waits at any utilization below 1. Random gaps between arrivals and random service times create the bursts that build queues, and the spare capacity μ−λ\mu - \lambda decides how fast those queues drain.

Queueing models are named in Kendall’s notation [250] A/S/cA/S/c: AA describes the arrivals, SS the service times and cc the number of servers. The letter M, for Markovian or memoryless, stands for exponentially distributed gaps between arrivals or exponentially distributed service times; D stands for fixed (deterministic) values, and G for a general distribution. The M/M/1 queue is the standard starting point. Its arrivals form a Poisson process, meaning that the gaps between arrivals are independent and exponentially distributed; its service times are independent and exponentially distributed; and it has one server, FIFO order and an unlimited buffer. An exponential service time is memoryless: however long a request has already been served, the distribution of its remaining service time is the same. For the M/M/1 queue the mean waiting time is Wq=ρ1−ρ⋅1μ.W_q = \frac{\rho}{1 - \rho} \cdot \frac{1}{\mu}. The factor ρ/(1−ρ)\rho / (1 - \rho) is 1 at 50% utilization, 4 at 80%, 9 at 90% and 99 at 99%.

For one server with general arrivals and service, Kingman’s approximation, which is accurate when the utilization is close to 1, shows the three causes together: Wq≈ρ1−ρ⋅ca2+cs22⋅1μ,W_q \approx \frac{\rho}{1 - \rho} \cdot \frac{c_a^2 + c_s^2}{2} \cdot \frac{1}{\mu}, where cac_a and csc_s are the coefficients of variation, the standard deviation §11.14 divided by the mean, of the gaps between arrivals and of the service times. Waiting grows with utilization, with variability and with the mean service time. For the M/M/1 queue both coefficients are 1, and the approximation equals the exact formula.

In a network, the delay of one packet at one hop has four parts: processing (examining the packet), queueing, transmission (putting its bits onto the link) and propagation (the signal’s travel time to the next hop). Only the queueing part depends strongly on the load.

Worked example

Take μ=10\mu = 10 requests per second, so the mean service time is 1/10=0.11/10 = 0.1 s, and use the M/M/1 formulas stated precisely below: mean time in the system W=1/(μ−λ)W = 1 / (\mu - \lambda) and mean waiting time Wq=W−1/μW_q = W - 1/\mu.

The service time stayed 0.1 s throughout. Raising the load from 5 to 9 requests per second, by 80%, multiplied the mean waiting time by 9.

The tail grows too. In the M/M/1 queue with FIFO order, the time in the system is exponentially distributed with rate μ−λ\mu - \lambda, so a request spends more than tt seconds in the system with probability e−(μ−λ)te^{-(\mu - \lambda) t}. At λ=9\lambda = 9, a request spends more than 3 s, thirty times its mean service time, with probability e−3≈0.050e^{-3} \approx 0.050: one request in 20. At λ=5\lambda = 5 the same probability is e−15≈3.1×10−7e^{-15} \approx 3.1 \times 10^{-7}.

Variability matters as much as load. Keep λ=9\lambda = 9 and μ=10\mu = 10, but let every service take exactly 0.1 s, which makes an M/D/1 queue. The Pollaczek–Khinchine formula stated below gives Wq=9×0.12/(2×(1−0.9))=0.09/0.2=0.45W_q = 9 \times 0.1^2 / (2 \times (1 - 0.9)) = 0.09 / 0.2 = 0.45 s, half the M/M/1 value. If arrivals also come exactly every 1/9≈0.1111/9 \approx 0.111 s, each request finishes 0.1 s after it arrives, before the next one comes, and Wq=0W_q = 0.

An average can hide an overload. Over one minute the arrival rate averages 5 per second, a utilization of 50%, but for 10 of those seconds requests arrive at 12 per second. During those 10 s the backlog grows by (12−10)×10=20(12 - 10) \times 10 = 20 requests, and a request that arrives at the end of the burst waits about 20×0.1=220 \times 0.1 = 2 s, twenty times its service time.

Stated precisely

The M/M/1 results rest on four assumptions.

  1. Arrivals form a Poisson process with rate λ\lambda: the gaps between consecutive arrivals are independent and exponentially distributed with mean 1/λ1/\lambda.

  2. Service times are independent and identically distributed §11.5, exponential with mean 1/μ1/\mu, and independent of the arrivals.

  3. There is one server, requests are served in FIFO order, and the buffer is unlimited.

  4. λ<μ\lambda < \mu, and the system is in its steady state, the long-run regime in which the probabilities below no longer change with time.

With ρ=λ/μ\rho = \lambda / \mu, the probability that exactly nn requests are in the system, waiting or in service, is πn=(1−ρ)ρn,n=0,1,2,…\pi_n = (1 - \rho)\, \rho^n, \qquad n = 0, 1, 2, \dots The mean number in the system is L=ρ/(1−ρ)L = \rho / (1 - \rho), the mean time in the system is W=1/(μ−λ)W = 1 / (\mu - \lambda), and the mean waiting time is Wq=W−1/μ=ρ/(μ−λ)W_q = W - 1/\mu = \rho / (\mu - \lambda). Little’s law §14.39, L=λWL = \lambda W, links the first two [88]: λ/(μ−λ)=ρ/(1−ρ)\lambda / (\mu - \lambda) = \rho / (1 - \rho). For λ=5\lambda = 5 and μ=10\mu = 10, ρ=0.5\rho = 0.5, so π0=0.5\pi_0 = 0.5, π1=0.25\pi_1 = 0.25, π2=0.125\pi_2 = 0.125, and L=0.5/0.5=1L = 0.5 / 0.5 = 1 request; then W=L/λ=1/5=0.2W = L / \lambda = 1/5 = 0.2 s, which matches 1/(10−5)1 / (10 - 5). The queueing chapter of Bertsekas and Gallager’s Data Networks derives these results.

For one server with Poisson arrivals and service times that are independent and identically distributed with any distribution (the M/G/1 queue), the Pollaczek–Khinchine formula gives Wq=λE[S2]2(1−ρ),W_q = \frac{\lambda\, \mathrm{E}[S^2]}{2 (1 - \rho)}, where SS is a service time and E[S2]\mathrm{E}[S^2] is the mean of its square. For exponential service, E[S2]=2/μ2\mathrm{E}[S^2] = 2/\mu^2, and the formula gives the M/M/1 value. For fixed service, E[S2]=1/μ2\mathrm{E}[S^2] = 1/\mu^2, and the waiting time is half as long. In every case the factor 1/(1−ρ)1/(1 - \rho) makes the mean waiting time grow without limit as ρ\rho approaches 1.

Limits and common mistakes

The formulas hold only under their assumptions. Real traffic is often more regular than a Poisson process (a sensor that reports once a second) or burstier (requests that come in groups), and service times are rarely exponential. Measured distributions, or a simulation driven by them, replace the model when its assumptions fail.

A long-run average utilization hides short overloads, as the one-minute example shows. A queue responds to the load in each short interval, not to the average over a long one.

A finite buffer, a bounded queue §9.31, caps the waiting time but turns the excess backlog into dropped or refused requests. Reporting only the delay of the requests that were served then hides the loss.

Priorities change who waits. High-priority requests wait less and low-priority requests wait more, possibly without limit, which is starvation §9.18. In FIFO order, one long request delays every request behind it, which is head-of-line blocking §9.19.

A mean delay gives no guarantee for any single request. A hard real-time system §6.34 needs a bound for every request, and that bound comes from a worst-case arrival pattern, for example one limited by a token bucket §19.4.1, from the worst-case execution time §9.33 of each task and from a schedulability §9.37 analysis, not from a mean.

Each queue on a request’s path adds its own delay. The waiting times in the queue of threads ready to run on a processor, in a driver’s buffer and in a radio’s transmit queue add up along the path.

Questions answered

Why can delay grow rapidly as utilization approaches capacity?

Delay grows rapidly because a queue drains only through spare capacity, and spare capacity shrinks to zero as utilization approaches capacity. Requests arrive irregularly and service times vary, so bursts build a backlog even when the average arrival rate λ\lambda is below the service rate μ\mu. The backlog drains at roughly μ−λ\mu - \lambda requests per second. At 90% utilization only a tenth of the server’s capacity is left to drain it, so new bursts arrive before old ones have cleared.

In the standard M/M/1 model (independent, exponentially distributed gaps between arrivals, exponentially distributed service times, one server) the mean waiting time is ρ/(1−ρ)\rho / (1 - \rho) times the mean service time, where ρ=λ/μ\rho = \lambda / \mu is the utilization: 1 times at 50%, 9 times at 90% and 99 times at 99%. The growth follows 1/(1−ρ)1 / (1 - \rho), not a straight line. More variable arrivals or service times make the delay larger still, while perfectly regular arrivals and service produce no waiting at any utilization below 1, so utilization alone does not determine the delay. These are mean values; they give no guarantee for any single request.

Related entries: Queue and FIFO (§14.14), Little’s law (§14.39), Availability (§1.10), Latency distribution and tail (§11.36), Bounded queue (§9.31), Response time versus execution time (§9.32). Further reading: [87, 88, 250].