You are on page 1of 5

Queueing

Theory Examples
Suppose we have a single server in a shop and customers arrive in
the shop with a Poisson arrival distribution at a mean rate of
lamda=0.5 customers per minute, i.e. on average one customer
appears every 1/lamda = 1/0.5 = 2 minutes. This implies that the
interarrival times have an exponential distribution with an average
interarrival time of 2 minutes. The server has an exponential
service time distribution with a mean service rate of 4 customers
per minute, i.e. the service rate =4 customers per minute. As we
have a Poisson arrival rate/exponential service time/single server
we have a M/M/1 queue in terms of the standard notation.
Lambda = 0.5 (customers per minute arrival)
Mu = 4 (customers per minute departure)
Rho = 0.5 / 4 = 0.125
(utilization)
Rho = lamba * Ts = 0.5 * 0.25 = 0.125
r = Rho/(1-Rho) = 0.125/(1-0.125) = 0.1429 (average number in
system)
w = Rho*Rho/(1-Rho) = 0.125*0.125/(1-0.125) = 0.179 (average
number in queue)
Tr = Ts/(1-Rho) = 0.25/(1-0.125) = 0.2857 min (average time in
system)
Tw = Rho * Ts/(1-Rho) = 0.125*0.25/(1-0.125) = 0.357 min
(average time waiting)
P0 = (1-Rho)*Rho^n = (1-0.125)*0.125^0 = 0.875 = 87.5%
(probability of zero in queue)
P1 = (1-Rho)*Rho^n = (1-0.125)*0.125^1 = 0.109 = 10.9%
(probability of 1 in queue)
What is probability of waiting?
Probability of waiting is probability of having 1 or more in the
queue.
All probs have to add to 1 so Prob of 1 or more = 1 Prob of zero
1 0.875 = 0.125 = 12.5%

What about serving twice as fast?


Lambda = 0.5 (customers per minute arrival)
Mu = 8 (customers per minute departure)
Rho = 0.5 / 8 = 0.0625
(utilization)
Rho = lamba * Ts = 0.5 * 0.125 = 0.0625
r = Rho/(1-Rho) = 0.0625/(1-0.0625) = 0.0667 (average number in
system)
w = Rho*Rho/(1-Rho) = 0. 0625*0. 0625/(1-0. 0625) = 0.0042
(average number in queue)
Tr = Ts/(1-Rho) = 0.125/(1-0. 0625) = 0.1333 min (average time in
system)
Tw = Rho * Ts/(1-Rho) = 0. 0625*0.125/(1-0.0625) = 0.0083 min
(average time waiting)
P0 = (1-Rho)*Rho^n = (1-0.0625)*0.0625^0 = 0.9375 = 93.75%
(probability of zero in queue)
P1 = (1-Rho)*Rho^n = (1-0.0625)*0.0625^1 = 0.0586 = 5.86%
(probability of 1 in queue)
What is probability of waiting?
Probability of waiting is probability of having 1 or more in the
queue.
All probs have to add to 1 so Prob of 1 or more = 1 Prob of zero
1 0.9375 = 0.0625 = 6.25%

What about an M/M/2 (2 servers rather than speeding up single


server)
Lamda = 0.5
Mu = 4 per minute (per server)
Rho = 0.5 / 8 = 0.0625
Rho = lamda * Ts / N = 0.5 * 0.25 / 2 = 0.0625
Need to calculate Erlang-C = (1-K)/(1- Rho * K)
Need to calculate K = A / B
A = sum(N*Rho)^i / i! for all i < N
B = sum(N*Rho)^i / i! for all i <= N
A = (2 * 0.0625)^0 / 0! + (2 * 0.0625)^1 / 1! = 1 + 2*0.0625 =
1.125
B = (2 * 0.0625)^0 / 0! + (2 * 0.0625)^1 / 1! + (2 * 0.0625)^2 / 2!
B = 1 + 0.125 + 0.0078 = 1.1328
K = A / B = 1.125 / 1.1328 = 0.9931441
Erlang-C = (1 0. 9931441)/(1 0.0625*0. 9931441) = 0.0068559
/ (1 0.06207) = 0. 0068559 / 0.93793 = 0.00731
Now
r = C * Rho/(1-Rho) + N*Rho = 0. 00731* 0.0625/(0.9375) + 2 *
0.0625 = 0.000487 + 0.125 = 0.1255 (number in system)
w = C * Rho/(1-Rho) = 0. 00731* 0.0625/(0.9375) = 0.0005
(number in queue)
Tw = C/N * Ts/(1-Rho) = 0. 00731/2 * 0.25/(0.9375) = 0.00097
min
Tr = Tw + Ts = 0.07878 + 0.25 = 0.25097

What about when we scale it up to 4 servers with 4 Queues?


Entry rate per queue changes but service time stays the same
4 M/M/1 Queues
lambda = 0.5/4 = 0.125
Mu = 4 per minute
Rho = 0.125 / 4 = 0.03125
Rho is also lamba * Ts = 0.125 * 0.25 = 0.03125
Tr = Ts/(1-Rho) = 0.25 / (1-0.03125) = 0.25 / 0.96875 = 0.258
Tw = Rho * Tr = 0.03125 * 0.258 = 0.0081

Versus
M/M/4
Lambda = 0.5
Mu = 4 per min per server = 4 * 4 = 16
Rho = 0.5/16 = 0.03125
Rho is also lambda * Ts / N = 0.5 * 0.25 / 4 = 0.03125
Need to calculate Erlang-C = (1-K)/(1- Rho * K)
Need to calculate K = A / B
A = sum(N*Rho)^i / i! for all i < N
B = sum(N*Rho)^i / i! for all i <= N
A = (4 * 0.03125)^0/0! + (4 * 0.03125)^1/1! + (4 * 0.03125)^2/2!
+ (4 * 0.03125)^3/3!
A = 1 + 0.125/1 + 0.125^2/2 + 0.125^3/6
A = 1 + 0.125 + 0.0078125 + 0.00032552 = 1.133138
B = A + 0.125^4/4! = 0.133138 + 0.125^4/24 = 1.133148
K = A / B = 1.133138 / 1.133148 = 0.99999118
Erlang-C = (1 0. 99999118)/(1 0. 03125*0. 99999118) =
0.00000882 / (1 0.03124972) = 0. 00000882 / 0.96875 =
0.0000091

Tw = C / N * Ts/(1-Rho) = 0. 0000091/ 4 * 0.25/ (1 0.03125)


Tw = 0.0.00000228 * 0.25 / 0.96875 = 0.00000059
Tr = Tw + Ts = 0.00000059 + 0.25 = 0.25000059
So
Stat

One server

Tw
Tr

0.357
0.2857

Tw
Tr

One server
twice as fast
0.0083
0.1333

1 Queue
2 servers
0. 00097
0. 25097

4 Queues
4 servers
0.0081
0.258

1 Queue
4 servers
0. 00000059
0. 25000059

You might also like