# Solution to Sample Exam HS2010/11

## Question 1

${\displaystyle \mu =1/E[s]=1/0.005s=200}$

${\displaystyle \lambda =100}$

The system is stable if ${\displaystyle \rho <1\Leftrightarrow \lambda <\mu \implies \lambda <200}$.

One can put less then 100 additional operations per second, before the system becomes unstable

## Question 2

${\displaystyle \rho =\lambda /\mu =\lambda \cdot E[s]}$

Utilisation: ${\displaystyle \rho =75\cdot 0.003=0.225=22.5\%}$

## Question 3

λ = ρ * m * μ
μ = 1 / 0.01 = 100
λ = 1 * 2 * 100 = 200
max. request rate with a stable system = 199

## Question 4

${\displaystyle E[T]=150{\frac {ms}{req}}}$

${\displaystyle \lambda =600{\frac {req}{min}}=10{\frac {req}{s}}}$

${\displaystyle N=E[T]\cdot \lambda =1.5}$

${\displaystyle A_{memory}={\frac {600KB}{N}}=400KB}$

## Question 5

${\displaystyle E[n_{q}]=4packets}$
${\displaystyle E[s]={\frac {1}{\mu }}=0.4ms}$
${\displaystyle E[w_{q}]=20ms}$
${\displaystyle E[w]=E[s]+E[w_{q}]=20.4ms}$
${\displaystyle \lambda ={\frac {E[n_{q}]}{E[w_{q}]}}=200{\frac {packets}{sec}}}$
${\displaystyle N=\lambda \cdot E[w]=200{\frac {packets}{sec}}\cdot 20.4ms=4.08packets}$

## Question 6

For the case ${\displaystyle \rho <1}$ we have an arrival rate that is lower than the service rate and thus any incoming requests can be serviced in time.

When ${\displaystyle \rho =1}$ the system is saturated because the rate of incoming requests is equal to the service rate. Random effects (we assume an exponential distribution in both arrival rate and service rate) lead to potentially unstable behaviour.

## Question 7

 Dem Autor des Lösungsvorschlags stellt sich eine Unklarheit betreffend der Prüfungsfrage oder deren Lösung: Hilf mit, die Qualität dieser Seite zu verbessern, indem du eine eindeutige Lösung einfügst oder auf der Diskussionsseite dieses Themas deine Meinung äusserst.

No, in a closed system, the request rate is the same as the throughput, because a client only requests again once it has gotten an answer. Therefore, a drop like that cannot be seen because fewer requests will be sent by each client per second if the response time is longer.

## Question 8

Open System
Refer to [1], Page 9 and 10.

Closed System
Refer to [2], Page 46 and 47.

## Question 9

It depends ;)

As long as the management overhead of the queue is negligible compared to the workload itself, a single queue with m consumers is more efficient, because if there is a queued request and an idle consumer, the request will be assigned to this consumer. With multiple queues with a single consumer, one queue can be overloaded while the others are empty.

If queue management overhead is big compared to the workload itself, multiple queues can be more efficient as they avoid the overhead.

## Question 10

The System under Tests includes all aspects involved with providing the services of the system, including hardware and software.

The Component under Study refers to the component of the SUT that we want to study, eg. to determine the effect on a certain service of the system.

From the Slides (Set 5, Slide 3):

• We apply load to the SUT
• We measure performance of SUT
• We want to understand the CUS!

## Question 11

We want to determine the effect the amount of RAM in the server machine has to performance of a postgres installation with respect to a dataset. We setup PostgreSQL populated with the TPC-H dataset and run the specified queries locally in a defined succession. We vary the amount of RAM in the server and measure throughput and response time.

The System under Study consists of the Server machine, OS and Postgres parameters. The CUS is RAM

See Question 10

## Question 13

Resolution: The "fine-grained-ness" of measurements.

Input Width: Amount of data/information logged/traced/measured

• Drop
• Overwrite
• Stop / Abort

## Question 15

To achieve meaningful monitoring data you need to provide some sort of common (synchronized) time or at least ensure that causality can be observed. Furthermore, it is usually desired to merge measurements which itself can be a challenge.

## Question 16

A and B are non-interacting:

• A1/B1-A2/B1 = A1/B2-A2/B2 = 5
• A1/B1-A1/B2 = A2/B1-A2/B2 = 6

C and D are (additively) interacting:

• C1/D1-C2/D1 = 11 ungleich C1/D2-C2/D2 = 12
• C1/D1-C1/D2 = 6 ungleich C2/D1-C2/D2 = 7

## Question 17

Factors: A, B, C

Levels: -1, 1

Sign Table:

 I A B C AB AC BC ABC ${\displaystyle x_{0}}$ ${\displaystyle x_{A}}$ ${\displaystyle x_{B}}$ ${\displaystyle x_{C}}$ ${\displaystyle x_{AB}}$ ${\displaystyle x_{AC}}$ ${\displaystyle x_{BC}}$ ${\displaystyle x_{ABC}}$ always one vary over all possible values =A*B =A*C =B*C =A*B*C 1 -1 -1 -1 1 1 1 -1 1 1 -1 -1 -1 -1 1 1 1 -1 1 -1 -1 1 -1 1 1 1 1 -1 1 -1 -1 -1 1 -1 -1 1 1 -1 -1 1 1 1 -1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 -1 1 1 1 1 1 1 1 1

${\displaystyle y=q_{0}+q_{A}\cdot x_{A}+q_{B}\cdot x_{B}+q_{C}\cdot x_{C}+q_{AB}\cdot x_{AB}+q_{AC}\cdot x_{AC}+q_{BC}\cdot x_{BC}+q_{ABC}\cdot x_{ABC}}$

## Question 18

The warm-up phase denotes the time the system does not behave as during the average case, for effects such as cold caches.

The cool-down phase denotes the time the clients start shutting down and completing their runs. Response time and throughput may decrease.

## Question 19

The system can be modelled as a simple M/M/m queue. The service rate of a dequeuer thread can be expected to depend on the amount of db connections: ${\displaystyle \lambda =f(m)}$ and total service rate ${\displaystyle m\cdot \lambda =m\cdot f(m)}$

Throughput is maximal if the service rate is maximal.

## Question 20

The two graphs do not match. When the throughput stays constant the the response time has to increase with increasing number of clients. But the response time graph shows a constant response time, this on the other hand would mean that the througput has to increase with increasing number of clients. Therefore this makes no sense.

Graph a) states around 40 queries/minutes, that means one query takes > 1 second. But Graph b) shows a response time of around 80ms, which clearly is less than 1 second. A sign that this 2 graphs can not even belong to the same system.

The system can handle around 40 queries/minutes with a guaranteed response time of 80ms. To make sure that this response time is also guaranteed when the load increases, the system queue is finite and drops all requests that would lead to an overload of the system.

 Dem Autor des Lösungsvorschlags stellt sich eine Unklarheit betreffend der Prüfungsfrage oder deren Lösung: Stelle die Frage hier! Hilf mit, die Qualität dieser Seite zu verbessern, indem du eine eindeutige Lösung einfügst oder auf der Diskussionsseite dieses Themas deine Meinung äusserst.

## Question 21

90% of the values lie in the interval ${\displaystyle 10\pm \sigma }$

## Question 22

System B is better in every aspect that we can analyse in this graph.

It has better average performance and the standard deviation is relatively smaller for all cases except for one client.

This means that we get a more consistent and higher performance.

## Question 23

${\displaystyle p_{n}=\lambda \cdot p_{n-1}+\mu \cdot p_{n+1}+p_{n}\cdot (1-\mu -\lambda )}$

${\displaystyle p_{n}=\rho ^{n}\cdot p_{0}}$

${\displaystyle p_{0}=1-\rho }$ for ${\displaystyle \rho <1}$

${\displaystyle p_{n}=\rho ^{n}\cdot (1-\rho )}$

## Question 24

${\displaystyle E[n]=\sum _{k=0}^{\infty }p_{k}\cdot k=\sum _{k=0}^{\infty }(1-\rho )\cdot \rho ^{k}\cdot k}$
${\displaystyle =(1-\rho )\cdot \rho \cdot \sum _{k=0}^{\infty }\rho ^{k-1}\cdot k}$
${\displaystyle ={\frac {(1-\rho )\cdot \rho }{(1-\rho )^{2}}}={\frac {\rho }{1-\rho }}}$

## Question 25

${\displaystyle E[w]={\frac {E[n]}{\lambda }}}$ (Little's Law)

## Question 26

while CI > 2 * sigma
x_new = doExperiment
n = n+1
mean = (mean*(n-1)+x_new)/n
t = t(two_sided,n-1,95%) //table look up
CI = mean +- (t*s/n^-2)
end

 Dem Autor des Lösungsvorschlags stellt sich eine Unklarheit betreffend der Prüfungsfrage oder deren Lösung: How to recompute s? Hilf mit, die Qualität dieser Seite zu verbessern, indem du eine eindeutige Lösung einfügst oder auf der Diskussionsseite dieses Themas deine Meinung äusserst.

Alternative Solution (python):

def getVariance(xs, mean):
sum = 0.0
for x in xs:
sum = sum + ( x - mean )**2
return sum/(len(xs)-1)

# Initialization
xs = []
mean = 0

# Actual Code
while True:
x = doExperiment()
xs.append(x)
mean = ((mean * (len(xs)-1)) + x) / len(xs)

if len(xs) == 1:
# We need to have at least two runs
continue

s = getVariance(xs, mean)**0.5
t = table_lookup_t('two_sided', len(xs)-1, 0.95)

if t/(n**0.5) <= 1:
break


Where we used:

gap = (mean + t * s / (n**0.5)) - (mean - t * s / (n**0.5))
# Is the same as:
gap = 2 * t * s / (n**0.5)

if gap <= 2 * s:
# Is the same as
if 2 * t * s / (n**0.5) <= 2 * s:
# Is the same as:
if t / (n**0.5) <= 1:


## Question 27

 Diese Aufgabe wurde noch von niemandem gelöst und wartet noch immer auf einen Musterlöser. Hast du dieses Fach bereits besucht? Hilf mit, die Qualität dieser Seite zu verbessern, indem du eine plausible Lösung für diese Frage notierst!

## Question 28

N: Number of clients

1 <= N <= 8: System behaves normally, is not yet saturated.
Response time is constant.

9 <= N <= 18: System behaves normally, is saturated.
Response time grows linearly, with slope ${\displaystyle \alpha }$.

19 <= N: System is thrashing. Throughput collapses.
Response time might grow with slope ${\displaystyle \beta \geq \alpha }$, or be small and constant, if only 1 client gets successfully served by the system, and we only count the successful queries.
In general, the system behaves unpredictable and unstable.