Advertisement
Guest User

Untitled

a guest
Apr 25th, 2015
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.36 KB | None | 0 0
  1. COMP28112 – Lab exercise 3
  2. ‘The Quest for Performance’
  3. Introduction
  4. When engineering a new distributed system, it is often the case that one needs to build a
  5. model of the system first in order to guarantee a certain level of performance. For example,
  6. when designing the server for exercise 2, we had to assess various performance related
  7. aspects, such as response time to the multiple requests during a typical lab session, or
  8. capacity requirements, such as the disk space needed to maintain a log file. Assuming, in the
  9. latter case, that the average size of the logs generated during one lab session is 10MB, it
  10. wouldn’t be a good idea to use a disk with only 10MB free space: after every lab session we
  11. would have to clear the logs!
  12. It is true that the server for exercise 2 does not have to cope with particularly high loads. The
  13. messages are short, the requests do not require lots of computational time, and the number of
  14. users is not that high. However, in a more demanding, real-world scenario, the server side
  15. will face higher loads; still the system designers need to ensure that the overall performance
  16. will meet a certain level. To do this, the designers will have to make several decisions: how
  17. many servers shall be used, what bandwidth must be available and so on.
  18. These are typical capacity planning decisions. According to one definition, “capacity
  19. planning is the process of predicting when future load levels will saturate the system and of
  20. determining the most cost-effective way of delaying system saturation as much as possible”
  21. [1].
  22. By definition, capacity planning implies the existence of some ability to assess the
  23. performance of a system under different circumstances. Since such an assessment often
  24. needs to take place before the system has been built (it would be painful to find out about the
  25. failure of a system after it has been built! In addition, an extensive range of assessments
  26. might be too time-consuming to carry out in a real system.) the only way to perform the
  27. assessment is to use an abstract model of the system. With this model, one can make use of
  28. either mathematical analysis or computer simulation1 to obtain an answer to a range of
  29. questions. With mathematical analysis, one expects to derive closed formulae answering
  30. these questions. With computer simulation one develops a computer program that is trying to
  31. evaluate the state of a system (often the question is how the state varies over time, in which
  32. case the simulation may need to consider discrete time intervals) using a large number of
  33. different input scenarios (which may be randomly generated).
  34.  
  35. 1
  36. http://en.wikipedia.org/wiki/Computer_simulation he Exercise
  37. In this exercise, you are going to use computer simulation to evaluate the performance of the
  38. server-side of a distributed system under different circumstances.
  39. 1. In this system, requests keep arriving from the clients; these requests involve some
  40. computation at the server (we don’t care what is computed). The average time between
  41. the arrival of two successive requests is an input parameter (expressed in time units,
  42. which is the unit of time used in the simulation – see below).
  43. 2. When these requests arrive, they are initially stored in a queue. The maximum queue size
  44. is an input parameter. Any requests that arrive when the queue is full are rejected.
  45. 3. A number of servers (or CPUs, if you like) may fetch requests from the queue for
  46. execution. Only one server can fetch requests at a time. Clearly, a single server cannot
  47. execute multiple requests at the same time.
  48. 4. The time needed by the server to complete every request is also an input parameter
  49. (expressed again in time units).
  50. Taking as an input the four parameters described above, you are going to write a program to
  51. simulate the system and show, over a period of 1,000,000 time units:
  52. • The percentage of requests that was rejected.
  53. • The average queue size (that is, how many requests were in the queue on average)
  54. during the simulated period of time.
  55. • The average response time of the system to each request that was processed during
  56. this period of time (the response time is computed as the difference between the time
  57. the request has completed its execution on one of the servers and the time the request
  58. arrived to the queue).
  59. Thus, the time period you are going to simulate is 1,000,000 time units. Remember that
  60. during one time unit, only one new request may arrive to the system and only one request can
  61. be assigned from the queue to a server for execution. If, during one time unit, the queue is
  62. empty and a new request arrives, this request can be assigned to an idle server (if there is
  63. one).
  64. Hint
  65. The key to write the simulation is to model what happens during each time unit and keep
  66. track of how what happens affects the values of all the parameters you need to compute. For
  67. example, if at some point in time a new request arrives, you need to check if there is space in
  68. the queue, record its arrival, update the queue size, etc… After this check, you need also to
  69. check if there is an idle server and assign a request for execution… Throughout these checks,
  70. you need of course to update all the information used to produce the statistics you need to
  71. generate at the end of the simulation! ou can use any programming language you like. You will need to use an appropriate library
  72. function/method in this language to produce random numbers to simulate the arrival of
  73. requests over time. It is suggested that this is your first step and you start by thinking how
  74. you can randomly choose those points in time when a new request arrives (based on the value
  75. of the arrival rate – your first input parameter).
  76. Regarding the input parameters of the program (which might be entered at command line or
  77. read from a file – whatever you prefer – but they should not be hard-coded), you can assume
  78. that the maximum size of the queue may be any number between 10 and 10000, the number
  79. of servers may be any number between 1 and 50, and the execution time of a request may be
  80. any number between 1 and 100 time units. Apparently, the mean time between successive
  81. arrivals may be any number between 1 (that is, requests arrive all the time) and 1000000 (the
  82. latter meaning that, on average, one request is expected throughout the simulation).
  83. If you run on a linux machine the executable
  84. /opt/info/courses/COMP28112/ex3/lab3 (or $COMP28112/ex3/lab3)
  85. with command line parameters
  86. queue_size arrival_rate number_of_servers execution_time
  87. (e.g., lab3 10000 3 2 25) you will get answers which are similar to what you should
  88. be getting with your program (due to the randomness introduced in the program, there will be
  89. small variations between different runs with the same parameters; in practice, for each set of
  90. parameters, one would expect that multiple runs would take place to obtain a better idea
  91. about the behaviour of the system).
  92. Marking Scheme
  93. Correct simulation of time 1
  94. Correct simulation of random arrivals 2
  95. Correct simulation and computation of queue size 2
  96. Correct simulation of all the rest 2
  97. Correct computation of output statistics 2
  98. Quick completion of each simulation run (no more than 5 sec) 1
  99. NB: You should put your solution in a file called solution3 in a directory called ex3 in
  100. your COMP28112 directory.
  101. References
  102. [1] D. A. Menascé, V. A. F. Almeida. Capacity Planning for Web Performance: Metrics,
  103. Models & Methods. 1998. Prentice-Hall.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement