# Analytic Queueing Theory - Examples

Text: Chapters 30--36.

## Birth-death process

Definition of steady state: dp_j(t) / dt = 0.

Then

• \lambda_j-1 p_j-1(t) + \mu_j+1 p_j+1(t) - (\lambda_j + \mu_j) p_j(t) = 0

Solve this iteratively

1. l0 p0 = m1 p1 => p1 = (l0/m1) p0
2. (l1 + m1) p1 = l0 p0 + m2 p2 => (l1 + m1) (l0/m1) p0 = l0 p0 + m2 p2 => p2 = p0 (l1*l0 / m1*m0)
3. ...
4. pn = p0 (l_n-1*...*l1*l0 / m_n-1 *...*m1*m0)
5. Set p0 by the condition sum_n pn = 1.

This looks like you could solve it further, but you can't. How could you possibly solve the differential equation above, in that case?

What do we do? Try simplified examples.

#### The Simplest Example M/M/1

First M: Markovian (Exponential) birth (interarrival) times

Second M: Markovian (Exponential) life/death (service) times

1: one server

Assumptions:

1. \lambda_j = \lambda
2. \mu_j = \mu
3. Define r = \lambda / \mu

Then

1. pn = r^n p0
2. p0 = 1 / (1 + r + r^2 + ...) = 1 - r.
3. pn = (1 - r) * r^n.

The mean number of jobs in the system is E(r) = sum_n n * (1 - r ) * r^n = r / (1 - r)

• Goes to infinity as r -> 1. Why?

Little's law

• Mean response time: E(r) = (1/\lambda) * E(n) = 1 / (\mu - \lambda) = 1 / (\mu (1-r))
• Goes to infinity as \lambda -> \mu from below. Why?
• What happens when \lambda > \mu?

Mean waiting time E[w]

1. Mean service time is 1/\mu
2. Mean waiting time is E[w] = E[r] - 1/\mu = r / ( \mu (1-r) )

Mean number of jobs in the queue E[nq]

1. Little's law applied to the queue - \lambda*E[w] = E[nq]
2. W[nq] = r^2 / (1-p)

Utilization

1. U = 1 - p0 = 1 - (1-r) = r = \lambda / \mu

#### Another Example: M/M/2 & M/M/m

As above, but with 2 & m servers

Stability

1. 2 servers
1. U = U1 + U2
2. Uj = number processed on server j = \sum_(jobs on j) xj
• xj = processing time for j
3. Therefore, U = (1/L) sum_j xj = (n/L) (1/n) \sum_j x_j = \lambda / \mu.
4. U1 < 1 & U2 < 1 => U < 2.
5. Stable if \lambda / \mu < 2 => \lambda / (2 \mu) < 1
6. r = \lambda / (2 \mu) is called the traffic intensity
2. m servers

The same argument, but

• U < m
• r = \lambda / (m \mu)
• r < 1

Performance

Two servers

j  =   0  1  2  3  ...
lj =   l  l  l  l  ...
mj =      m 2m 2m  ...

Write down the equations and aolve them

1. p1 = 2r p0
2. p2 = r p1 = 2r^2 p0
3. p3 = r p2 = 2r^3 p0
4. pn = 2r^n p0

p0 (1 + 2r + 2r^2 + 2r^3 + ...) = 1 => p0 = (1 + 2 \sum_j r^j)^(-1) = (1 + 2r / (1-r)) = (1-r) / (1+r)

Average number in system

• E[n] = \sum n pn = 2p0 \sum n r^n = 2p0 * r / (1-r)^2 = 2r / (1-r)^2 * (1-r) / (1+r) = 2r / (1-r^2)

Average response time

• E[r] = (1/l) E[n] = 1/ (m (1-r^2))

Compare this result to two independent servers where reponse time is 1/(m(1-r/2)

k servers

j  =   0  1  2  3  4  ... k   k+1   k+2   ...
lj =   l  l  l  l  l  ... l    l     l    ...
mj =      m 2m 3m 4m  ...km    km    km   ...

Write down the equations and solve them

1. p1 = 2r p0
2. p2 = r p1 = 2*3r^2 p0
3. p3 = r p2 = 2*3*4r^3 p0
4. pn = (n+1)!!r^n p0 for n < k and pn = k!r^n p0 for n > k

This will put you summing powers to the test!

p0 (1 + 2r + 6r^2 + 24r^3 + ... + k!r^k + ...) = 1 => p0 = (1 + 2 \sum_j r^j)^(-1) = (1 + 2r / (1-r)) = (1-r) / (1+r)

Average number in system

• E[n] = \sum n pn = 2p0 \sum n r^n = 2p0 * r / (1-r)^2 = 2r / (1-r)^2 * (1-r) / (1+r) = 2r / (1-r^2)

Average response time

• E[r] = (1/l) E[n] = 1/ (m (1-r^2))

Compare this result to two independent servers where reponse time is 1/(m(1-r/2)