410 likes | 965 Views
Introduction to Queuing Theory. Queuing theory definitions. (Kleinrock) “We study the phenomena of standing, waiting, and serving, and we call this study Queueing Theory." (Mathworld) “The study of the waiting times, lengths, and other properties of queues.”.
E N D
Queuing theory definitions • (Kleinrock) “We study the phenomena of standing, waiting, and serving, and we call this study Queueing Theory." • (Mathworld) “The study of the waiting times, lengths, and other properties of queues.” http://www2.uwindsor.ca/~hlynka/queue.html
Queuing theory for studying networks • View network as collections of queues • FIFO data-structures • Queuing theory provides probabilistic analysis of these queues • Examples: • Average length • Average waiting time • Probability queue is at a certain length • Probability a packet will be lost
Queuing System Server Queue Queuing System Server System Model Queuing System • Use Queuing models to • Describe the behavior of queuing systems • Evaluate system performance
Characteristics of queuing systems • Arrival Process • The distribution that determines how the tasks arrives in the system. • Service Process • The distribution that determines the task processing time • Number of Servers • Total number of servers available to process the tasks
Kendall Notation 1/2/3(/4/5/6) • Six parameters in shorthand • First three typically used, unless specified • Arrival Distribution • Service Distribution • Number of servers • Total Capacity (infinite if not specified) • Population Size (infinite) • Service Discipline (FCFS/FIFO)
Arrival time distributions • M: stands for "Markovian“, Poisson arrivials • D: Deterministic (e.g. fixed constant) • G: General (anything)
Kendall Notation Examples • M/M/1: • Poisson arrivals and exponential service, 1 server, infinite capacity and population, FCFS (FIFO) • the simplest ‘realistic’ queue • M/M/m • Same, but M servers • G/G/3/20/1500/SPF • General arrival and service distributions, 3 servers, 17 queue slots (20-3), 1500 total jobs, Shortest Packet First
Analysis of M/M/1 queue • Given: • l: Arrival rate of jobs (packets on input link) • m: Service rate of the server (output link) • Solve: • L: average number in queuing system • Lq average number in the queue • W: average waiting time in whole system • Wq average waiting time in the queue
M/M/1 queue model L Lq l m Wq W
Little’s Law • Little’s Law: Average number of jobs in system = average arrival rate of jobs × average service time • Observed before, Little was first to prove • Applies to any system in equilibrium, as long as nothing in black box is creating or destroying jobs System Arrivals Departures
Formally, Little’s Law is L = lW Average number of jobs in system = average arrival rate ×average service time for each job • l: Average arrival rate • W: Average time job is in the system (average service time) • L: Average number of jobs in the system
= = J ( )( ) N J l ( ) W T T N = ( ) W N T Proof of Little’s Law: Let J be the sum of all service time, that is, the sum of time spent on each job. E.g., J = j1+j2+j3…., where j1 is the service time of job 1, and so on. Let N be the number of jobs (packets). Let T be the total service time of the system on the jobs. Note that T ≤ J. We know l is the average arrival rate, W is the average service time of jobs, and L is the average number of jobs in the system. On the right-hand side, by definitions, in a stable system we have By definition, J is the sum of service time for all jobs, T is the total service time of the system. Thus, J/T is the average number of jobs in the system, which is L. Therefore, the Little’s Law holds.
3 3 3 # in System 2 2 2 1 1 1 1 2 3 4 5 6 7 8 Time Time in System 1 2 3 Packet # An example of J Arrivals Packet # Departures 1 2 3 4 5 6 7 8 Time J = Shaded area = 9 Same in all cases!
M/M/1 queue model • l: Arrival rate of jobs (packets on input link) • m: Service rate of the server (output link) • L: average number in queuing system • Lq average number in the queue • W: average waiting time in whole system • Wq average waiting time in the queue L Lq l m Wq W • L=λW • Lq=λWq
Poisson process • Used to model random events in time that are largely independent of one another • E.g., a event may be that a customer arrives at the ice cream shop • E.g., or you see a roadkill when driving • E.g., or a packet arrives at the router
Poisson Process • For a poisson process with average arrival rate , the probability of seeing n arrivals in time interval Δt
Poisson process & exponential distribution • Inter-arrival time t (time between arrivals) in a Poisson process follows exponential distribution with parameter
L Lq l m Wq W M/M/1 queue model • l: Arrival rate of jobs (packets on input link) • m: Service rate of the server (output link) • L: average number in queuing system • Lq average number in the queue • W: average waiting time in whole system • Wq average waiting time in the queue • L=λW • Lq=λWq • W = Wq + (1/μ)
Solving queuing systems • 4 unknowns: L, Lq W, Wq • Relationships: • L=lW • Lq=lWq • W = Wq + (1/m) • If we know any 1, can find the others
Analysis of M/M/1 queue • Goal: A closed form expression of the probability of the number of jobs in the queue (Pi) given only l and m • Online M/M/1 animation • http://www.dcs.ed.ac.uk/home/jeh/Simjava/queueing/mm1_q/mm1_q.html
l l l l n-1 n n+1 m m m m Equilibrium conditions Pn is the probability that in equilibrium the system has n number of jobs l l 0 1 m m
Solving for P0 and Pn at equilibrium • Step 1 • Step 2 Verify this after class
Solving for P0 and Pn at equilibrium • Step 3 • Step 4 Pn: probability of n jobs in the system
Stable Region linear region
An example • On a network gateway, measurements show that the packets arrive at a mean rate of 125 packets per second (pps) and the gateway takes about 2 millisecs to forward them. Assuming an M/M/1 model. • Measurement of a network gateway: • mean arrival rate (l): 125 Packets/s • mean response time (m): 2 ms • Assuming exponential arrivals: • What is the gateway’s utilization? • What is the probability of n packets in the gateway? • mean number of packets in the gateway?
Example cont’d • Arrival rate λ = 125 pps • Service rate μ = 1/0.002 = 500 pps • Gateway utilization ρ = λ/μ = 0.25 • Prob. of n packets in gateway = Pn = • Mean number of packets in gateway = L =