Queueing Theory
Dec 22, 2015
Queueing Theory
Overview
• Introduction• Basic Queue Properties– Kendall Notation– Little’s Law
• Stochastic Processes– Birth-Death Process– Markov Process
• Queueing Models
Why Queueing Theory
• Mathematical properties of lines or “queues”• Useful to understand delays and congestions in
computer networks– Tool for packet switched networks– Limited service/processing capability– Probabilistic arrivals
Server
Customers(Arrivals)
Queue
Example Queueing System
Departures
Analysis
• Analysis of the queue can help identify numerous transient and steady state properties about the system, including– # of customers in system/queue– Response time – Wait time– Utilization – Throughput
Queue Properties
• Arrival process – The rate and distribution that customers arrive to
the system• Service patterns– The rate and distribution at which the system can
process customers• Number of servers• Queueing discipline– First in-First out, Last in-first out, Round Robin
Queue System Notation
• Kendal Notation
A/B/X/Y/Z
Interarrival time distribution M – Exponential D – Deterministic G – General
Service time distribution M – Exponential D – Deterministic G – General
# of parallel service channels
Capacity of the System(Default = infinite)
Queue disciplineFIFO – First in first outLIFO – Last in first outRSS – Random selection of serviceGD – General discipline(Default = FIFO)
Queue Performance Parameters
Server
QueueDepartures
Arrival rate (λ)
T – Time in system, W = E[T]
Tq – Time in queue (Wq = E[Tq])
S – Service time (1/μ = E[S])
L – avg. # customers in system
Ns – # customers in serviceNq – # customers in queue
N – # customers in system
Time in the system
# customers insystemLq – avg. # customers in queue
Queue Stability
• μ – service rate• λ – arrival rate• λ/μ - traffic intensity – λ/μ < 1 for stable queue• λ/μ = .1 – light load• λ/μ = .5 – moderate load• λ/μ = .9 – heavy load
Little’s Law
• Intuitively, longer service times equals longer queues– Examples
• Traffic jams occur with accidents, bad weather• Jimmy John’s has less seating than Zoe’s
• Average number of customers in a queueing system equals the arrival rate of new customers times the customer service rate
Little’s Law
• Your computer networking professor receives 30 emails per day, on average he has 15 unchecked messages, how long until he responds to your email? – L= λW– W = L/λ = 15/30 = .5 day
• A switch receives 100 packets every second, the switch can process each packet in 8ms, what’s the number of packets in system?
• L = λ/W • L= 100 pps x .008sec = 8 packets
Little’s Law Derivation
Show: • LT = WNc
– Nc/T – arrival rate
4
3
2
1
N
Time
t1 t2 t3 t4 t5 t6 t7 T
G/G/c General Properties
• Useful Equations (c = number of servers):
• L = λW [Little’s Law (also Lq = λWq)]
• r = λ/μ [work load rate]
• ρ = λ/cμ [utilization/traffic intensity]
• p0 = 1 – ρ [probability system is empty]
Utilization vs Queueing Delay
Utilization [ρ = λ/μ]
Avg. Queuing Delay [W = 1/(μ-λ)]
Can’t fully utilize network without long delays!!!!
Stochastic Processes
Stochastic Process
• Probability process that takes random values, X(t)=x(t1),…,x(tn) for times t1,….,tn
• Can be– Discrete-time• T = {0, 1, 2, ….}• Example: coin flip
– Continuous-time• T = {0< t < ∞}• Example: stock market, weather
Probability Review
• Bernoulli trial– Random experiment with only two outcomes– Example, flip of coin (heads and tails)• If I flip 5 coins, what is the probability of 3 heads?
– Binomial distribution Possible
combinations of k events
Probability of k events
Probability of n-k
non-events
Poisson Distribution
• Assume arrival times of some event follow an exponential distribution
• X(t) for t≥0 represents the number of arrivals up to time period t
• px(t) = probability x arrivals in time t
tx
x ex
ttp
!
)()(
Poisson Distribution • Example:
Assume 5 (λ=5) packets arrive per second
• Probability of seeing exactly 5 packets– p(5)
• Probability of seeing less than 10 packets in a second– 1-[p(0) + p(1) + … + p(10)]
P(0) .007P(1) .034
P(2) .081
P(3) .135P(4) .175
P(5) .175
P(6) .141
P(7) .101P(8) .061P(9) .034
P(10) .013
Poisson Process
• Superposition– Multiple Poisson processes aggregate
to Poisson process with higher rate
• Decomposition– Single Poisson process decomposes
to multiple lower rate Poisson processes
λ...
λ1
λ...
λn
λ2
n
ii
1
λn
λ2
λ1
Exponential Distribution
• Used to model– Arrival rate– Service rate
• Memoryless (Markov) propertyPr(T > s+t |T > s)= Pr(T > t)
λ=1
Markov Process
• Discrete or continuous process where Pr(Xn = xn |Xn-1 = xn-1, Xn-2 = xn-2, … ,X0 = x0) =
Pr(Xn = xn |Xn-1 = xn-1)
– Memoryless process• Present state only the precious state, not those earlier
• Classified by:– Index set (discrete, continuous)– State space
• Markov Chain – discrete• Markov Process – continuous
Birth-Death Process (BDP)
• Continuous time Markov chain– State n represents size of population – pn is probability system in state n
• Transition types– λi – birth rate, moves system from state n to n+1
– μi – death rate, moves system from n to n-1
0 1 2 k…
λ0 λ1 λ2 λk
μ1 μ2 μ3 μk-1
BDP Probabilities
• Flow balance– pn is steady state probability of system being in
state n
– Steady State Probability
Queue Models
Types of Queues
• M/M/1– Single queue and single server
• M/M/c– Single queue, c servers
• M/M/c/m– Single queue, c servers, m buffer size
• M/G/1– General service distribution
Single Server Queue
• M/M/1– Single queue and single server– Customer arrival –
• Exponentially distributed with λ
– Service time• Exponential distribution with μ
Server
Customers(Arrivals)
QueueDepartures
M/M/1 Properties
• Birth-death process where:
0 1 2 k…
λ λ λ λ
μ μ μ μ
• Flow equations:
M/M/1 Probabilities
• Steady State Probabilities for M/M/1
M/M/1 Properties
• L – average number of events in system
• W – average time spent in system – Use Little’s Law (L=λW)
1LW
L
Example
• Assume a network: – Receives packets at 100pps (λ=100)– Can process 200 pps (μ=200)
• What is average # packets in system?
• What is average time a packet is in system
Example
• Assume a network where: – Packet sent at 1000pps – Average packet size is 1000bits
• Question: To ensure average delay less than 50ms, what should be link speed?
– 10ms?
Statistical Multiplexing vs FDM/TDM
• Network has m users, each send packets at λ/m pps• What’s the average delay?
• Statistical Multiplexing– Users share single network which can send μ pps
– FDM/TDM• Users all allocated μ/m of network bandwidth
– Essentially m independent M/M/1 queues
m
mmW
)/()/(
1
1W
Usually better to have one big server/network!!!!
Multiple Server Queue
Server 1
Customers(Arrivals)
QueueDeparturesServer c
...λ
λ/c
λ/c
λ/c
• M/M/c– Single queue with c servers
M/M/c Properties
• Birth/death rates:
0 1 2 …
λ λ λ
μ 2μ 3μ
c
λ
cμ
λ
cμ
c+1
n
• Utilization:
c
M/M/c Probabilities
)1/(!)1(!
)(!
)1(!
11
10
0
0
pcrn
r
c
rp
cnpcc
cnpnp
c
n
nc
ncn
n
n
n
n
• Steady state probabilities:
M/M/c Properties
• Average time in system:
• Average number in system:
Examples
• Assume a network: – Receives packets at 100pps (λ=100)– Two processor computes 100 pps • (μ=100, c=2)
• What is average # packets in system?
• What is average time a packet is in system