to be used in simulation radu tr^ mbit˘a˘smath.ubbcluj.ro/~tradu/queueing.pdf · queueing models...
TRANSCRIPT
Queueing Modelsto be used in Simulation
Radu Trımbitas
UBB
1st Semester 2011-2012
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 1 / 41
Purpose
Simulation is often used in the analysis of queueing models
A simple but typical queueing model:
Queueing models provide the analyst with a powerful tool fordesigning and evaluating the performance of queueing systems.
Typical measures of system performance:
Server utilization, length of waiting lines, and delays of customersFor relatively simple systems, compute mathematicallyFor realistic models of complex systems, simulation is usually required.
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 2 / 41
Outline
Discuss some well-known models (not development of queueing theories):
General characteristics of queues,
Meanings and relationships of important performance measures,
Estimation of mean measures of performance.
Effect of varying input parameters,
Mathematical solution of some basic queueing models.
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 3 / 41
Outline
Discuss some well-known models (not development of queueing theories):
General characteristics of queues,
Meanings and relationships of important performance measures,
Estimation of mean measures of performance.
Effect of varying input parameters,
Mathematical solution of some basic queueing models.
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 3 / 41
Outline
Discuss some well-known models (not development of queueing theories):
General characteristics of queues,
Meanings and relationships of important performance measures,
Estimation of mean measures of performance.
Effect of varying input parameters,
Mathematical solution of some basic queueing models.
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 3 / 41
Outline
Discuss some well-known models (not development of queueing theories):
General characteristics of queues,
Meanings and relationships of important performance measures,
Estimation of mean measures of performance.
Effect of varying input parameters,
Mathematical solution of some basic queueing models.
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 3 / 41
Outline
Discuss some well-known models (not development of queueing theories):
General characteristics of queues,
Meanings and relationships of important performance measures,
Estimation of mean measures of performance.
Effect of varying input parameters,
Mathematical solution of some basic queueing models.
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 3 / 41
Key elements of queueing systems
Key elements of queueing systems
Customer: refers to anything that arrives at a facility and requiresservice, e.g., people, machines, trucks, emails.Server: refers to any resource that provides the requested service, e.g.,repairpersons, retrieval machines, runways at airport.
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 4 / 41
Calling Population
Calling population: the population of potential customers, may beassumed to be finite or infinite.
Finite population model: if arrival rate depends on the number ofcustomers being served and waiting, e.g., model of one corporate jet, ifit is being repaired, the repair arrival rate becomes zero.Infinite population model: if arrival rate is not affected by the numberof customers being served and waiting, e.g., systems with largepopulation of potential customers.
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 5 / 41
System Capacity
System Capacity: a limit on the number of customers that may bein the waiting line or system.
Limited capacity, e.g., an automatic car wash only has room for 10 carsto wait in line to enter the mechanism.Unlimited capacity, e.g., concert ticket sales with no limit on thenumber of people allowed to wait to purchase tickets.
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 6 / 41
Arrival Processes - Infinite population models
In terms of interarrival times of successive customers.
Random arrivals: interarrival times usually characterized by aprobability distribution.
Most important model: Poisson arrival process (with rate λ), where An
represents the interarrival time between customer n− 1 and customern, and is exponentially distributed (with mean 1/λ).
Scheduled arrivals: interarrival times can be constant or constant plusor minus a small random amount to represent early or late arrivals.
e.g., patients to a physician or scheduled airline flight arrivals to anairport.
At least one customer is assumed to always be present, so the serveris never idle, e.g., sufficient raw material for a machine.
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 7 / 41
Arrival Processes - Finite population models
Customer is pending when the customer is outside the queueingsystem, e.g., machine-repair problem: a machine is “pending” when itis operating, it becomes “not pending” the instant it demands serviceform the repairman.Runtime of a customer is the length of time from departure from thequeueing system until that customer’s next arrival to the queue, e.g.,machine-repair problem, machines are customers and a runtime istime to failure.Let A
(i)1 , A
(i)2 , . . . be the successive runtimes of customer i , and S
(i)1 ,
S(i)2 , . . . be the corresponding successive system times:
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 8 / 41
Queue Behavior and Queue Discipline
Queue behavior: the actions of customers while in a queue waitingfor service to begin, for example:
Balk: leave when they see that the line is too long,Renege: leave after being in the line when it’s moving too slowly,Jockey: move from one line to a shorter line.
Queue discipline: the logical ordering of customers in a queue thatdetermines which customer is chosen for service when a serverbecomes free, for example:
First-in-first-out (FIFO)Last-in-first-out (LIFO)Service in random order (SIRO)Shortest processing time first (SPT)Service according to priority (PR).
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 9 / 41
Service Times and Service Mechanism
Service times of successive arrivals are denoted by S1, S2, S3.
May be constant or random.{S1,S2,S3, . . . } is usually characterized as a sequence of independentand identically distributed random variables, e.g., exponential, Weibull,gamma, lognormal, and truncated normal distribution.
A queueing system consists of a number of service centers andinterconnected queues.
Each service center consists of some number of servers, c , working inparallel, upon getting to the head of the line, a customer takes the 1st
available server.
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 10 / 41
Service Times and Service Mechanism II
Example: consider a discount warehouse where customers may:
Serve themselves before paying at the cashier:
Figure: Warehouse example
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 11 / 41
Service Times and Service Mechanism III
Wait for one of the three clerks:
Batch service (a server serving several customers simultaneously), orcustomer requires several servers simultaneously.
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 12 / 41
Queueing notation I
A notation system for parallel server queues: A/B/c/N/K , (due toKendall) where
A represents the interarrival-time distribution,
B represents the service-time distribution,
c represents the number of parallel servers,
N represents the system capacity,
K represents the size of the calling population.
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 13 / 41
Queueing notation II
Primary performance measures of queueing systems:
Pn: steady-state probability of having n customers in system,Pn(t): probability of n customers in system at time t,λ: arrival rate,λe : effective arrival rate,µ: service rate of one server,ρ: server utilization,An: interarrival time between customers n− 1 and n,Sn: service time of the nth arriving customer,Wn: total time spent in system by the nth arriving customer,WQ
n : total time spent in the waiting line by customer n,L(t): the number of customers in system at time t,LQ(t): the number of customers in queue at time t,L: long-run time-average number of customers in system,LQ : long-run time-average number of customers in queue,w : long-run average time spent in system per customer,wQ : long-run average time spent in queue per customer.
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 14 / 41
Time-Average Number in System L
Consider a queueing system over a period of time T ,
Let Ti denote the total time during [0,T ] in which the systemcontained exactly i customers, the time-weighted-average number ina system is defined by:
L =1
T
∞
∑i=1
iTi =∞
∑i=1
i
(Ti
T
)Consider the total area under the function is L(t), then,
L =1
T
∞
∑i=1
iTi =1
T
∫ T
0L(t)dt
The long-run time-average # in system, with probability 1:
L =1
T
∫ T
0L(t)dt → L as T → ∞
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 15 / 41
Time-Average Number in Queue
The time-weighted-average number in queue is:
LQ =1
T
∞
∑i=0
iTQi =
1
T
∫ T
0LQ(t)dt → LQ as T → ∞
G/G/1/N/K example: consider the results from the queueingsystem (N > 4, K > 3).
L = (0 · 3 + 1 · 12 + 2 · 4 + 3 · 1) /20
= 1.15 customers
LQ(t) =
{0, L(t) = 0L(t)− 1, L(t) ≥ 1
LQ(t) =0 · 15 + 1 · 4 + 2 · 1
20= 0.3 customers
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 16 / 41
Average Time Spent in System Per Customer
The average time spent in system per customer, called the averagesystem time, is:
w =1
N
N
∑i=1
Wi
where W1, W2, . . ., WN are the individual times that each of the Ncustomers spend in the system during [0,T ].
for stable systems w → w as N → ∞If the system under consideration is the queue alone:
wQ =1
N
N
∑i=1
WQi → wQ as N → ∞
G/G/1/N/K example (cont.): the average system time is
w =∑5
i=1 Wi
5=
2 + (8− 3) + · · ·+ (20− 16)
5= 4.6 time units
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 17 / 41
The Conservation Equation
Conservation equation (a.k.a. Little’s law)
L = λw
L = λw as T → ∞ and N → ∞
where L average # in system, λ arrival rate, w average system time
Holds for almost all queueing systems or subsystems (regardless of thenumber of servers, the queue discipline, or other specialcircumstances).
G/G/1/N/K example (cont.): On average, one arrival every 4 timeunits and each arrival spends 4.6 time units in the system. Hence, atan arbitrary point in time, there is (1/4)(4.6) = 1.15 customerspresent on average.
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 18 / 41
Server Utilization I
Definition: the proportion of time that a server is busy.
Observed server utilization, ρ, is defined over a specified time interval[0,T ].Long-run server utilization is ρ.For systems with long-run stability: ρ→ ρ as T → ∞
For G/G/1/∞/∞ queues:
Any single-server queueing system with average arrival rate λcustomers per time unit, where average service time E (S) = 1/µ timeunits, infinite queue capacity and calling population.Conservation equation, L = λw , can be applied.For a stable system, the average arrival rate to the server, λs , must beidentical to λ.The average number of customers in the server is:
Ls =1
T
∫ T
0(L(t)− LQ(t)) dt =
T − T0
T
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 19 / 41
Server Utilization II
In general, for a single-server queue:
Ls = ρ→ Ls = ρ as T → ∞
and
ρ = λE (s) =λ
µ< 1
For a single server stable queue
ρ =λ
µ< 1
For an unstable queue (λ > µ), long-run server utilization is 1.
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 20 / 41
Server Utilization III
For G/G/c/∞/∞ queues:
A system with c identical servers in parallel.
If an arriving customer finds more than one server idle, the customerchooses a server without favoring any particular server.
For systems in statistical equilibrium, the average number of busyservers, Ls , is: Ls = λE (s) = λ/µ.
The long-run average server utilization is:
ρ =Lsc
=λ
cµ, where λ < cµ for stable systems
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 21 / 41
Server Utilization and System Performance
System performance varies widely for a given utilization ρ.
For example, a D/D/1 queue with
E (A) = 1/λ
E (S) = 1/µ,
where:
L = ρ = λ/µ,w = E (S) = 1/µ, LQ = WQ = 0.
By varying λ and µ, server utilization can assume any value between 0and 1.Yet there is never any line.
In general, variability of interarrival and service times causes lines tofluctuate in length.
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 22 / 41
Server Utilization and System Performance
Example: A physician who schedules patients every 10 minutes and
spends Si minutes with the ith patient: Si =
(9 12
0.9 0.1
)Arrivals are deterministic, A1 = A2 = . . . = λ−1 = 10.Services are stochastic, E (Si ) = 9.3 min and V (S0) = 0.81 min2.On average, the physician’s utilization = ρ = λ/µ = 0.93 < 1.Consider the system is simulated with service times: S1 = 9,S2 = 12, S3 = 9, S4 = 9, S5 = 9, . . . . The system becomes:
The occurrence of a relatively long service time (S2 = 12) causes awaiting line to form temporarily.
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 23 / 41
Costs in Queueing Problems
Costs can be associated with various aspects of the waiting line orservers:System incurs a cost for each customer in the queue, say at a rate of$10 per hour per customer.
The average cost per customer is (WQj is the time customer j spends
in queue):N
∑j=1
$10 ·WQj
N= $10 · wQ
If λ customers per hour arrive (on average), the average cost per houris: (
λcustomer
hour
)( $10 · wQ
customer
)= $10 · λ · wQ = $10 · LQ/hour
Server may also impose costs on the system, if a group of c parallelservers (1 ≤ c ≤ ∞) have utilization r , each server imposes a cost of$5 per hour while busy.
The total server cost is: $5 · cρ.Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 24 / 41
Steady-State Behavior of Infinite-Population MarkovianModels I
Markovian models: exponential-distribution arrival process (meanarrival rate = λ).
Service times may be exponentially distributed as well (M) orarbitrary (G).
A queueing system is in statistical equilibrium if the probability thatthe system is in a given state is not time dependent:
P(L(t) = n) = Pn(t) = Pn.
Mathematical models in this chapter can be used to obtainapproximate results even when the model assumptions do not strictlyhold (as a rough guide).
Simulation can be used for more refined analysis (more faithfulrepresentation for complex systems).
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 25 / 41
Steady-State Behavior of Infinite-Population MarkovianModels II
For the simple model studied in this chapter, the steady-stateparameter, L, the time-average number of customers in the system is:
L =∞
∑n=0
nPn
Apply Little’s equation to the whole system and to the queue alone:
w =L
λ, wQ = w − 1
µ, LQ = λwQ
G/G/c/∞/∞ example: to have a statistical equilibrium, a necessaryand sufficient condition is λ/cµ < 1.
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 26 / 41
M/G/1 Queues
Single-server queues with Poisson arrivals & unlimited capacity.
Suppose service times have mean 1/µ and variance σ2 andρ = λ/µ < 1, the steady-state parameters of M/G/1 queue:
ρ =λ
µ, P0 = 1− ρ
L = ρ +ρ2(1 + σ2µ2
)2 (1− ρ)
, LQ =ρ2(1 + σ2µ2
)2 (1− ρ)
w =1
µ+
λ
(1
µ2+ σ2
)2 (1− ρ)
, wQ =
λ
(1
µ2+ σ2
)2 (1− ρ)
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 27 / 41
M/G/1 Queues II
No simple expression for the steady-state probabilities P0, P1, . . .L− LQ = ρ is the time-average number of customers being served.
Average length of queue, LQ , can be rewritten as:
LQ =ρ2
2 (1− ρ)+
λ2σ2
2 (1− ρ)
If λ and µ are held constant, LQ depends on the variability, σ2, of theservice times.
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 28 / 41
M/G/1 Queues - Example
Two workers competing for a job, Able claims to be faster than Bakeron average, but Baker claims to be more consistent,Poisson arrivals at rate λ = 2 per hour (1/30 per minute).Able: 1/µ = 24 minutes and σ2 = 202 = 400 minutes2:
LQ =(1/30)2 (242 + 400
)2(1− 4
5
) = 2. 7111 customers
The proportion of arrivals who find Able idle and thus experience nodelay is P0 = 1− ρ = 1/5 = 20%.Baker: 1/µ = 25 minutes and σ2 = 22 = 4 minutes2:
LQ =(1/30)2 (252 + 4
)2(1− 5
6
) = 2. 0967 customers
The proportion of arrivals who find Baker idle and thus experience nodelay is P0 = 1− ρ = 1/6 = 16.7%.Although working faster on average, Able’s greater service variabilityresults in an average queue length about 30% greater than Baker’s.
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 29 / 41
M/M/1 Queues I
Suppose the service times in an M/G/1 queue are exponentiallydistributed with mean 1
µ , then the variance is σ2 = 1µ2 .
M/M/1 queue is a useful approximate model when service timeshave standard deviation approximately equal to their means.
The steady-state parameters:
ρ =λ
µ,
Pn = ρ (1− ρ)n
L =λ
µ− λ=
ρ
1− ρ, LQ =
λ2
µ (µ− λ)=
ρ2
1− ρ
w =1
µ− λ=
1
µ (1− ρ), wQ =
λ
µ (µ− λ)=
ρ
µ (1− ρ)
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 30 / 41
M/M/1 Queues II
Example: M/M/1 queue with service rate µ = 10 customers perhour.
Consider how L and w increase as arrival rate, λ, increases from 5 to8.64 by increments of 20%:
If λ/µ ≥ 1, waiting lines tend to continually grow in length.λ 5 6 7.2 8.64 10
ρ 0.5 0.6 0.72 0.864 1.000L 1 1.5 2.57 6.35 ∞w 0.2 0.25 0.36 0.73 ∞
Increase in average system time, w , and average number in system, L,is highly nonlinear as a function of ρ
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 31 / 41
Effect of Utilization and Service Variability
For almost all queues, if lines are too long, they can be reduced bydecreasing server utilization (ρ) or by decreasing the service timevariability (σ2).
A measure of the variability of a distribution, coefficient of variation(cv):
cv =V (X )
E (X )2
The larger cv is, the more variable is the distribution relative to itsexpected value
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 32 / 41
Effect of Utilization and Service Variability II
Consider LQ for any M/G/1 queue:
LQ =ρ2(1 + σ2µ2
)2 (1− ρ)
=ρ2
(1− ρ)
(1 + (cv)2
2
)
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 33 / 41
Multiserver Queue
Other common multiserver queueing models:
M/G/c/∞: general service times and c parallel server. Theparameters can be approximated from those of the M/M/c/∞/∞model.
M/G/∞: general service times and infinite number of servers, e.g.,customer is its own system, service capacity far exceeds servicedemand.
M/M/C/N/∞: service times are exponentially distributed at rate mand c servers where the total system capacity is N ≥ c customer(when an arrival occurs and the system is full, that arrival is turnedaway).
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 34 / 41
Steady-State Behavior of Finite-Population Models I
When the calling population is small, the presence of one or morecustomers in the system has a strong effect on the distribution offuture arrivals.
Consider a finite-calling population model with K customers(M/M/c/K/K ):
The time between the end of one service visit and the next call forservice is exponentially distributed, (mean = 1/λ).
Service times are also exponentially distributed.
c parallel servers and system capacity is K .
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 35 / 41
Steady-State Behavior of Finite-Population Models II
Some of the steady-state probabilities:
P0 =
[c−1
∑n=0
(K
n
)(λ
µ
)n
+K
∑n=c
K !(K − n)!c !cn−c
(λ
µ
)n]−1
Pn =
(K
n
)(λ
µ
)n
P0, n = 0, 1, . . . , c − 1
K !(K − n)!c !cn−c
(λ
µ
)n
, n = c , c + 1, . . . ,K
L =K
∑n=0
nPn, w =L
λe, ρ =
λe
cµ
where λe is the long run effective arrival rate of customers to queue(or entering/exiting service)
λe =K
∑n=0
(K − n) λPn
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 36 / 41
Steady-State Behavior of Finite-Population Models III
Example: two workers who are responsible for 10 milling machines.
Machines run on the average for 20 minutes, then require an average5-minute service period, both times exponentially distributed:λ = 1/20 and µ = 1/5.All of the performance measures depend on P0:
P0 =
[2−1
∑n=0
(10
n
)(1
4
)n
+10
∑n=2
10!(10− n)!2!2n−2
(1
4
)n]−1
= 0.0647
Then, we can obtain the other Pn.Expected number of machines in system:
L =10
∑n=0
nPn = 3.17 machines
The average number of running machines:
K − L = 10− 3.17 = 6.83 machines
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 37 / 41
Networks of Queues I
Many systems are naturally modeled as networks of single queues:customers departing from one queue may be routed to another.
The following results assume a stable system with infinite callingpopulation and no limit on system capacity:
Provided that no customers are created or destroyed in the queue, thenthe departure rate out of a queue is the same as the arrival rate intothe queue (over the long run).If customers arrive to queue i at rate λi , and a fraction 0 ≤ pij ≤ 1 ofthem are routed to queue j upon departure, then the arrival rate fromqueue i to queue j is λipij (over the long run).
The overall arrival rate into queue j :
λj = aj + ∑i
λipij
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 38 / 41
Networks of Queues II
If queue j has cj < ∞ parallel servers, each working at rate µj , then
the long-run utilization of each server is ρj =λj
cµj(where ρj < 1 for
stable queue).
If arrivals from outside the network form a Poisson process with rateaj for each queue j , and if there are cj identical servers deliveringexponentially distributed service times with mean 1/µj , then, insteady state, queue j behaves likes an M/M/cj queue with arrivalrate
λj = aj + ∑i
λipij
Discount store example: see Figure 1
Suppose customers arrive at the rate 80 per hour and 40% chooseself-service. Hence:
Arrival rate to service center 1 is λ1 = 80(0.4) = 32 per hourArrival rate to service center 2 is λ2 = 80(0.6) = 48 per hour.
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 39 / 41
Networks of Queues III
c2 = 3 clerks and µ2 = 20 customers per hour.
The long-run utilization of the clerks is:
ρ2 = 48/(3 ∗ 20) = 0.8
All customers must see the cashier at service center 3, the overall rateto service center 3 is λ3 = λ1 + λ2 = 80 per hour.
If µ3 = 90 per hour, then the utilization of the cashier is:ρ3 = 80/90 = 0.89
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 40 / 41
Summary
Introduced basic concepts of queueing models.
Show how simulation, and some times mathematical analysis, can beused to estimate the performance measures of a system.
Commonly used performance measures: L, LQ , w , wQ , ρ, and λe .
When simulating any system that evolves over time, analyst mustdecide whether to study transient behavior or steady-state behavior.
Simple formulas exist for the steady-state behavior of some queues.
Simple models can be solved mathematically, and can be useful inproviding a rough estimate of a performance measure.
Radu Trımbitas (UBB) Queueing Models 1st Semester 2011-2012 41 / 41