Networking = Plumbing TELE302 Lecture 7 Queueing Analysis: I Jeremiah Deng University of Otago 29 July 2013 Jeremiah Deng (University of Otago) TELE302 Lecture 7 29 July 2013 1 / 33 Lecture Outline Jeremiah Deng (University of Otago) TELE302 Lecture 7 29 July 2013 2 / 33 Review Last Lecture 1 Review 2 Graphical Representation 3 4 Probability distributions Exponential distribution Gaussian distribution Poisson distribution... Poisson process memoryless interarrival time: exponential distributed number of occurrences within an interval: Poisson distributed Jeremiah Deng (University of Otago) TELE302 Lecture 7 29 July 2013 3 / 33 Jeremiah Deng (University of Otago) TELE302 Lecture 7 29 July 2013 5 / 33
Graphical Representation Graphical Representation Markov Chains Graphical Representation A Markov chain {X (n), n = 0, 1, 2,...}: a memoryless discrete stochastic process. P{X (n + 1) = j X (0) = i 0, X (1) = i 1,..., X (n) = i n } = P{X (n + 1) = j X (n) = i n }. Memoryless: Future is defined purely by Present, no Past. Described by transition probabilities between states i and j: P ij (s, t) = P(X t = j X s = i) Used to model weather, genetic inheritance, communication errors etc. Markov Chains are used to describe system state transition in a Poisson process. A point process counting arrivals only: always growing Birth-death process can be used for queueing modeling. Right links represent birth or arrival; Left links are for death or departure. Jeremiah Deng (University of Otago) TELE302 Lecture 7 29 July 2013 9 / 33 Graphical Representation Network Design: Looking back Jeremiah Deng (University of Otago) TELE302 Lecture 7 29 July 2013 10 / 33 Queueing is everywhere! Network design takes a broad spectrum. Optimization with trade-offs, analysis, simulation etc. Services almost always get delayed. Today s question: How much (queueing) delay can be expected from a given service model? Jeremiah Deng (University of Otago) TELE302 Lecture 7 29 July 2013 11 / 33 Jeremiah Deng (University of Otago) TELE302 Lecture 7 29 July 2013 13 / 33
Customers & Service Over Time Customers arrive at a service facility under a point process. If no server is available, the customer enters a queue. When a server is free, customer gets served in a (random) length of time. After service, the customer departs the system. Jeremiah Deng (University of Otago) TELE302 Lecture 7 29 July 2013 14 / 33 Queuing Theory Jeremiah Deng (University of Otago) TELE302 Lecture 7 29 July 2013 15 / 33 Arrival Process Originally developed to help design and analyse telephone networks. Erlang published first QT paper in 1909. Revived with the development of ARPANET Leonard Kleinrock used QT to design packet switching networks in 1960s. Broadly applicable to systems characterized by A stochastic arrival process A stochastic service mechanism A queue discipline Specifies how customers arrive to the system. Defined by Inter-arrival time ia time: expected time between arrivals of customers. Arrival rate: λ = 1/ia time. a probability distribution. ia time usually takes an exponential distribution. Jeremiah Deng (University of Otago) TELE302 Lecture 7 29 July 2013 16 / 33 Jeremiah Deng (University of Otago) TELE302 Lecture 7 29 July 2013 17 / 33
Service Mechanism Queueing Discipline Number of servers Mean service time of a customer denoted by E(S) µ = 1/E(S): service rate of a server. Probability distribution for the service time Modelled usually as an exponential distribution Rule by which we choose the next customer to be served. Common ones are FIFO: First In First Out (a standard queue) LIFO: Last In First Out (a stack) Priority: Define priority for each customer (a priority queue). Jeremiah Deng (University of Otago) TELE302 Lecture 7 29 July 2013 18 / 33 Kendall Notation (A/B/c/K/m/Z) Jeremiah Deng (University of Otago) TELE302 Lecture 7 29 July 2013 19 / 33 Customers & Service Over Time - Another Look A: interarrival time distribution B: service time distribution M for exponential G for general c: number of servers Optional: K: maximum number of allowed customers m: size of the customer population Z: queueing discipline, typically FIFO Too much randomness! No clue about system performance: how long will a customer stay in system/queue on average; how many customers are in system/queue on average? Some simplification based on on average? Jeremiah Deng (University of Otago) TELE302 Lecture 7 29 July 2013 20 / 33 Jeremiah Deng (University of Otago) TELE302 Lecture 7 29 July 2013 21 / 33
Little s Theorem Queuing Number of customers in the system at time t is N = λw λ: avg. arrival rate, 1/λ: average interarrival time W : Avg. time in system Little s Theorem actually holds for every queueing system. Arrivals are random Forms a Poisson Process at a constant average rate λ. FIFO The queue discipline is first-come, first served. Service Time with an exponential rate of µ. One server Steady state Constant average arrival rate, λ, is less than the constant potential service rate, µ. Jeremiah Deng (University of Otago) TELE302 Lecture 7 29 July 2013 22 / 33 Analysis Jeremiah Deng (University of Otago) TELE302 Lecture 7 29 July 2013 24 / 33 Analysis (continued... ) Let p n be the steady state probability of being in state n. For balance to be reached the following equations hold p n 1 λ + p n+1 µ = p n (λ + µ), for n > 0; p 1 µ = p 0 λ e.g., steady state requires inflow (in green) = outflow (in blue) at node 2, i.e., p 1 λ + p 3 µ = p 2 λ + p 2 µ. Solving equations above gives: ( n λ p n = µ) p0 Define = λ/µ. From p n = n p 0, and that n=0 p n = 1, we have p 0 = 1, p n = (1 ) n. Expected number in system: L = E{N} = n np n = 1 Chances the server is busy: P[N 1] = 1 p 0 =. is also called utilization rate. 9 8 7 6 5 4 3 2 1 Performance of Cust# in Sys. 0 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 Utilization rate Jeremiah Deng (University of Otago) TELE302 Lecture 7 29 July 2013 25 / 33 Jeremiah Deng (University of Otago) TELE302 Lecture 7 29 July 2013 26 / 33
Performance Notations Expected Times According to Little s Theorem, the expected time in the system is L: Expected number of customers in the system W : Expected customer time in the system L q : Expected queue length W q : Expected waiting time in queue W = L/λ = Expected time in server is W s = 1/µ. Expected time in queue W q = W W s = λ(1 ) = 1 µ λ. µ(1 ) = 2 λ(1 ). Jeremiah Deng (University of Otago) TELE302 Lecture 7 29 July 2013 27 / 33 Expected Queue Length Jeremiah Deng (University of Otago) TELE302 Lecture 7 29 July 2013 28 / 33 An Example Expected number of customers in system is L = E{N} = Expected number of customer in server 1 = λ µ λ. L s = 1 P[N 1] = 1 P[N = 0] = 1 (1 ) =. So expected queue length is L q = L L s = 2 1. A switch receives messages at a rate of 240 messages per minute. Message length is exponentially distributed with an average length of 176 bytes. Outgoing transmission is at the rate of 800 bytes per second. Analyze as system. Little s Theorem holds here - W q = L q /λ. Jeremiah Deng (University of Otago) TELE302 Lecture 7 29 July 2013 29 / 33 Jeremiah Deng (University of Otago) TELE302 Lecture 7 29 July 2013 30 / 33
The Solution Bonus Question (0.5 marks) Arrival rate is λ=4 msg/sec. Service rate is µ=800/176=4.54 msg/sec. Utilization rate of model is = λ/µ = 4/4.54 = 0.88. Average queueing length is L q = 2 /(1 ) = 6.4 msgs 9 8 7 6 5 4 3 Performance of Queue len. Time in sys. The manager says from tomorrow on the message arrival rate will double, 8 msg/sec. A new CPU is needed for the switch. What is the new service rate, if the same average time in system, W, is expected? Double the original service rate µ? Less than double? More than double? Exactly, how much? Average time spent in system per msg is W = 1.8 sec. 2 1 0 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 Utilization rate Jeremiah Deng (University of Otago) TELE302 Lecture 7 29 July 2013 31 / 33 Jeremiah Deng (University of Otago) TELE302 Lecture 7 29 July 2013 32 / 33 Recap Queueing concepts Arrival/enqueue or service/departure Queueing discipline Kendal annotations : λ, µ,... References Reading WSa, Queueing Analysis, available from Schedule page Bertsekas & Gallager, Data Networks, Chapter 3 (3.1 3.3). Ns-2 Lab this week Jeremiah Deng (University of Otago) TELE302 Lecture 7 29 July 2013 33 / 33