Queuing Systems 4/13/2015 © 2007 Raymond P. Jefferis III 1 Basic Queuing Model M/M/1 Queue 4/13/2015 © 2007 Raymond P. Jefferis III 2 Note • The queue forms because the instantaneous arrival rate exceeds the service rate. If arrivals and service completions were synchronized, there would be no queue. • The average arrival rate must be less than the service rate, or the length of the queue will grow without limit. 4/13/2015 © 2007 Raymond P. Jefferis III 3 Notation M/M/1 1= number of servers M=Service: M=exponential G=general D=deterministic (constant) M= Arrivals: Poisson (Markov) process 4/13/2015 © 2007 Raymond P. Jefferis III 4 Input Source - Arrivals • Generates arrivals according to a statistical distribution (random interarrival times) • Arrivals may require random service times • Average interarrival time is the mean (expected value) of the model probability density function 4/13/2015 © 2007 Raymond P. Jefferis III 5 Expected Value (Mean) The expected value E(Xi) of a discrete random variable Xi (i=1,2, …, n) is defined as, E( X i ) x j p X i ( X i x j ) j 1 4/13/2015 © 2007 Raymond P. Jefferis III 6 Variance • The variance of a distribution function having mean E(k) is given by, E[k E( k )] E( k ) E ( k ) 2 k 4/13/2015 2 © 2007 Raymond P. Jefferis III 2 2 7 Example Arrival Distributions • Weibull distribution (component failures) (a and b are shape and scale parameters) b1 ax b P( x ) abx e 0< x< P( x ) 0 x0 4/13/2015 © 2007 Raymond P. Jefferis III 8 Example Arrival Distribution • Poisson distribution (telephone call arrivals) • Assumptions: – the probability of a single arrival in Dt is lDt, where l is the average arrival rate [packets/s] – the probability of no arrivals in Dt is 1-lDt – arrivals are independent of previous events [Markov (memoryless) system] 4/13/2015 © 2007 Raymond P. Jefferis III 9 Poisson Arrival Distribution • The probability of k arrivals during interval T is given by, lT e p( k ) ( lT ) k! k • The mean and variance are, E( k ) lt 4/13/2015 lt 2 k © 2007 Raymond P. Jefferis III 10 Mean of Poisson Distribution 2k E[k E( k )]2 E ( k ) kp( k ) k 0 ( lT )k e lT E( k ) k k! k 0 ( lT )k 1 e lT E ( k ) lT ( k 1)! k 0 E ( k ) lTe lT 2k E( k 2 ) E 2 ( k ) 2k E( k ) 2k lT ( lT )k 1 k 0 ( k 1)! E ( k ) lTe lT elT lT 4/13/2015 © 2007 Raymond P. Jefferis III 11 Poisson (l=0.5) 0 .5 e k ll k 0 0 4/13/2015 5 k © 2007 Raymond P. Jefferis III 10 12 Poisson (l=0.8) 0 .5 e k ll k 0 0 4/13/2015 5 k © 2007 Raymond P. Jefferis III 10 13 Poisson (l=2) 0 .6 0 .5 e k ll k 0 0 0 0 4/13/2015 5 k © 2007 Raymond P. Jefferis III 10 10 14 Poisson (l=5) 0 .5 e k ll k 0 0 4/13/2015 5 k © 2007 Raymond P. Jefferis III 10 15 Observations • The mean increases with lT, as expected. • The variance increases with lT, as derived. • If only m arrivals can be serviced in time T, there is a probability that k>m. In this case k-m arrivals must be queued. This probability increases with lT. 4/13/2015 © 2007 Raymond P. Jefferis III 16 Example A student at a terminal generates a call to the network server l=2 times per hour, on average. What is the probability of two or more such calls in the next hour, assuming Poisson statistics? 4/13/2015 © 2007 Raymond P. Jefferis III 17 Answer to example • The probability of two or more calls in a one-hour interval is, p(k 2) 1 p(k 0) p(k 1) 20 2 p(0) e 0.1352 0! 21 2 p(1) e 0.2707 1! p 2 1 [ p(0) p(1)] 1 0.4060 0.5940 4/13/2015 © 2007 Raymond P. Jefferis III 18 Cumulative Distribution • The cumulative distribution F(x<k) is the integral of the probability density function. Thus, for the previous example: k 0 1 2 3 4 4/13/2015 p(x=k) 0.13534 0.27067 0.27067 0.18045 0.090224 F(x<k) 0.13534 0.40601 0.67668 0.85713 0.947354 F(X³k) 0.86466 0.59399 0.32332 0.14287 0.052646 © 2007 Raymond P. Jefferis III 19 Queue • • • • • holds arrivals until serviced has maximum length parameter state is length at given time arrivals experience waiting time in queue multiple queues are possible 4/13/2015 © 2007 Raymond P. Jefferis III 20 Service Mechanisms • • • • One or more servers (single or parallel) servers may also be queued a service discipline is imposed (FIFO, etc.) a holding time is required for service (reciprocal of the serving rate) • server is busy until service is complete 4/13/2015 © 2007 Raymond P. Jefferis III 21 Example Service Times • Exponential distribution (tel. call service) P( x ) 1 e x mean var 2 4/13/2015 © 2007 Raymond P. Jefferis III 22 Erlang (gamma) Service Times • Distribution ( k )k k 1 kt F (t ) t e ( k 1)! • k is integer • m, k positive mean 1 / std.dev. 1 / k 4/13/2015 © 2007 Raymond P. Jefferis III 23 Summary of System Properties • • • • • • interarrival times randomly distributed service times randomly distributed service discipline imposed number of servers length of queue (has maximum) Markov process if no influence of queue length on arrivals (memoryless) 4/13/2015 © 2007 Raymond P. Jefferis III 24 Queuing Analysis 4/13/2015 © 2007 Raymond P. Jefferis III 25 Example • A certain communications channel delivers data at its capacity of C=14,400 [bits/sec]. The average packet (message) length, l is 450 bits. The packet arrival rate is thus: l C/l l 14400 / 450 l 32 [packets / sec] 4/13/2015 © 2007 Raymond P. Jefferis III 26 Utilization Factor • The ratio of arrival rate to service rate is the utilization factor. l/ 4/13/2015 © 2007 Raymond P. Jefferis III 27 Example • If a channel transmits 35 packets/second and its service rate is 40 packets/second, the utilization factor can be calculated as: l/ l 35 [packets / sec] = 40 [packets / sec] = 35 / 40 = 0.875 4/13/2015 © 2007 Raymond P. Jefferis III 28 Total Time Delay • The average total time delay before transmission of an arriving packet, W, is equal to the waiting time in the queue, wq, plus the time to service the packet, ws. That is (mean values): W wq ws 4/13/2015 © 2007 Raymond P. Jefferis III 29 Delay if n Packets Are Queued • If n packets are in the queue, the average time delay for an incoming packet will be: W nws ws ( n 1)ws Since ws=1/, then, W 4/13/2015 ( n 1) © 2007 Raymond P. Jefferis III 30 Result • The expected time delay depends upon the state of the queue and the mean service rate. • Note that the service rate may depend upon the average length of the message serviced. • For message length li and channel capacity C, ws i / C 4/13/2015 © 2007 Raymond P. Jefferis III 31 Number of Packets in System • The expected (mean) number of packets in the system will be, L lW where 4/13/2015 l is the average arrival rate W is the expected waiting time, including service © 2007 Raymond P. Jefferis III 32 Packets in System vs Traffic • The expected number of packets in the system is: L 4/13/2015 1 l l © 2007 Raymond P. Jefferis III 33 Graphical Representation 1 00 1 50 0 0 4/13/2015 0 .5 © 2007 Raymond P. Jefferis III 1 34 Number of Packets in Queue • The expected (mean) number of packets in the queue will be, Lq lWq where 4/13/2015 l is the average arrival rate Wq is the expected waiting time in the queue © 2007 Raymond P. Jefferis III 35 Queued Packets vs Traffic • The expected number of packets in the queue is: 2 l2 Lq 1 ( l ) 4/13/2015 © 2007 Raymond P. Jefferis III 36 Graphical Representation 1 00 1 2 50 0 0 4/13/2015 0 .5 © 2007 Raymond P. Jefferis III 1 37 Total Expected Waiting Time • If the service time is constant at its average rate 1/, then W Wq 1/ 4/13/2015 © 2007 Raymond P. Jefferis III 38 Wait in Queue vs Traffic • The waiting time in the queue is: Wq 4/13/2015 1 l Lq 1 2 l 1 © 2007 Raymond P. Jefferis III 39 Total Waiting Time vs Traffic • The total waiting time will be: 1 2 1 W l 1 l 4/13/2015 1 © 2007 Raymond P. Jefferis III 40 Little’s Result • There are 4 variables and three independent equations, so if one is known the rest can be calculated L lW 1 l l 2 l2 Lq lWq 1 ( l) Wq 1 l Lq W Wq 4/13/2015 1 1 l 1 l 2 1 2 1 l ( l ) 1 © 2007 Raymond P. Jefferis III 1 l 41