12
The shortest queue problem
Ivo Adan
March 19, 2002
JJ J N I II
/k
1/40
12
queue 1
µ
λ
queue 2
join the
shortest queue
µ
Where:
• Poisson arrivals with rate λ
• Exponential service times with mean 1/µ
JJ J N I II
/k
2/40
12
queue 1
µ
λ
queue 2
randomly
assign
µ
Variants:
• Randomly assign customers, with probability 1/2 to either queue
• Randomly assign customers and ‘social servers’: when the queue is
empty, the server will serve a customer in the other queue
JJ J N I II
/k
3/40
12
Join the shortest queue
Markov proces with states (i, j) where
i = length of queue 1
j = length of queue 2
Transition rate diagram: (symmetric in the diagonal)
j
•
•
•
•
•
λ•
•
•
•
•
•
•
µ
•
•
λ
µ
•
•
•
•
λ•
•
µ
•
µ
•
λ
•
•
•
•
•
•
i
JJ J N I II
/k
4/40
12
Exploit the symmetry by using the state description (m, n) where
m = length of the shortest queue
n = difference between the length of the longest and shortest queue
Transition rate diagram:
n
µ
µ
λ
λ
µ
2µ
λ
λ
m
JJ J N I II
/k
5/40
12
Randomly assign with probability 1/2
Markov proces with states (m, n) where
m = length of queue 1
n = length of queue 2
Transition rate diagram:
n
λ /2
λ /2
λ /2
µ
λ /2
µ
µ
λ /2
λ /2
λ /2
JJ J N I II
µ
λ /2
m
/k
6/40
12
Randomly assign and social servers
Markov proces with states (m, n) where
m = length of queue 1
n = length of queue 2
Transition rate diagram:
n
λ /2
λ /2
λ /2
µ
λ /2
2µ
µ
λ /2
λ /2
λ /2
JJ J N I II
2µ
λ /2
m
/k
7/40
12
Equilibrium distribution
Let p(m, n) be the equilibrium probability of state (m, n).
They are the unique normalized solution of the balance equations.
Balance equations for the shortest queue problem (flow out = flow in):
p(m, n)(λ + 2µ) = p(m − 1, n + 1)λ + p(m, n + 1)µ + p(m + 1, n − 1)µ
m > 0, n > 1;
p(0, n)(λ + µ) = p(0, n + 1) + p(1, n − 1)
n > 1;
p(0, 1)(λ + µ) = p(0, 2) + p(1, 0) + p(0, 0)λ
p(m, 1)(λ + 2µ) = p(m − 1, 2)λ + p(m, 2)µ + p(m + 1, 0)2µ + p(m, 0)λ
m > 0;
p(m, 0)(λ + 2µ) = p(m − 1, 1)λ + p(m, 1)µ
m > 0;
p(0, 0)λ = p(1, 0)µ
JJ J N I II
/k
8/40
12
Methods to solve the balance equations:
• Generating function methods
P (x, y) =
∞ X
∞
X
p(m, n)xmy m
n=0 m=0
Transform the balance equations into a functional equation for P (x, y)
and solve this equation.
• Separation of variables
Try to find a solution in the form of a sum of product-form solutions.
JJ J N I II
/k
9/40
12
Sums of product forms as a solution
Is this always possible?
If not, under which conditions?
And how are we going to find these product forms?
Three directions:
1. Exactly one product form as solution
2. Finite sum of product forms as solution
3. Infinite sum of product forms as solution
JJ J N I II
/k
10/40
12
Exactly one product form as solution
Example: Randomly assign with probability 1/2
Try as solution
p(m, n) = Cαmβ n
Substitution into the balance equations yields
p(m, n) = Cρmρn,
m, n ≥ 0,
where ρ = λ/2µ and C is the normalizing constant,
C = (1 − ρ)(1 − ρ).
This direction has been systematically investigated
and generalized to complex networks of queues.
Severe conditions, but independent of the dimension of the state space.
JJ J N I II
/k
11/40
12
Infinite sums of product forms as solution
Example: The shortest queue problem
Idea: First construct a set of products αm β n satisfying the balance equations
in the interior points (m, n) with m > 0 and n > 1.
Then use this set of product forms to construct a linear combination
p(m, n) =
∞
X
ciαimβin
i=0
that also satisfies the boundary equations.
JJ J N I II
/k
12/40
12
Set of products satisfying the inner conditions
Recall that for m > 0 and n > 1
p(m, n)(λ + 2µ) = p(m − 1, n + 1)λ + p(m, n + 1)µ + p(m + 1, n − 1)µ
Substitution of p(m, n) = αm β n yields
αmβ n(λ + 2µ) = αm−1β n+1λ + αmβ n+1µ + αm+1β n−1µ
Dividing by common powers αm−1 β n−1 leads to the quadratic equation
αβ(λ + 2µ) = β 2λ + αβ 2µ + α2µ
JJ J N I II
/k
13/40
12
A continuum of solutions
β
1. 2
1
α
1
2
Question:
How do we select solutions from this set?
This selection is based on a compensation argument.
JJ J N I II
/k
14/40
12
Intermezzo: A potential problem
∆Φ = 0
a
A
•
α0
Φ = Φa
•
α1
c
b
•
β0
•
B
Φ=0
Determine the potential Φ outside the spheres A and B
Solution by means of the Method of Images (1850):
Start with a point charge α0 = aΦa in the center of sphere A
(correct if c = ∞)
Subsequently (and alternatingly) add point charges in the two spheres to
correct for the potentials on the spheres A and B
JJ J N I II
/k
15/40
12
Initial solution
p(m, n) = α0mβ0n,
m ≥ 0, n > 0
where
2
α0 = ρ ,
ρ2
β0 =
2+ρ
and
ρ=
λ
2µ
The initial solution satisfies the balance equations in the interior of the state
space and the balance equations on the horizontal boundary (n = 1).
But it violates the vertical boundary conditions (m = 0).
JJ J N I II
/k
16/40
12
Compensation on the vertical boundary
Add a term c1 αm β n with α and β satisfying the quadratic equation,
and try to choose c1 , α, β such that the sum
α0mβ0n + c1αmβ n
satisfies the vertical boundary conditions.
Substitution of this sum into the balance equations for m = 0,
p(0, n)(λ + µ) = p(0, n + 1) + p(1, n − 1)
yields
(β0n + c1β n)(λ + µ) = β0n+1 + c1β n+1 + α0β0n−1 + c1αβ n−1
This should hold for all n > 1, and thus
β = β0
and α = α1 is the companion root of α0 of the quadratic eq. with β = β0 .
The coefficient c1 can now be determined from the equation above.
JJ J N I II
/k
17/40
12
Conclusion:
Let α1 and α0 be the roots of the quadratic equation for fixed β = β0 .
Then the linear combination
c0α0mβ0n + c1α1mβ0n
satisfies the inner conditions and the vertical boundary conditions if
c1 = −
α1 − β0
c0
α0 − β0
Hence we can choose c1 such that the sum
α0mβ0n + c1α1mβ0n
satisfies the vertical boundary conditions.
However, the new term c1 α1m β0n violates the horizontal boundary conditions.
Therefore we add again a term to correct for this error.
JJ J N I II
/k
18/40
12
Compensation on the horizontal boundary
Add a term d1 αm β n with α and β satisfying the quadratic equation,
and try to choose d1 , α, β such that the sum
c1α1mβ0n + d1αmβ n
satisfies the horizontal boundary conditions.
This yields
α = α1
and β = β1 is the companion root of β0 of the quadratic eq. with α = α1 .
The coefficient d1 is given by
d1 = −
(α1 + ρ)/β1 − (ρ + 1)
c1
(α1 + ρ)/β0 − (ρ + 1)
But the new term d1 α1m β1n violates the vertical boundary conditions, so we
add again a term and so on...
JJ J N I II
/k
19/40
12
Procedure:
p(m, n) = α0mβ0n
β
1. 2
1
β0
β1
α1
JJ J N I II
α0
α
1
2
/k
20/40
12
Procedure:
p(m, n) = α0mβ0n + c1α1mβ0n
β
1. 2
1
β0
β1
α1
JJ J N I II
α0
α
1
2
/k
21/40
12
Procedure:
p(m, n) = α0mβ0n + c1α1mβ0n + d1α1mβ1n
β
1. 2
1
β0
β1
α1
JJ J N I II
α0
α
1
2
/k
22/40
12
Procedure:
p(m, n) = α0mβ0n + c1α1mβ0n + d1α1mβ1n + c2α2mβ1n + · · ·
β
1. 2
1
β0
β1
α1
JJ J N I II
α0
α
1
2
/k
23/40
12
Result:
For all m ≥ 0, n > 0,
p(m, n) = C
α0mβ0n +
∞
X
!
n
(ciαimβin + diαimβi+1
) ,
i=1
where C is the normalizing constant.
Remarks:
• The infinite sum converges very fast
• Error bounds
• Similar expressions for performance characteristics,
such as the mean length of the shortest queue:
E(L) = C
JJ J N I II
α0
β0n +
1 − α0
∞
X
i=1
n
(ciβin + diβi+1
)
/k
αi
1 − αi
!
24/40
12
Generalization:
n
v 0,1
v 1,1
q −1,1
q 0,1
q 1,1
v 1,0
q −1,0
v 0,−1
v 1,−1
q −1,−1
q 0,−1
q 1,−1
r 0,1
r 1,1
h−1,1
h0,1
h1,1
r 1,0
h−1,0
q 1,0
h1,0
m
Equilibrium probabilities p(m, n) can be expressed as an infinite sum of
product forms if in the interior of the state space no transitions are possible
to the North, North-East and East
Extension to higher dimensions, but the conditions become more severe.
JJ J N I II
/k
25/40
12
Example: Randomly assign and social servers
β
1. 2
β1
β0
α0
α1
α
1. 2
There is no solution in the form of a single product form
Infinitely many solutions in the form of a sum of four product forms,
but none of them can be normalized.
An explicit expression is known for the generating function.
JJ J N I II
/k
26/40
12
Mean sojourn time as a function of the workload ρ (for µ = 1)
20
random
round robin
shortest queue
central buffer
18
16
14
12
10
8
6
4
2
0
0.5
0.55
JJ J N I II
0.6
0.65
0.7
0.75
0.8
0.85
0.9
/k
0.95
27/40
12
Bounds for the mean waiting time
A systematic approach for the construction of bounds
for the average costs in Markov chains.
Strength of the approach:
It works for high dimensional systems (many queues)
JJ J N I II
/k
28/40
12
Join the shortest queue
Markov proces with states (m1 , m2 ) where
m1 = length of the shortest queue
m2 = length of the longest queue
Transition rate diagram:
m2
•
•
•
•
•
λ•
•
•
•
•
•
•
µ
•
•
λ
µ
•
•
•
•
λ•
•
µ
2µ
•
•
λ
•
•
•
•
•
•
m1
JJ J N I II
/k
29/40
12
Costs
Cost rate in state (m1 , m2 ): the total number of waiting customers in the
system
c(m1, m2) = max{m1 − 1, 0} + max{m2 − 1, 0}
Then the average costs are
g =
X
c(m1, m2)p(m1, m2)
(m1 ,m2 )
= Mean number of waiting customers in the system
and by Little’s law,
g
= Mean waiting time
λ
JJ J N I II
/k
30/40
12
Step 1: From continuous to discrete time
First uniformize the transition rates: add fictitious rates µ in states (0, m2 ).
Assume λ + 2µ = 1, and interpret rates as transition probabilities.
Transition probability diagram:
m2
µ
µ
λ
λ
µ
λ
2µ
µ
2µ
λ
m1
JJ J N I II
/k
31/40
12
This Markov chain has the same distribution as the Markov process.
If c(m1 , m2 ) is the cost per period,
then this Markov chain also has the same average costs g .
From now on consider the Markov chain.
JJ J N I II
/k
32/40
12
Step 2: Identify precedence relations
State (m1 , m2 ) has precedence over (is more attractive than) state (n1 , n2 ) if:
vt(m1, m2) ≤ vt(n1, n2),
t = 0, 1, 2, . . .
where vt (m1 , m2 ) is the expected total cost in the first t periods,
when starting in state (m1 , m2 ).
In this model it is intuitively clear that (m1 , m2 ) has precedence over
its neighbors (m1 + 1, m2 ), (m1 , m2 + 1) and (m1 − 1, m2 + 1).
This means it is preferable to have less customers in the system and more
balance in queue lengths.
JJ J N I II
/k
33/40
12
Precedence relations
m2
m1
JJ J N I II
/k
34/40
12
Sketch of proof:
vt(m1, m2) ≤ vt(m1, m2 + 1),
0 < m1 < m2 .
By induction
• v0(m1, m2) = v0(m1, m2 + 1) = 0
• Assume it holds for n.
vt+1(m1, m2) = c(m1, m2) + λvt(m1 + 1, m2)
+µvt(m1 − 1, m2) + µvt(m1, m2 − 1)
vt+1(m1, m2 + 1) = c(m1, m2 + 1) + λvt(m1 + 1, m2 + 1)
+µvt(m1 − 1, m2 + 1) + µvt(m1, m2)
The corresponding terms at the right-hand side are ordered as desired
by the induction hypothesis (e.g., vt (m1 + 1, m2 ) ≤ vt (m1 + 1, m2 + 1)).
So
vt+1(m1, m2) ≤ vt+1(m1, m2 + 1)
JJ J N I II
/k
35/40
12
Step 3: Construction of bounds
Modify the original chain by redirecting in some states (m1 , m2 ) one or more
transitions.
Redirecting a transition from (n1 , n2 ) to (k1 , k2 ) means:
the new transition probability to (n1 , n2 ) is zero, the one to (k1 , k2 ) is
increased by the original transition probability from (m1 , m2 ) to (n1 , n2 ).
Result:
If the modified chain is obtained by redirecting to more attractive states, then
the expected t-period cost vector is less than the one in the original chain
(proof by induction). Hence, if ‘ ˜ ’ refers to the modified chain, then
1
1
g̃ = lim ṽt(m1, m2) ≤ lim vt(m1, m2) = g
t→∞ t
t→∞ t
(symmetrical result holds for redirection to less attractive states)
JJ J N I II
/k
36/40
12
m2
m2
m2
µ
µ
µ
µ
µ
λ
m1
Two Finite Buffers
m2
µ
Central Buffer
m2
m1
µ
λ
m1
Threshold Jockeying
µ
m2
µ
µ
λ
µ
µ
λ
µ
µ
m1
One Infinite Buffer
JJ J N I II
m1
Threshold Killing
m1
Threshold Blocking
/k
37/40
12
Observations:
• Most modified models have a state space in the form of a semi-infinite
strip. They can be efficiently solved by matrix-geometric techniques.
• The size of the state space is controlled by a threshold (truncation) parameter. The larger this threshold, the more accurate the bound, but
also the more effort it takes to compute it.
• Some modifications exploit the fact that most of the probability mass is
concentrated around the diagonal.
• For suitably defined cost functions c(m1, m2) bounds can be obtained
for other performance measures, such as the mean or distribution of
the length of the shortest queue.
JJ J N I II
/k
38/40
12
Differences of the bounds and the true mean waiting time (4.75) for ρ = 0.9
and different values of the threshold T :
T
1
2
3
4
5
6
7
8
FB
-4.475
-4.096
-3.682
-3.285
-2.916
-2.577
-2.269
-1.991
CB
-0.212
-0.093
-0.040
-0.018
-0.008
-0.003
-0.001
-0.001
TJ
OIB
TK
TB
-0.212
∞ -3.420
∞
-0.093 18.000 -1.844 25.719
-0.037 2.261 -0.761 1.500
-0.013 0.738 -0.263 0.349
-0.005 0.288 -0.083 0.096
-0.002
0.121 -0.025 0.028
-0.001 0.052 -0.008 0.008
-0.000 0.023 -0.002 0.002
Note: In the table lists the mean normalized waiting time,
i.e., mean waiting time divided by mean service time.
JJ J N I II
/k
39/40
12
Differences of the bounds and the true mean waiting time for T = 3 and
different values of ρ:
ρ
W
0.2
0.066
0.4
0.259
0.6
0.682
0.8
1.956
0.9
4.475
0.95
9.487
0.98 24.494
0.99 49.497
JJ J N I II
FB
-0.000
-0.019
-0.198
-1.246
-3.682
-8.661
-23.653
-48.650
CB
-0.000
-0.001
-0.007
-0.025
-0.040
-0.051
-0.057
-0.060
TJ
OIB
TK
TB
-0.000 0.000 -0.000 0.000
-0.001 0.001 -0.001 0.001
-0.006 0.023 -0.016 0.017
-0.022 0.309 -0.153 0.227
-0.037 2.261 -0.761 1.500
-0.046 23.842 -2.909 10.345
-0.053
∞ -13.125
∞
-0.055
∞ -34.685
∞
/k
40/40
© Copyright 2025 Paperzz