# CS457 - System Performance Evaluation - Winter 2010

## Public Service Announcements

• class on assignment 3
• possible tutorial
2. Issues out of which on which exam questions could be based.
• anything in the notes with a question mark

# Random Number Detritis

## The Truth about Random Number Generation

How good do they have to be?

Look carefully at how your simulation uses random numbers

• the parts of your program that populate the event set

What type of correlations are you likely to care about? For example,

• lightly loaded single queue/single server
• two types of events
• Common sequences
• AA
• DD

Never send a man to do a boy's job.

# Simulation Detritis

### Generalize Server

• several outputs rather than just one
• other servers, called targets, or
• departure from the system
• output chosen depends on
• request type
• chance (a polite way of saying, I don't know.')
• possibly other aspects of the system state, such as
• varies from instance to instance

### Simplify Server

• Every server has only one queue

### Eliminate Scheduler

• The generalized/simplified server described above can do scheduling.
• Exercise for the reader. How?

### Consequences

• For the most part servers differ only by one table  Target 0 Target 1 ... Target M Type 0 p00 p01 p0M Type 1 p10 p11 p1M ... Type N pN0 pN1 pNM
• You would then create a system by filling in one such table for each server
• A more flexible alternative gives the server a function pointer or specially-named method
• It uses such a configuration table, and
• is able to take other aspects of system state into account.

# Analytic Queueing Theory

## Concepts We Know

#### Parameters

With some change in notation.

1. \lambda - arrival rate

1/\lambda - mean interrival time

2. 1/\mu - mean service time

\mu - service rate

Carefully distinguish between

• Throughput - X - metric - jobs done per second
• Service rate - \mu - parameter - jobs that can be done per second when the server is processing

#### Stable system

Throughput, X = \lambda, arrival rate

• for the steady state phase of processing
• analysing data
• Wait until after the starting transient phase is finished
• Stop before the ending transient phase begins

#### Utilization

U = \lambda / \mu

Stability requires \lambda <= \mu

#### Little's Law

XE(r) = E(n)

E(r) - mean response time

E(n) - mean number of jobs in the system

Note the change in notation

## New Concepts

#### Stochastic process

A sequence of random variables indexed by time: S0, S1, S2, ...

• E.g. state of a system at time t. Why?

#### Markov process

A stochastic process in which S(n+1) is independent of S(0), ..., S(n-1), but may depend on S(n).

• We could say something like, "The state of the system incorporates the past completely."
• Discrete event simulation implicitly assumes that the system is Markovian.

In performance evaluation, when we talk of a Markov process we usually also mean that the next transition occurs at a time distributed by an exponential distribution. Why? (You should already know this.)

• In a Markov process with exponentially distributed transitions the mean transition rate is the only parameter that can vary with state.
• That is, if in state S(j) then the transition rate is \lambda_j

Another useful property of the exponential distribution

• Y1 - arrival time - exponential - \lambda
• Y2 - service time - exponential - \mu
• Ym - when the first of an arrival or end of service occurs - Ym = min(Y1, Y2)
• P(Ym < y) = P(Y1 < y AND Y2 < y) = F1(y) * F2(y) = exp(-\lambda y) * exp( -\mu y) = exp( -(\lambda + \mu) * y )
• Ym is exponentially distributed with mean 1 / (\lambda + \mu)
• Why does this matter?

#### Birth-death process

A special process where only transitions to neighbouring states are possible That is, if we are in S(j) then the next state can be

1. S(j-1), a death occurs.

Death rate \mu_j.

2. S(j+1), a birth occurs

Birth rate \lambda_j.

3. S(j), neither a birth nor a death occurs, or both a birth and death occur.

We now want to examine what happens, in a birth-death process, in the short time between t and t + \Delta t. Use the Poisson distribution

1. P(exactly one birth ) = (\lambda \Delta t) * exp(-\lambda \Delta t) = \lambda \Delta t + terms that are quadratic or higher order in \Delta t
• Write terms that are quadratic or higher order in \Delta t' as o( (\Delta t)^2 )
• lim_x->0 o( x^2 ) / x = 0
2. P(exactly one death ) = \mu \Delta t + o( (\Delta t)^2 )
3. P(exactly zero births ) = exp(-\lambda \Delta t) = 1 - \lambda \Delta t + o( (\Delta t)^2 )
4. P(exactly one birth ) = 1 - \mu \Delta t + o( (\Delta t)^2 )
5. P(more than one birth and/or death) = o( (\Delta t)^2 )

Exercise for the reader. Explain how it is that this is equivalent to only Arrival and Departure events affecting the system state.