 and welcome to the last lecture in the course on Introduction to Computer and Network Performance Analysis using Queuing Systems. I am Professor Varshaapte and I am a faculty member in the Department of Computer Science and Engineering IIT Bombay. So, today we will look at some examples of the mean value analysis method that we learned in the previous lecture and I will also just make some closing remarks since this is the last lecture of this course. So, just as usual I am showing some slides for revising you know just for your reference this is how a closed queuing network is depicted. These are the parameters then we have the standard set of metrics just to recall again that the main index of load the way we show load or we count load for a closed queuing system is by the number of users. When I say load level here it is the number of users here these are the number of users or when there is not a clear user station it is just the number of customers or requests circulating through this closed system. We know that request can never leave or join from anywhere else. So, there will be a fixed number M of requests that are circulating through the system and that is something we often called the load level and every metric in a closed queuing system is a function of that load level. Just like in the open queuing system every metric was actually a function of the arrival rate the arrival rate was the index of the load. We had the same sort of metrics we did not follow the convention of putting this lambda which was the external arrival rate in the brackets because there was no iterative algorithm or anything in terms of lambda. Here we put this M explicitly because the mean value analysis is an iterative algorithm where we derive all of these parameters where we starting from n i M minus 1 we derive all of these. So, it is a required notation to put this M in the bracket and make it an explicit argument of all of these metrics that is why you will find everything is parameterized by the load level M. And i of course denotes the nodes this is i is 0 and i is equal to 1 and things like that. So, please go through the slides and revise the previous lecture to revise recall what was mean value analysis today we are just going to do examples. So, this is again the algorithm itself the mean value analysis recursion itself the base case is that the when there is M is equal to 0 means there is no request in the system obviously number of customers average number of customers at each queuing node is going to be 0 this is where we start and then we start with the induction process where we say that the M i the recursion process where we know that we assume that n i M minus 1 is known and then we go through all these steps and we get n i M. So, we start from n i M minus 1 and we reach n i M and that is how the recursion is completed. So, again these slides are just for your reference. So, let us look at this example closed queuing network. So, if you remember your lecture on the example of the open queuing network you will quickly realize that this part of the server system looks quite familiar, right. We had the same description there is a website that supports two types of requests one and two which both come to the same web server, but then they split into two different kind of application server and database server subsystems and this is the two application servers and the two database servers and there is a web server. So, the server subsystem is the same we just choose to model it as a closed system now. In the open system we simply had a arrival rate here and this part here was an exit. We just this arrow just went into nowhere. So, there was an entry and there exit. Now we have a explicit client node and these are our M clients 1, 2, M and they are going to have a think time which is going to be denote by H. So, the reason why we sometimes choose to represent a system as a closed queuing network this was covered when we talked about closed queuing systems. Basically if the number of users of this system is small it is not like 10,000, 20,000 or something like that and the think time is also small. So, it is like maybe 100 call center agent are in a request response loop where let us say the think time is just 4 seconds or 6 seconds or 2 seconds. It is not that I am a user of some very public website like Google or something and I visit the Google website after many hours so if I were to model the Google website I would definitely model it using open external arrivals because there are billions hundreds of millions of users of Google and representing them explicitly will not make sense. But if it is a small system the small user pool then we use closed systems. So, this time for this same server system we are choosing to model it using a closed queuing network. So, again we have for the server subsystem it is the same thing. So, we have for the server subsystem we have the same parameters. We have the average number of visits we need to start with that the VW, VA1, VA2, VD1 and VD2 and we have the per visit service times the tau W, tau A1, tau A2, tau D1, tau D2. These are the per visit service times. But the difference now is that we will have this M users with the think time H this we need. And then we have the typical concerns some questions will be slightly different for this network but otherwise we do want to find the system throughput we want to find the utilization of each server and the system response time for a given load level. And for the system as such we want to find the bottleneck server, we want to find the bottleneck throughput and we also want to find the number of users that can be supported. So, the questions about the bottleneck server and the bottleneck throughput a little bit of thought should suggest to you that this may not depend on whether we represent the queuing system as open or closed. We are talking about simply what is the maximum rate here and which among these nodes is going to be determining that rate. How is that related to whether we are modeling the arrivals as open or closed. And that also is suggested by the fact that to answer this question we only use the visit counts and the service times. So, this is nothing to do with closed or open queuing network and these answers are going to be the same. So, I am not going to repeat that calculation. We had calculated the service demands as this I mean that is a simple calculation is the 30 comes from the 10 multiplied by 3, 26.7 comes from 13.3 multiplied by 2, 50 comes from 25 multiplied by 2 again and 28 comes by 9.3 multiplied by 3 and 40 comes from 20 multiplied by 2. So, these are the service demands. We have to find the service demands. The 50 is again is going to be the bottleneck service demand which results in the bottleneck throughput of 20 requests per second and A2 again is the bottleneck server. So, this part does not change at all. The next things will be system throughput, node throughput, utilization of each server for a given number of users and given think time. This part now is very different. We do not have the external arrivals. When we have external arrivals remember each of these queues for open Qn becomes an M1 Q and this gives us the response time and so on. This is not what is going to work for closed queuing network. We know that for closed queuing network to answer all these questions we need to do mean value analysis. So, let us you know start it at m equal to 1, at m equal to 0 everything is just 0. So, let us start at m equal to 1. At m equal to 1 with the think time as given as 2 seconds, let us assume this is a parameter that is also given as 2 seconds. Clearly all the response times if there is only one user here, all the response times are just going to be equal to the service times. So, all r i at r i and the cycle time then will be simply this summation. Remember the cycle time consists of time from entering here to leaving here also back. So, this will include the multiple visits that the request makes to all these servers. So, at each visit the time spent at the server is going to be tau i because there is no Q, it is going to just be the service time. But and if you want to count the cycle, then the time here is h. So, the cycle time will be summation i v i tau i plus h which in this case this is 2 seconds which is 2000 milliseconds, the rest of it you can calculate this v i tau i using these basically is going to be the sum of these 30 plus 26.7 plus 50 plus 28 plus 40 that is going to be actually 174.7 and that is added to 2000 milliseconds. So, this is the r cycle at 1. Now, once we have r cycle at 1, I have the overall throughput, this lambda sis, the lambda sis, we apply a little slot to the whole region and we get the lambda sis is going to be 1 divided by the response time, the cycle time. So, it is basically 1 divided by 2174.7 in terms of milliseconds if you want it as request per second, we have to multiply it by 1000. So, this is what we get as a throughput when there is only one customer in the system, it is 0.46. So, this is one iteration of the mean value analysis. So, I will just show you in this what we have done so far is we have actually just calculated the system response time using this for m equal to 1. And we have we already knew we did not have to really use this recursion r i for 1 was known as tau because n i at 0 is 0. So, we directly used r i 1 is equal to tau i and then we calculated the cycle time for m equal to 1 and then we calculated the throughput. So, this is where we are in our steps of the MVA algorithm. So, now, we move on at the result of the previous one was that we get system throughput at m equal to 1 as 0.46 request per second. So, now, we move on, we look at what else the next step remember this is once you have gotten the system throughput, you can actually get the node throughput also. So, lambda i 1 is going to be V i of lambda sys at 1. So, this you can calculate for each of the nodes and then the number of customers at each node is going to be by Little's law. This is a throughput at each node, this is this multiplied by the time at each node at level 1 we know it is going to be tau i. So, we get the average number of customers at each node. For example, if we do the calculation for the web node, we are trying to find n w when the number of customers in the system is just 1. So, that is V w multiplied by lambda sys 1 multiplied by tau w. So, this is 10 is V w, this is lambda sys 1 and this is tau w in seconds. So, we multiply all of this since this is request per second we want this in request per seconds and that gives us 0.013 as the average number of customers at the web server. Now comes this step remember now actually the m equal to 1 iteration completes here. Now we go to m equal to 2 and when there are two customers in the system, this is Sevchik Mitrani theorem tells us that R w 2 that is the response time at the web server for example, is going to be the average number of customers at the web server when there is only one customer in the system plus one plus this customer itself multiplied by the service time and that gives us this number. So, again I will show you what it is that we are applying now we are applying this step. We applied this for m equal to 2 we just n for i equal to the web server R w 2 we said was equal to 1 plus n web server at 1 multiplied by tau at web that is what we did. So, let us go back yeah this is what we did. So, clearly you know doing this is tedious if we really want to find what if we want to find the throughput when you know m is equal to some 30. Obviously, this takes a lot of time this is not something that can be done by hand it was just shown to you to show how this can be done. So, we will continue this iteration in a spreadsheet and I will show you the implementation of this MVA for this particular queuing network in a spreadsheet. Yeah let us look at this spreadsheet now in this spreadsheet this the tau is just a label and this these values show all the tau eyes for this is the think time 2000 milliseconds this is the tau for web server this is the tau for application server a 1 this is for a 2 this is for d 1 and this for d 2. So, we can look at the headings here to remember what these correspond to this is w this is going to be the response time column, but this is w a 1 a 2 d 1 and d 2 and this is the visits the C node shows the client node and we know that the visits in a closed queuing network are relative visits and the visits are relative to one visit to the client node right. So, we have 1 here we have 10 here and all these are as were shown in the parameter slide. Now, let us see what is going on here. So, what you see here is these columns are going to be showing the average number of customers at each of these nodes. These columns are going to show the response times from column h to column m these are response time at each of the nodes. This column as it shows the cycle time this is the system response time this is the system throughput and these are the utilizations again of the web a 1 a 2 d 1 d 2 and this I am actually just finding the slope of the system response time to just understand how it is. So, this is we start the iteration at m equal to 0 as you can see the yellow ones are actually values that we are just starting with these are the parameters and the all the average number of customers are 0 at m equal to 0. This is m is the what it means usually the load level and then the first thing that we do is we write these response times in terms of the previous values of the ends. So, you will see here except for the client node of course, this is always is going to be the think time everywhere as m grows this does not grow. So, this one is the formula shows here as I 10 multiplied by 1 plus C 13 what is I 10? I 10 is the tau and 1 is whatever needs to be inside the bracket for the Sevetik Mitrani theorem plus C 13 is going to be the corresponding. So, this is this row here is row number 13 that is why the this cell is actually C 13. So, similarly R A 1 is going to be J 10 which is this value here multiplied by 1 plus D 13 and D 13 is going to be this and so on for each of the response times. Then the cycle time is actually the sum product meaning we are doing the V i tau i summation here of this the row number 11 which is this row and then the particular row that we have to multiply. So, for the first m equal to 1 this is going to be V i tau i but for the rest of the larger ms actually R cycle should be V i R i it should be V i multiplied by response times. So, we are actually going to multiply it by response times. So, this is multiplied by the row 11 here row 14 here for example, we can see 2, 1, 8 this one here the visits are being multiplied by row 18 which is basically this row of response times. This spreadsheet will be shared with you for you to study I am just kind of explaining a little bit about it. Our system is of course the cycle time minus the think time that is what this is showing. Throughput is also easy it is going to be this first column m divided by cycle time. So, that is what it is showing. So, for example, here it is showing a 18 by n 18 utilizations are going to be the node throughput multiplied by the service times. So, you will see that you take the system throughput from the column P and then you are multiplying it by the visits that is from this 11 and then multiplying it by the service time. So, you get the node throughput multiplied by the service times and that is what will happen for each node. And the slope actually I am just doing a slope calculation of the system response time. So, I am just taking this value minus the previous value we know that the difference here is by 1. So, I am not dividing it by 1. So, now that I have explained these calculations let me just show you that this is a way MVA has to be done. You either write a program like a C program or Python or something to do it or you can do it in a spreadsheet it cannot be done by hand. So, if we continue this iteration we can see that let us see what is happening to the utilizations. We have expect that the utilization of the bottleneck server should reach one first. So, that is what exactly happens this is the bottleneck server and it reaches one before all the other utilizations reach one. We expect that the system throughput should flatten out at 20 requests per second. So, this is in milliseconds. So, that is why it is 0.02 everything here is milliseconds because even the response times and everything here are in milliseconds. Now, the slope here remember the asymptotic value of response time is actually m tau minus h. So, the slope here is expected to be the slope of a queuing system with one server is m tau minus h. The slope of a queuing network is actually the bottleneck service demand. So, that is what this is showing the slope ends up being 50 milliseconds which if you remember is the bottleneck service demand for this queuing network and that is verified numerically here. So, you can take a look at this separately. What I just wanted to show you is that you do need a spreadsheet or a program to calculate all of these things. So, let us go back to our slides. So, I have just copied this response time graph here to show that this is one of the results of doing the MVA in a spreadsheet and then you can do this calculation. So, this concludes the example for a simple sort of for the example queuing network to do just the mean value analysis. You can look at the sheet, you can also try it by hand little bit and see whether you get the same values as the sheet. One exercise is that you could start at like let us say start with the values at m equal to let us say 30 and see whether you can derive the values at m equal to 31 and check whether they are the same as that were seen in the spreadsheet. So, quickly now I want to show you one last view of the same web server that we have been looking at. We have seen it in the open load context, in the closed load context and now I actually want to show you in the closed load we at the time we saw the web servers measurement results we did not know MVA. So, MVA can be so we have the web server of course is a simple closed system right. We do not have a queuing network but that does not mean we cannot apply MVA to it because otherwise we only knew how to calculate the asymptotes remember that all the intermediate values of m's were just related to each other. So, to actually find the values for m which is not equal to 1 or which is not infinity we do need mean value analysis. So, I am going to show you results of mean value analysis of a measurement experiment with some slight interesting differences than what we have seen before. This time our web server has 4 cores and the script running time is 40 milliseconds and since it is a closed load we have to have a think time for the users and the think time is 1 second. So, let us look at the results. So, the first thing here is the throughput. Now let us just think through whether we could have whether these values make sense. First before we look at the graph let us recall that the tau is 40 milliseconds there are multiple cores here. So, we have a C which is 4. So, given tau 40 milliseconds the mu is 25 requests per second 1000 by 40. So, that is one course maximum capacity and C mu will be around 100 requests per second. So, this is our predicted maximum throughput for the system. Let us see what happens clearly the MVA goes towards 100 and that is exactly where it goes towards. The orange curve is showing the measurement results and for some reason the measurement results are showing a little better throughput than 100 requests per second. One explanation is that somehow the in a real system at a higher load each request was taking less time this can happen sometimes some startup effects are eliminated when the system is slower it takes a little longer to work on some requests. You will see these slight differences in real systems. The third graph shown here is for a different method of analysis called simulation. We will not be going into that in this course. So, you will see these curves here because they are actually a result of some project work that was done by some students but we can ignore those curves for this lecture. Let us look at server utilization again clearly at it goes to 1 and the match here between the MVA and measured is quite well at the whole of the graph. Of course, here it is they are all going to once and the match will be correct why is it going to be any different. But even at lower levels values of load of number of users the match is not bad and we can actually see you should do after the lecture the check whether let us say the throughput at 60 or something if you take let us take an example let us take throughput at 70. And if we multiply that by tau and divided by C will we get this value we can do that calculation right now let us look at throughput at 70 it is around 60 something. So, 60 request per second multiplied by tau which is 40 divided by C. So, this is this is millisecond. So, we should and this is request per second. So, we should divide this by 1000. So, we get 600 by 1000 is 0.6 let us see whether that is approximately what you get here. So, you can see that the server utilization at number of users equal to 70 is equal to 0.6 you have to see the measured line the red line and it is exactly at 0.6 and that matches almost perfectly maximum number of users also that this system can support. So, if you want to find where the knee of the curve is all of these graphs actually predict the knee correctly at around 100 or 110 whichever way you want to say it. Even if we just did MVA also we would say that the maximum number of users this system predicts is 100 should support is 100 and even with measurement. So, what this shows is that you did not really have to do the measurement you could have done the calculation and also said that this system supports 100 users. Otherwise, the match between this is this is MVA and this is measured. The actual web server here is more complicated than the MVA. So, the time so the match is a little less good. So, with this we come to the conclusion what we did in the last 20 lectures almost a total of 10 hours in this course was. We did a sort of a crash course on basic queuing theory that this forms the foundation of the performance analysis of computer systems and networks. We focused on the queuing systems based methods and we gave some examples and did some case studies with measurement to sort of show how far queuing theory can go in actually helping you understand practical system performance. We covered a lot of ground and what we did not do was a lot of queuing theory courses, queuing systems based performance analysis courses go into details of stochastic processes which is actually important if you really want to deeply understand queuing systems. But this course we have not done that we kept things at an intuitive and a simple level in terms of the mathematics. But we still covered a lot of ground and many laws were covered. Most important one here is Little's law. If you forget everything also of this course please always remember Little's law and please remember how to apply it. And we strongly encourage you to apply these concepts in your day to day projects in computer science. Thank you for doing this course and best wishes.