Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

Like this presentation? Why not share!

No Downloads

Total views

1,852

On SlideShare

0

From Embeds

0

Number of Embeds

10

Shares

0

Downloads

62

Comments

0

Likes

1

No embeds

No notes for slide

- 1. Performance Engineering Prof. Jerry Breecher QUEUEING
- 2. WHAT WE ARE DOING HERE We are about to embark on: Queueing Lingo - all the definitions you’ll ever need! Queueing - especially the Single Queue in DETAIL Analytical Models - how to solve a number of complex problems using the equations we already know and love. Works especially well for open models. Operational Laws - drawing conclusions about limits - what to do when we can’t solve the math exactly. Mean Value Analysis - Using the equations in an iterative fashion to solve closed models.
- 3. Queueing Models <ul><li>This section is about being able to describe the behavior of queues. Queues are certainly a prevalent object in computer systems, and our goal here is to write the equations that describe them. The language we’ll use here is mathematical, but nothing really more complicated than algebra. </li></ul>
- 4. Queueing Lingo <ul><li>Goals: </li></ul><ul><ul><li>To understand the random/statistical nature of computer data. We will emphasize the non-deterministic. </li></ul></ul><ul><ul><li>To understand distributions for simulation purposes. </li></ul></ul><ul><ul><li>To impress your friends. </li></ul></ul><ul><li>For an observation, two things matter: </li></ul><ul><ul><li>The value measured. </li></ul></ul><ul><ul><li>When measured. </li></ul></ul><ul><li>The occurrence of an event can give us the "when". </li></ul>
- 5. Queueing Lingo <ul><li>A STOCHASTIC PROCESS is a mechanism that produces a collection of measurements which all occur, randomly, in the same range of values. It applies to the VALUE measured for an observation. The dictionary says, "random, statistical". </li></ul><ul><li>Stochastic processes are well behaved phenomena which don't do things which are unpredictable or unplanned for. </li></ul><ul><li>Examples: </li></ul><ul><li>Throwing 2 dice always gives numbers in the range 2 - 12. </li></ul><ul><li>Actions of people are unpredictable (unless the range of values is made very large.) Someone can always respond in a way you haven't predicted. </li></ul>
- 6. Queueing Lingo <ul><li>THE POISSON PROCESS applies to WHEN an observation is made. It looks random; the arrival points are uniformly distributed across a time interval. Poisson processes can be defined by: </li></ul><ul><li>Event counting The distribution of the number of events occurring in </li></ul><ul><li>a particular time is a Poisson distribution. </li></ul><ul><li>Time between events The distribution of times between event occurrences is </li></ul><ul><li> exponential. </li></ul><ul><li>Example: Show how a random "look" leads to an exponential distribution. See the next page for a picture of these distributions. </li></ul>
- 7. Queueing Lingo <ul><li>This is a simple exponential curve. What properties can you identify from it? </li></ul>F(t) = exp(-t)
- 8. Queueing Lingo <ul><li>Example of the Poisson Probability Density Function. </li></ul>F(k) = ( 5 / k! ) exp( -5 )
- 9. Lab - You Get To See It Happen Before Your Very Eyes! <ul><li>This is a group lab designed to demonstrate that the number of random events in a particular interval is a Poisson distribution, and that the distribution of spaces between events is exponential. </li></ul><ul><li>Open your textbook 20 times. Each time, write down the number of the left-hand page ( mod 100 ) beside the appropriate sample in column I. </li></ul><ul><li>Count how many of the segments in Column I have 0 samples in them. Put this number in the first row of Column II. Repeat for 1, 2, 3, ... samples. </li></ul><ul><li>For each of the samples in Column I, determine the distance or separation between that sample and the next higher sample. If the the distance is 0 ( the two samples are the same ) put a tick in the first row of column 3, if the separation is 3, tick the interval = 3 row, etc. </li></ul>
- 10. Lab - You Get To See It Happen Before Your Very Eyes! Column I Numbers falling in each segment. Column II Number of segments containing N samples Column III Number of instances of intervals between samples. Segment How Many Samples 0 – 9 10 – 19 20 - 29 30 - 39 40 - 49 50 - 59 60 - 69 70 - 79 80 - 89 90 - 99 N Number of Segments 0 1 2 3 4 5 6 7 8 9 Interval Number of Instances 0 2 4 6 8 10 12 14 16 18
- 11. Lab - You Get To See It Happen Before Your Very Eyes! // Generate Poisson. // This program generates random numbers, puts them into buckets, // and calculates the distance between numbers. // // Inputs: // N - number of samples to generate #include <time.h> #define MAX_DATA_VALUE 100 #define MAX_BUCKETS 100 #define MAX_DATA 1000 // Compare routine used in sorting int compare (const void * a, const void * b) { return ( *(int*)a - *(int*)b ); } int main( int argc, char *argv[]) { int Data[MAX_DATA]; int Bucket[MAX_BUCKETS]; int NumberOfSamples; int NumberOfBuckets = 10; int LargestBucketFill = 0; int Index, Temp, i; if ( argc <2 ) { printf( "Usage: GeneratePoisson <number_of_samples> "); exit(0); } NumberOfSamples = atoi( argv[1] ); srand((unsigned)time(NULL)); for ( Index = 0; Index < NumberOfBuckets; Index++ ) Bucket[Index] = 0; for ( Index = 0; Index < NumberOfSamples; Index++ ) { Data[Index] = rand() % MAX_DATA_VALUE; Temp = (NumberOfBuckets*Data[Index])/MAX_DATA_VALUE; Bucket[Temp]++; if ( Bucket[Temp] > LargestBucketFill ) LargestBucketFill = Bucket[Temp]; } printf(" Raw Random Numbers "); for ( Index = 0; Index < NumberOfSamples; Index++ ) printf( "%d ", Data[Index] ); printf(" "); qsort (Data, NumberOfSamples, sizeof(int), compare); printf( " Sorted Random Numbers "); for ( Index = 0; Index < NumberOfSamples; Index++ ) printf( "%d ", Data[Index] ); printf(" "); printf( " Range Number "); printf( " in Range "); for ( Index = 0; Index < NumberOfBuckets; Index++ ) printf( "%2d - %2d, %d ", (MAX_DATA_VALUE/NumberOfBuckets * Index), (MAX_DATA_VALUE/NumberOfBuckets * (Index+1)) - 1, Bucket[Index] ); // Calculate distribution of items in each bucket printf(" "); for ( Index = 0; Index < LargestBucketFill; Index++ ) { Temp = 0; for ( i = 0; i <NumberOfBuckets; i++ ) if ( Bucket[i] == Index ) Temp++; printf( "Number of buckets with %d items, %d ", Index, Temp ); } // Determine the distance between the random items. for ( Index = 0; Index < MAX_BUCKETS; Index++ ) Bucket[Index] = 0; LargestBucketFill = 0; for ( Index = 0; Index < NumberOfSamples - 1; Index++ ) { Temp = Data[Index+1] - Data[Index]; Bucket[Temp]++; if ( Temp > LargestBucketFill ) LargestBucketFill = Temp; } printf( " Distance Number "); printf( " Between with this "); printf( " Samples distance "); for ( Index = 0; Index <= LargestBucketFill; Index++ ) printf( "%2d, %d ", Index, Bucket[Index] ); } Code is here so it doesn’t get lost!!
- 12. Lab - You Get To See It Happen Before Your Very Eyes! The Source Code The results of running this code can be seen here This is the result of running 4 experiments of 20 samples each. The results aren’t pretty!! Perhaps by running the tests many times, everything would look nice and smooth. You can see the results you would expect, but there’s lots of jitter. Experimental Results
- 13. Queueing Lingo <ul><li>Examples: </li></ul><ul><li>Suppose that a piece of software has an expected lifetime of 5 years, and that the average bug rate for this type of product is one bug/year. </li></ul><ul><li>What is the bug expectation rate per year at the start of the five years, assuming this code is "average"? </li></ul><ul><li>After two years, four bugs have been found. The code is still considered "average". How many bugs/year can be expected for the remaining three years? </li></ul>
- 14. Queueing Lingo <ul><li>MEMORYLESS means that the probability of an event doesn't depend on its past. The above case highlights an example where the past does matter. </li></ul><ul><li>Examples : Which depend on the past, and which don't? </li></ul><ul><ul><li>Throwing dice? </li></ul></ul><ul><ul><li>A disk seek distance? </li></ul></ul><ul><ul><li>The address of an instruction execution? </li></ul></ul><ul><ul><li>The measurement of the length of a table? </li></ul></ul>Prepare to Have Your Mind Bent In An Unexpected Way!! Example: Consider a bus stop where the time between bus arrivals is exponentially distributed with a rate L. Thus the bus arrivals form a Poisson process. If you walk up to the bus stop, how long do you have to wait until the next bus arrives?
- 15. Queueing Lingo <ul><li>Example: </li></ul><ul><li>Consider a bus stop where the time between bus arrivals is exponentially distributed with a rate L. Thus the bus arrivals form a Poisson process. If you walk up to the bus stop, how long do you have to wait until the next bus arrives? </li></ul><ul><li>1. Possible solution: Since buses arrive at a rate L, the average time between arrivals is 1/L. But since we walk up at random, we would wait for only half an interval on the average. So we would wait 1/(2L) for the next bus. </li></ul><ul><li>2. Possible solution: Since the time between buses is exponentially distributed, it is memoryless. So the residual lifetime for any time that I arrive should be distributed exponentially the same way as the original distribution. Since the average time between buses is 1/L, the average time ( residual ) to wait should also be 1/L. </li></ul>
- 16. Queueing Lingo <ul><li>// GenerateRandomBusArrivals </li></ul><ul><li>#include <time.h> </li></ul><ul><li>#define MAX_DATA 1000 </li></ul><ul><li>// Hours in a week </li></ul><ul><li>#define MAX_DATA_VALUE 168 </li></ul><ul><li>// Compare routine used in sorting </li></ul><ul><li>int compare (const void * a, const void * b) { </li></ul><ul><li>return ( *(int*)a - *(int*)b ); </li></ul><ul><li>} </li></ul><ul><li>int main( int argc, char *argv[]) { </li></ul><ul><li>int Data[MAX_DATA]; </li></ul><ul><li>int NumberOfSamples = 14; </li></ul><ul><li>int Index; </li></ul><ul><li>printf( "This program generates 1 week's worth of bus arrivals. "); </li></ul><ul><li>printf( "We assume that the average bus arrival rate is every 12 hours, "); </li></ul><ul><li>printf( "The arrival rate is 1/12 per hour. We'll take 1 week's worth "); </li></ul><ul><li>printf( "of arrivals - we will assume that there are 14 arrivals in a week "); </li></ul><ul><li>printf( "- that's how we set the average arrival rate. "); </li></ul><ul><li>printf( "Oh - and we assume the buses arrive on the hour (it's simpler that way). "); </li></ul><ul><li>srand((unsigned)time(NULL)); </li></ul><ul><li>for ( Index = 0; Index < NumberOfSamples; Index++ ) { </li></ul><ul><li>Data[Index] = rand() % MAX_DATA_VALUE; </li></ul><ul><li>} </li></ul><ul><li>qsort (Data, NumberOfSamples, sizeof(int), compare); </li></ul><ul><li>printf( " Sorted Random Numbers "); </li></ul><ul><li>for ( Index = 0; Index < NumberOfSamples; Index++ ) </li></ul><ul><li>printf( "%d ", Data[Index] ); </li></ul><ul><li>printf(" "); </li></ul><ul><li>} </li></ul>This program generates 1 week's worth of bus arrivals. We assume that the average bus arrival rate is every 12 hours, The arrival rate is 1/12 per hour. We'll take 1 week's worth of arrivals - we will assume that there are 14 arrivals in a week - that's how we set the average arrival rate. Oh - and we assume the buses arrive on the hour (it's simpler that way). Sorted Random Numbers 2 5 73 81 100 100 102 109 134 136 145 148 152 154 So given these actual bus arrivals, how long on average must you wait for a bus? The Source Code
- 17. Queueing Lingo <ul><li>Types of Stochastic Processes </li></ul>Arrival rates are often Poisson. Service times are often exponential. ( In other words, they're both random. )
- 18. PROPERTIES OF QUEUES The device doing the actual service of the customers. Customer Departures The queue – A place where customers are stored before being serviced. Customer Arrivals
- 19. PROPERTIES OF QUEUES <ul><li>How do we describe a queue? These are the important aspects: </li></ul><ul><li>Arrival process: </li></ul><ul><li>Service Time Distribution: </li></ul><ul><li>Number of Servers: </li></ul><ul><li>System Capacity : </li></ul><ul><li>Population Size: </li></ul><ul><li>Service Discipline: </li></ul><ul><li>The shorthand for queue description is thus A / S / m / B / K / SD. </li></ul><ul><li>The inter-arrival and service times are typically of the following types: </li></ul><ul><li>M Exponential – Memoryless, the distribution we’ve just been talking about. </li></ul><ul><li>D Deterministic – the times are constant and there is no variance. </li></ul><ul><li>G General –distribution is not specified and the results are valid for all distributions </li></ul>
- 20. THE SINGLE QUEUE <ul><li>If we have a single queue obeying certain properties, we can get all kinds of nice metrics. But, it must have those required properties!! </li></ul><ul><li>REQUIRED PROPERTIES: </li></ul><ul><li>Arrivals are random with a rate of X per time. ( Poisson – when we say this, we mean the inter-arrival time is exponentially distributed. ) [ Note that in steady state, throughput = arrival rate.] Many texts use for this. </li></ul><ul><li>Service times are random with a value of D. (Exponential ) [ Note this is the Demand we've seen before.] Many texts use for this. The rate of service is = 1/D. </li></ul><ul><li>There's the possibility of an infinite number of customers. </li></ul><ul><li>There's a single server. [ So the derivation we’re about to do doesn't work for a multiprocessor CPU.] </li></ul>
- 21. THE SINGLE QUEUE <ul><li>These are general requirements and hold for many practical applications. Other analysis can be done for cases outside these requirements, but we don't do it here. </li></ul><ul><li>We will apply a method called local balance to a system like that pictured on the next page: </li></ul><ul><li>The queue is of type M / M / 1. </li></ul>
- 22. THE SINGLE QUEUE <ul><li>For simplification, in this particular case, the utilization U is related to throughput and demand by </li></ul><ul><li>U = X D (Remember N = XS) </li></ul><ul><li>Note: U </li></ul><ul><ul><ul><li>p i = U , p 0 = ( 1 – U ) </li></ul></ul></ul>X = X = = 1/D = 1/D State with 0 in Queue State with 1 in Queue State with 2 in Queue
- 23. THE SINGLE QUEUE <ul><li>By Definition: A queue is defined to contain customers that are both waiting and being serviced. </li></ul><ul><li>In an equilibrium state, from the picture below, the following equations can be formed: </li></ul><ul><li> p i = p i-1 </li></ul><ul><li>p p i </li></ul><ul><li>p p 0 U p 0 </li></ul><ul><li>The probability of having i customers in the queue is </li></ul><ul><li>p i = ( 1 – U ) U i </li></ul><ul><li>[ Note that p 0 = ( 1 - U ) so p i > 0 = U . But this is just the utilization we defined before.] </li></ul>X = X = = 1/D = 1/D State with 0 in Queue State with 1 in Queue State with 2 in Queue
- 24. THE SINGLE QUEUE <ul><li>The average number of customers in the queue (waiting and being serviced) is </li></ul><ul><li>From Little's Law ( N = X T ) in steady state, we can derive the average time spent at the queueing center ( both in the queue and being serviced ). Note what happens to this response time as the utilization increases! </li></ul>
- 25. THE SINGLE QUEUE <ul><li>Example: </li></ul><ul><ul><li>Pat is designing a communications server that receives requests from "higher level" routines. The requests are collected by a Request Handler that does nothing but put them into buffers. These requests are removed from the buffers by the Request Processor on a first come first serve basis. </li></ul></ul><ul><ul><li>requests -> Request Handler -> Buffers[n] -> Request Processor -> </li></ul></ul><ul><ul><li>The requests arrive randomly at a rate of 5/second. The Request Processor can service 10 items per second from the buffer. </li></ul></ul><ul><ul><li>Since allocating buffers is an expensive business, Pat wants to preallocate an adequate number of buffers so none need be allocated 99% of the time. Clearly there's a tradeoff here between memory usage and time-to-allocate. </li></ul></ul><ul><ul><li>How many buffers should be preallocated? </li></ul></ul>
- 26. THE SINGLE QUEUE X = = 1/D State with 0 in Queue State with 1 in Queue This is the setup for the case of M / M / 2. The probability of transition from a lower population to a higher one is the same as before ( arrivals are the same.) But the probability of one of the TWO servers finishing is twice as great when both of them are filled. X = State with 2 in Queue X = State with 3 in Queue
- 27. THE SINGLE QUEUE The following equations hold for the single queue.
- 28. ANALYTICAL MODEL <ul><li>Goals: </li></ul><ul><ul><li>You should be able to create, use, and understand a simple analytical model. </li></ul></ul><ul><ul><li>You should have a general idea of when such models are applicable and should understand some of the buzzwords. </li></ul></ul><ul><li>PERSPECTIVE: </li></ul><ul><li>An Analytical Model uses mathematical operations to capture the relationships between observable quantities. The computations don't necessarily mimic real actions as they do for simulations. </li></ul><ul><li>Examples: </li></ul><ul><ul><li>The equations we've been using such as Little's Law. </li></ul></ul><ul><ul><li>Local Balance Equations - these enumerate the states the system can be in and then determine the transitions between states. (This is what we just did with single queues.) </li></ul></ul><ul><ul><li>Mean Value Analysis - an iterative approach using the equations we've already learned. </li></ul></ul>
- 29. ANALYTICAL MODEL <ul><li>Analytical models can be applied to: </li></ul><ul><ul><li>Single Queues </li></ul></ul><ul><ul><li>Queueing Networks </li></ul></ul><ul><li>Queueing Networks are networks of queues; two or more queues tied together. They can be: </li></ul><ul><ul><li>Open: - Typical of transaction processing. Jobs enter and leave the system being studied. </li></ul></ul><ul><ul><li>Closed : - typical of batch or terminal systems. Jobs always remain somewhere within the system. </li></ul></ul><ul><ul><li>Single Class - the customers are indistinguishable from each other; they have similar service demands and routing characteristics. </li></ul></ul><ul><ul><li>Multiple Class - several categories of customers can be identified. A batch class, for example, might be heavily CPU bound while a terminal class is I/O bound. To use a multiple class model requires determining the characteristics for EACH of the classes involved. </li></ul></ul>
- 30. ANALYTICAL MODEL SINGLE CLASS OPEN QUEUEING NETWORK MODEL SOLUTIONS: This is EASY!! It's simply an extension of the equations we used for the single queue. Utilization: U k = X D k {D k is the service time) Throughput: X k = X V k (Throughput = arrivals) Max. Throughput: X max = Residence Time: R k = (delay centers) (queueing centers)
- 31. ANALYTICAL MODEL <ul><li>SINGLE CLASS OPEN QUEUEING NETWORK MODEL SOLUTIONS: </li></ul><ul><li>Queue Length: Q k = (delay centers) </li></ul><ul><li>(queueing centers) </li></ul><ul><li>System Response T = R = </li></ul><ul><li>Time: </li></ul><ul><li>Average Number N = Q = </li></ul><ul><li>In System: </li></ul><ul><li>Remember, </li></ul><ul><ul><ul><li>N = Number of requests in the "system" </li></ul></ul></ul><ul><ul><ul><li>X = Throughput </li></ul></ul></ul><ul><ul><ul><li>R = Residence time per request. </li></ul></ul></ul><ul><ul><ul><li>S = Service Time </li></ul></ul></ul><ul><li>Little's law is 90% of all you'll ever need. </li></ul>We'll be using the FIGURE on the next page and applying these Laws to the system shown there, at a number of different levels.
- 32. ANALYTICAL MODEL Terminals 4 3 2 1 CPU DISK A DISK B DISK C
- 33. ANALYTICAL MODEL <ul><li>Box 1 in the Figure: A single resource, not including the queue. </li></ul><ul><li>Here the population, N, is either 1 or 0 ( in use or not ). </li></ul><ul><ul><ul><li>Utilization is equal to the average number of requests present, or the average N. </li></ul></ul></ul><ul><ul><ul><li>Throughput X is the number of requests serviced per time. </li></ul></ul></ul><ul><ul><ul><li>Residence time R is, for this case, the service time. </li></ul></ul></ul><ul><li>[NOTE: Little's Law reduces to Utilization Law.] </li></ul>1 DISK C <ul><li>Example: </li></ul><ul><ul><li>Suppose a disk, serves 100 requests/second, with the average request needing 0.008 seconds of disk service. </li></ul></ul><ul><ul><li>What is the utilization of the disk? </li></ul></ul>N = X * R U = X * S R = S/(1 – U )
- 34. ANALYTICAL MODEL <ul><li>Box 2 in the Figure: A single resource, including the queue. </li></ul><ul><li>Now the population includes both those requests in the queue and in service. </li></ul><ul><ul><ul><li>Throughput remains the rate that the resource satisfies requests. </li></ul></ul></ul><ul><ul><ul><li>Residence time is the sum of queueing and service times. </li></ul></ul></ul><ul><li>Example: </li></ul><ul><ul><ul><li>You will need to use the result from the previous slide. </li></ul></ul></ul><ul><ul><ul><li>What is the time a request spends at the disk subsystem ( spindle + queue)? </li></ul></ul></ul><ul><ul><ul><li>What is the average number of requests in “Box 2”? </li></ul></ul></ul><ul><ul><ul><li>For one of these requests, what is the average queueing time, and what is the average service time? </li></ul></ul></ul>2 DISK C N = X * R U = X * S R = S/(1 – U )
- 35. ANALYTICAL MODEL <ul><li>Box 3 in the Figure: Central Subsystem, not including terminals. </li></ul><ul><li>The population now is the number of users with activity in the system - those not "thinking". </li></ul><ul><ul><ul><li>Throughput is the rate that requests flow between system and users. </li></ul></ul></ul><ul><ul><ul><li>Residence time is now what we call response time. </li></ul></ul></ul><ul><li>Example: </li></ul><ul><ul><li>The average system throughput (entering & leaving Box3) is 0.5/sec. There are an average of 7.5 "ready" (waiting) users in the Box. </li></ul></ul><ul><ul><li>What is the average response time? </li></ul></ul>3 2 CPU DISK A DISK B DISK C
- 36. ANALYTICAL MODEL <ul><li>Box 4 in the Figure: Entire system, including terminals. </li></ul><ul><li>The population is the total number of users, both waiting and thinking. </li></ul><ul><ul><ul><li>Throughput is the rate that requests flow between system and users. (same as box 3). </li></ul></ul></ul><ul><ul><ul><li>Residence time is the sum of response time and think time. </li></ul></ul></ul><ul><li>Example: </li></ul><ul><ul><ul><li>There are 10 users with average think time of 5 seconds, and the system has average response time of 15 seconds. </li></ul></ul></ul><ul><ul><ul><li>What is the throughput? </li></ul></ul></ul>Terminals 4 3
- 37. ANALYTICAL MODEL <ul><li>For system wide applications of Little's Law, since time represents both thinking and waiting for a response, </li></ul><ul><ul><ul><ul><li>N SS = X R for Subsystem or lower. </li></ul></ul></ul></ul><ul><ul><ul><ul><li>N ES = X ( R + Z ) for the Entire system. </li></ul></ul></ul></ul><ul><li>Example: </li></ul><ul><ul><li>A System has 64 interactive users, with an average think time of 30 seconds. Two interactions complete on average each second. </li></ul></ul><ul><ul><li>What is the average response time for this system? </li></ul></ul><ul><ul><li>How many interactions are in the system at any time? </li></ul></ul><ul><ul><li>What sized System ( how many CPU's ) would be needed for this application? </li></ul></ul>RESPONSE TIME LAW: R = N/X - Z
- 38. ANALYTICAL MODEL <ul><li>Example Problems You Should Now Be Able To Do: </li></ul><ul><ul><li>The average delay experienced by a packet when traversing a computer network is 100 msec. The average number of packets that cross the network is 128 packets/sec. </li></ul></ul><ul><ul><li>What is the average number of packets in transit in the network? </li></ul></ul><ul><li>Example Problems You Should Now Be Able To Do: </li></ul><ul><ul><li>Measurements taken during one hour from a Web server indicate that the utilization of the CPU and the two disks are: U CPU = 0.25, U disk1 = 0.35, and U disk2 = 0.30. The Web server log shows that 21,600 requests were processed during the measurement interval. </li></ul></ul><ul><ul><li>What are the service demands (the time used by each request) at the CPU and both disks? </li></ul></ul><ul><ul><li>What is the maximum throughput, </li></ul></ul><ul><ul><li>and what was the response time of the Web server during the measurement interval? </li></ul></ul><ul><li>Example Problems You Should Now Be Able To Do: </li></ul><ul><ul><li>A computer system is measured for 30 minutes. During this time, 5,400 transactions are completed and 18,900 I/O operations are executed on a certain disk that is 40% utilized. </li></ul></ul><ul><ul><li>What is the average number of I/O operations per transaction on this disk? </li></ul></ul><ul><ul><li>What is the average service time per transaction on this disk? </li></ul></ul>
- 39. ANALYTICAL MODEL <ul><li>Example Problems You Should Now Be Able To Do: </li></ul><ul><ul><li>A file server is monitored for 60 minutes, during which time 7,200 requests are completed. The disk utilization is measured to be 30%. The average service time at this disk is 30 msec per file operation request. </li></ul></ul><ul><ul><li>What is the average number of accesses to this disk per file request? </li></ul></ul><ul><li>Example Problems You Should Now Be Able To Do: </li></ul><ul><ul><ul><ul><ul><li>A computer system has one CPU and two disks: disk 1 and disk 2. The system is monitored for one hour and the utilization of the CPU and of disk 1 are measured to be 32% and 60%, respectively. Each transaction makes 5 I/O requests to disk 1 and 8 to disk 2. The average service time at disk 1 is 30 msec and at disk 2 is 25 msec. </li></ul></ul></ul></ul></ul><ul><ul><li>Find the system throughput. </li></ul></ul><ul><ul><li>Find the utilization of disk 2. </li></ul></ul><ul><ul><li>Find the average service demands at the CPU, disk 1, and disk 2. </li></ul></ul><ul><li>Example Problems You Should Now Be Able To Do: </li></ul><ul><ul><ul><ul><ul><li>An interactive system has 50 terminals and the user's think time is equal to 5 seconds. The utilization of one of the system's disk was measured to be 60%. The average service time at the disk is equal to 30 msec. Each user interaction requires, on average, 4 I/Os on this disk. </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>What is the average response time of the interactive system? </li></ul></ul></ul></ul></ul>
- 40. ANALYTICAL MODEL <ul><li>FORCED FLOW LAW: </li></ul><ul><li>The Forced Flow Law states that the flow in all parts of a system must be consistent. </li></ul><ul><li>Suppose we count both system completions and also completions at each resource. The visit count ( visit ratio ) is defined as: </li></ul><ul><ul><ul><li>Resource Completion: C k </li></ul></ul></ul><ul><ul><ul><li>System Completion: C </li></ul></ul></ul><ul><ul><ul><li>Visit Count: V k = C k / C </li></ul></ul></ul>THE FORCED FLOW LAW: X k = V k X
- 41. ANALYTICAL MODEL <ul><li>Example: </li></ul><ul><li>Suppose a system has: </li></ul><ul><ul><ul><li>30 terminals ( N = 30 ). </li></ul></ul></ul><ul><ul><ul><li>18 seconds average think time ( Z = 18 ). </li></ul></ul></ul><ul><ul><ul><li>20 visits to a specific disk/interaction (V disk = 20 ). </li></ul></ul></ul><ul><ul><ul><li>30% utilization of that disk (U disk = 0.30 ). </li></ul></ul></ul><ul><ul><ul><li>25 millisecs is the average service required per visit to the disk (S disk = 0.025 sec.). </li></ul></ul></ul><ul><li>We want to know : </li></ul><ul><ul><ul><li>Disk throughput = </li></ul></ul></ul><ul><ul><ul><li>System throughput = </li></ul></ul></ul><ul><ul><ul><li>Response time = </li></ul></ul></ul>THE FORCED FLOW LAW: X k = V k X RESPONSE TIME LAW: R = N/X - Z
- 42. ANALYTICAL MODEL <ul><li>Example: </li></ul><ul><ul><li>Consider the problem of a spy from Burger King trying to figure out how many people are at a McDonald's. The spy can't sit inside and watch all day, so must somehow calculate the number from information obtained from outside observations. Thirty customers/hour arrive on the average ( over a long period of time ) and the average customer exits after 12 minutes. </li></ul></ul><ul><ul><li>Assuming that all this time is spent standing in line, what is the mean queue length in the restaurant? </li></ul></ul><ul><ul><li>If the Standard Deviation of the 30 customers is 3, what is the uncertainty of the queue length? </li></ul></ul><ul><ul><li>What happens if both the arrival rate and the service time have uncertainties? </li></ul></ul>THE FORCED FLOW LAW: X k = V k X RESPONSE TIME LAW: R = N/X - Z
- 43. ANALYTICAL MODEL EXAMPLE OF THE SOLUTION OF AN OPEN MODEL: Model Inputs: V cpu = 121 V disk1 = 70 V disk2 = 50 S cpu = 0.005 S disk1 = 0.030 S disk2 = 0.027 D cpu = 0.605 D disk1 = 2.1 D disk2 = 1.35 = 0.3 jobs/sec
- 44. Solution Of An Open Model Model Inputs: V cpu = 121 V disk1 = 70 V disk2 = 50 S cpu = 0.005 S disk1 = 0.030 S disk2 = 0.027 D cpu = 0.605 D disk1 = 2.1 D disk2 = 1.35 = 0.3 jobs/sec Model Outputs: = 1 / D max = 1 / 2.1 = 0.476 jobs/sec X cpu (0.3) = V cpu = (0.3)(121) = 36.3 visits/sec U cpu (0.3) = D cpu = (0.3)(0.605) = 0.182 R cpu (0.3) = D cpu / ( 1 – U cpu (0.3) ) = 0.605 / 0.818 = 0.740 secs Q cpu (0.3) = U cpu (0.3) / ( 1 – U cpu (0.3) ) = 0.182 / 0.818 = 0.222 jobs R(0.3) = R cpu (0.3) + R disk1 (0.3) + R disk2 (0.3) = 0.740 + 5.676 + 2.269 = 8.685 secs Q(0.3) = R( ) = (0.3) (8.685) = 2.606 jobs EXAMPLE:
- 45. SUMMARY OF PERFORMANCE METRICS T is the length of TIME we observed the system. A is the number of request ARRIVALS observed. C is the number of request DEPARTURES observed. W is the ACCUMULATED TIME for all requests within the system – time spent both waiting for and using resources. B is the length of time that the resource was observed to be BUSY. Z is the think time of a terminal user. V k the visit ratio, is the number of times device k is visited per transaction. Arrival Rate Y = A / T Throughput (Departure Rate) X = C / T Utilization U = B / T Service Requirement S = B / C Requests in system N = W / T Residence time R = W / C UTILIZATION LAW U = X S LITTLE'S LAW N = X R RESPONSE TIME LAW R = N/X – Z THE FORCED FLOW LAW: X k = V k X
- 46. OPERATIONAL LAWS <ul><li>Goals: </li></ul><ul><ul><li>To increase facility using performance metrics. </li></ul></ul><ul><ul><li>To be able to calculate limits or boundaries on performance metrics. </li></ul></ul><ul><ul><li>To be able to do "back of the envelope" calculations. </li></ul></ul>UTILIZATION LAW U = X S LITTLE'S LAW N = X R RESPONSE TIME LAW R = N/X – Z THE FORCED FLOW LAW: X k = V k X
- 47. OPERATIONAL LAWS <ul><li>BOUNDARY VALUES: </li></ul><ul><li>The goal here is to make estimations of the outside limits of a performance parameter. We do this by selective "blind" application of our simple laws to complex systems; our results give upper and lower bounds, not an exact answer. </li></ul><ul><li>Example: </li></ul><ul><ul><li>An editor program wants to read 100 disk pages into memory. The resources required for each disk read are: </li></ul></ul><ul><ul><li>5 milliseconds of CPU Processor time. </li></ul></ul><ul><ul><li>4 milliseconds of Controller Processor time. </li></ul></ul><ul><ul><li>2 milliseconds of SCSI Handshaking time. </li></ul></ul><ul><ul><li>10 milliseconds of DISK seek/rotation/transfer time. </li></ul></ul><ul><li>What is the bottlenecking device? Warning!! This is a trick question! </li></ul><ul><li>What is the worst throughput for this system, assuming the editor single threads the reads - waiting until each read completes before starting the next? </li></ul><ul><li>What is the best throughput for this system? How long will it take to read in the 100 disk blocks? </li></ul>
- 48. OPERATIONAL LAWS <ul><li>BOUNDARY VALUES: </li></ul><ul><li>Now that we know the limits for one user, let's expand this for N users . </li></ul><ul><li>Example: </li></ul><ul><li>Multiple users, each with their own copy of the editor, are reading files from the same disk (parameters are the same as the last example.) </li></ul><ul><li>What is the bottleneck device in this case? </li></ul><ul><li>Considering only the bottleneck device, what is the best throughput achievable? </li></ul><ul><li>Now taking into account all devices, what is the BEST throughput N users can achieve ( assuming the requests NEVER get in each other's way?) </li></ul><ul><li>Now taking into account all devices, what is the WORST throughput N users can achieve ( assuming the requests ALWAYS get in each other's way?) </li></ul>
- 49. OPERATIONAL LAWS <ul><li>BOUNDARY VALUES: </li></ul><ul><li>We define DEMAND as the amount of a resource used for a transaction; this is just the number of visits to that resource during one transaction, and the service time used at each of those visits: </li></ul><ul><ul><ul><li>D k = V k * S k </li></ul></ul></ul><ul><ul><ul><li>D total = D = D k </li></ul></ul></ul><ul><ul><ul><li>D max = D bottleneck </li></ul></ul></ul><ul><li>SUMMARY: </li></ul><ul><li> Best throughput overall: X = 1 / D Bottleneck </li></ul><ul><ul><ul><li>Best throughput for N users: X = N / D </li></ul></ul></ul><ul><ul><ul><li>Worst throughput for N users: X = N / ( N * D ) = 1 / D </li></ul></ul></ul>
- 50. OPERATIONAL LAWS Exercise: Consider an interactive system with a CPU and two disks. The following measurement data was obtained by measuring the system: ----------- Observation Data ---------------- Observation interval 30 minutes Active terminals 30 Think time 12 seconds Completed transactions 1,800 Fast disk accesses 36,000 Slow disk accesses 14,400 CPU busy 1,080 seconds Fast disk busy 400 seconds Slow disk busy 600 seconds Determine the visit counts V k , service times per visit S k , and service demands D k at each center. Data At Centers
- 51. OPERATIONAL LAWS Exercise: ----------- Observation Data ---------------- Observation interval 30 minutes Active terminals 30 Think time 12 seconds Completed transactions 1,800 Fast disk accesses 36,000 Slow disk accesses 14,400 CPU busy 1,080 seconds Fast disk busy 400 seconds Slow disk busy 600 seconds Give optimistic and pessimistic asymptotic bounds on throughput and response time for 10 and 40 active terminals. Bounds on Throughput and Response Time
- 52. OPERATIONAL LAWS Exercise: ----------- Observation Data ---------------- Observation interval 30 minutes Active terminals 30 Think time 12 seconds Completed transactions 1,800 Fast disk accesses 36,000 Slow disk accesses 14,400 CPU busy 1,080 seconds Fast disk busy 400 seconds Slow disk busy 600 seconds <ul><li>Consider the following changes to the system: </li></ul><ul><li>Move all files to the fast disk. </li></ul><ul><li>Replace the slow disk by a second fast disk. </li></ul><ul><li>Increase the CPU speed by 50% (with the original disks.) </li></ul><ul><li>Increase the CPU speed by 50% and balance the disk load across 2 fast disks. </li></ul><ul><li>Rank the efficacy of these changes. </li></ul>What changes should be made so response time will not exceed 10 seconds?
- 53. MEAN VALUE ANALYSIS <ul><li>This is an extension of the Operational Analysis we did before. This is the method that should be used on closed systems. </li></ul><ul><li>Assumptions: </li></ul><ul><ul><li>Applies to various service disciplines and service time distributions. (We will only do fixed capacity centers here.) </li></ul></ul><ul><ul><li>The arrival rate is not dependent on the load. </li></ul></ul><ul><ul><li>Arrivals are a Poisson process. </li></ul></ul><ul><li>We will use a technique called Mean Value Analysis that is based on the repetitive application of three equations: </li></ul><ul><ul><ul><li>1. Little's Law applied to the whole network: </li></ul></ul></ul><ul><ul><ul><li>2. Little's Law applied to each service center: </li></ul></ul></ul><ul><ul><ul><li>3. The service center residence time equations: </li></ul></ul></ul>A great book on this, now out of print is at http://www.cs.washington.edu/homes/lazowska/qsp/ Menasce, et. al. do this in Section 12.3 of the text.
- 54. MEAN VALUE ANALYSIS 1. Little's Law applied to the whole network: where X(N) is the system throughput, Z is the think time, and R k (N) the residence time at center k when there are N customers in the network. 2. Little's Law applied to each service center: 3. The service center residence time equations: Delay Centers Queueing Centers where A k (N) is the average number of customers seen at center k when a new customer arrives. The number seen on arrival (in equilibrium) is equal to the average queue length when there is one less customer in the system! So the equations bootstrap!!!
- 55. MEAN VALUE ANALYSIS //////////////////////////////////////////////////////////////////////////////// // This program does very simple mean value analysis. //////////////////////////////////////////////////////////////////////////////// #define MAX_NUMBER_OF_CENTERS 30 int number_of_customers; int number_of_centers; /* # of centers requested by the user. */ int number_of_customers; /* The population in each class */ float input; double think_time; /* The time spent at the terminal */ double demand[MAX_NUMBER_OF_CENTERS];/* Service demand of a center. */ double q_length[MAX_NUMBER_OF_CENTERS]; double residence_time[MAX_NUMBER_OF_CENTERS+1]; // Residence time at a center. double throughput; double system_response_time; // Prototypes void print_the_numbers(int n); This program is at: http://web.cs.wpi.edu/~jb/perf/Lectures/mva.c
- 56. MEAN VALUE ANALYSIS main() { char input_string[80]; int center, n; //////////////////////////////////////////////////////////////////////////// // Get the input information from the user. //////////////////////////////////////////////////////////////////////////// printf( "Number of users: "); gets( input_string ); number_of_customers = atoi( input_string ); printf( "Number of centers: "); gets( input_string ); number_of_centers = atoi( input_string ); printf( "Think Time: "); gets( input_string ); sscanf( input_string, "%f", &input ); think_time = (double)input; for ( center = 0; center < number_of_centers; center++ ) { printf( " Demand for center %d: ", center); gets( input_string ); sscanf( input_string, "%f", &input ); demand[center] = (double)input; } //////////////////////////////////////////////////////////////////////////// // Now that the network is described, we perform the evaluation. // Begin by initializing to the trivial solution for 0 customers. //////////////////////////////////////////////////////////////////////////// for ( center = 0; center < number_of_centers; center++ ) { q_length[center] = 0; }
- 57. MEAN VALUE ANALYSIS //////////////////////////////////////////////////////////////////////////// // The algorithm now iterates through each population value n. //////////////////////////////////////////////////////////////////////////// for ( n = 0; n <= number_of_customers; n++ ) { system_response_time = 0; for ( center = 0; center < number_of_centers; center++ ) { residence_time[center] = demand[center] * ( 1.0 + q_length[center] ); system_response_time += residence_time[center]; } //////////////////////////////////////////////////////////////////////////// // Next use Little's Law to compute the system throughput. //////////////////////////////////////////////////////////////////////////// throughput = n / ( think_time + system_response_time ); //////////////////////////////////////////////////////////////////////////// // Finally use Little's Law to compute center queue lengths. //////////////////////////////////////////////////////////////////////////// for ( center = 0; center < number_of_centers; center++ ) { q_length[center] = residence_time[center] * throughput; } print_the_numbers(n); } /* END OF LOOP THROUGH POPULATION */ exit(0); } /* END OF MAIN */
- 58. MEAN VALUE ANALYSIS //////////////////////////////////////////////////////////////////////////////// // Print the results of each loop //////////////////////////////////////////////////////////////////////////////// void print_the_numbers(int n) { int i; printf( " " ); printf( "Iteration: %d System Response Time: %f Throughput: %f ", n, system_response_time, throughput ); for ( i = 0; i < number_of_centers; i++ ) printf( "Center: %d Residence Time: %f Queue Length: %f ", i, residence_time[i], q_length[i] ); } // END OF PRINT_THE_NUMBERS
- 59. MEAN VALUE ANALYSIS EXAMPLE OF THE SOLUTION OF A CLOSED MODEL: Model Inputs: V cpu = 121 V disk1 = 70 V disk2 = 50 S cpu = 0.005 S disk1 = 0.030 S disk2 = 0.027 D cpu = 0.605 D disk1 = 2.1 D disk2 = 1.35 = 0.3 jobs/sec The INPUT numbers are the same as were used for the open model. We modify the picture so there are no “arrivals” or “departures”, but instead there are terminals – the jobs stay in the picture (which is what makes it closed.) There are 3 terminal users with average think time of 15 seconds; N = 3, Z = 15 . Model Structure: Terminals CPU Disk1 Disk2
- 60. Solution Of An Open Model Model Inputs: V cpu = 121 V disk1 = 70 V disk2 = 50 S cpu = 0.005 S disk1 = 0.030 S disk2 = 0.027 D cpu = 0.605 D disk1 = 2.1 D disk2 = 1.35 = 0.3 jobs/sec <ul><li>To start with, we initialize the queue lengths to 0: </li></ul><ul><li>Q cpu = Q disk1 = Q disk2 = 0 </li></ul><ul><li>Iteration Number 1: </li></ul><ul><ul><ul><li>R cpu = 0.605 sec R disk1 = 2.1 sec R disk2 = 1.35 sec. </li></ul></ul></ul><ul><li>X = 1 / ( 15 + 4.055 ) = 0.0525 </li></ul><ul><li>Q cpu = 0.0318 Q disk1 = 0.1102 Q disk2 = 0.0708 </li></ul><ul><li>Iteration Number 2: </li></ul><ul><ul><ul><li>R cpu = 0.624 sec R disk1 = 2.331 sec R disk2 = 1.446 sec. </li></ul></ul></ul><ul><li>X = 0.1030 </li></ul><ul><li>Q cpu = 0.0643 Q disk1 = 0.2403 Q disk2 = 0.1490 </li></ul>EXAMPLE:
- 61. Solution Of An Open Model Model Inputs: V cpu = 121 V disk1 = 70 V disk2 = 50 S cpu = 0.005 S disk1 = 0.030 S disk2 = 0.027 D cpu = 0.605 D disk1 = 2.1 D disk2 = 1.35 = 0.3 jobs/sec <ul><li>Iteration Number 3: </li></ul><ul><ul><ul><li>R cpu = 0.644 sec R disk1 = 2.605 sec R disk2 = 1.551 sec. </li></ul></ul></ul><ul><li>X = 0.1515 </li></ul><ul><li>Q cpu = 0.0976 Q disk1 = 0.3947 Q disk2 = 0.2350 </li></ul><ul><li>From these numbers we can calculate: </li></ul><ul><ul><ul><li>X(3) = 0.1515 </li></ul></ul></ul><ul><ul><ul><li>R(3) = ( N / X ) - Z = 4.74 </li></ul></ul></ul><ul><li>Q(3) = N - X(3) Z = 0.72 </li></ul><ul><li>There’s a very nice example on Jain, pp 578-9. </li></ul>EXAMPLE:
- 62. CONCLUSION This section has discussed: Queueing Lingo - all the definitions you’ll ever need! Queueing - especially the Single Queue in DETAIL Analytical Models - how to solve a number of complex problems using the equations we already know and love. Works especially well for open models. Operational Laws - drawing conclusions about limits - what to do when we can’t solve the math exactly. Mean Value Analysis - Using the equations in an iterative fashion to solve closed models.

No public clipboards found for this slide

×
### Save the most important slides with Clipping

Clipping is a handy way to collect and organize the most important slides from a presentation. You can keep your great finds in clipboards organized around topics.

Be the first to comment