CS457 - System Performance Evaluation - Winter 2010
Public Service Announcement
- pdf available
Lecture 29 - Examples of Birth & Death Processes
Birth & Death Processes
Derivation
- See previous lecture.
- See pdf
Basic Result
dp_j(t) / dt = \lambda_j-1 p_j-1(t) + \mu_j+1 p_j+1(t) - (\lambda_j +
\mu_j) p_j(t)
Steady State Solutions
Reminder. Transient and steady states are different. We
are interest in the steady state. The steady state is defined as having
stationary (not time-dependent) probabilities.
That is: dp_j(t) / dt = 0.
Then
- \lambda_j-1 p_j-1(t) + \mu_j+1 p_j+1(t) - (\lambda_j + \mu_j) p_j(t) =
0
Solve this iteratively
- l0 p0 = m1 p1 => p1 = (l0/m1) p0
- (l1 + m1) p1 = l0 p0 + m2 p2 => (l1 + m1) (l0/m1) p0 = l0 p0 + m2 p2
=> p2 = p0 (l1*l0 / m1*m0)
- ...
- pn = p0 (l_n-1*...*l1*l0 / m_n-1 *...*m1*m0)
- Set p0 by the condition sum_n pn = 1.
This looks like you could solve it further, but you can't. How could you
possibly solve the differential equation above, in that case?
What do we do? Try simplified examples.
The Simplest Example M/M/1
First M: Markovian (Exponential) birth (interarrival) times
Second M: Markovian (Exponential) life/death (service) times
1: one server
Assumptions:
- \lambda_j = \lambda
- \mu_j = \mu
- Define r = \lambda / \mu
Then
- pn = r^n p0
- p0 = 1 / (1 + r + r^2 + ...) = 1 - r.
- pn = (1 - r) * r^n.
Useful tricks.
- S = 1 + r + r^2 + r^3 + ... = 1 + r * ( 1 + r + r^2 + r^3 + ... ) = 1 +
r * S
Therefore, S * (1-r) = 1and S = 1 / (1 - r)
- dS/dr = 1 + 2r + 3r^2 + 4r^3 + ... = (1 + r + r^2 + ...) + ( r + 2r^2 +
3r^3 +... ) = S + r ( 1 + 2r + 3r^2 + ... ) = S + r dS/dr
Therefore, dS/dr = S + r dS/dr and dS/dr = S / (1 - r) = 1 / (1 -
r)^2
But E(N) = sum_n n*p_n = (1 - r) (r + 2 r^2 + 3 r^3 + ... ) = (1 - r )
(dS/dr - S) = (1 - r ) (1 / (1 - r)^2 - 1 / (1 - r) ) = 1 / (1 - r) - 1 =
r / (1 - r)
Results
The mean number of jobs in the system is E[N] = sum_n n * (1 - r ) * r^n =
r / (1 - r)
- Goes to infinity as r -> 1. Why?
Little's law
- Mean response time: E(R) = (1/\lambda) * E(N) = 1 / (\mu - \lambda)
- Goes to infinity as \lambda -> \mu from below. Why?
- What happens when \lambda > \mu?
Mean waiting time E[W]
- Mean service time is 1/\mu
- Mean waiting time is E[W] = E[R] - 1/\mu = r / ( \mu (1-r) ) = r / (\mu
- \lambda)
- Mean waiting time goes to infinity as \lambda -> \mu from below.
Why?
Mean number of jobs in the queue E[Nq]
- Little's law applied to the queue: \lambda*E[w] = E[Eq]
- E[nq] = r^2 / (1-r)
Utilization
U = 1 - p0 = 1 - (1-r) = r = \lambda / \mu
Note that you can only get utilization at 1 by having the response time go
to infinity. Why?
Example 2: Finite Queue
Let the maximum size of the queue be m.
- What happens to requests that arrive when the queue is full?
Birth and Death Coefficients
| Number of requests in the system, j |
0 |
1 |
2 |
... |
m-1 |
m |
| Probability of a birth, \lambda_j |
\lambda |
\lambda |
\lambda |
... |
\lambda |
0 |
| Probability of a death, \mu_j |
0 |
\mu |
\mu |
... |
\mu |
\mu |
Incremental solution
- p_n = p_0 r^n
- 1 = \sum_n p_n = p_0 \sum_n r^n = p_0 ( 1 - r^(m+1) ) / ( 1 - r )
- p_n = { (1-r) r^n } / (1 - r^(m+1))
What's the story
- The system is guaranteed to be stable because no more than m requests
can be in the system at once.
- Thus, the solution is valid for all values of r
- As r -> 1 use l'Hopital's rule 1 = p_0 (m+1) and p_n = 1 / (m+1)
- For r < 1 the probability is skewed toward low numbers of
requests.
- At r = 0 the probability is uniform
- for r > 1 the probability is skewed towards high numbers of
requests
- As r -> infinity p_m -> 1
Results
Number of Requests
- E[N] = {r / (1-r)} { (1 - (m-1)r^m - mr^(m+1)) / (1 - r^(m+1) ) }
- This looks singular, which should not be true.
- It is not obvious, but the denominator of the second part has the
factor (1-r)^2.
- It is not obvious, but the numerator of the second part has the
factor (1-r)
- Denominator: (1 - r^(m+1) ) = (1-r) (1 + r + r^2 + ... + r^m)
- Numerator: (1 - (m-1)r^m - mr^(m+1)) = (1-r)^2 (1 + 2r + 3r^2 + ... +
mr^(m-1))
- Thus, E[N] = {r + 2r^2 + 3r^3 + ... + mr^m}) / {1 + r + r^2 + ... +
r^m}
- r -> 0: E[N] = r
- r = 1: E[N] = m/2
- r -> infinity: E[N] -> m
Response Time
- E[R] = E[N] / \lambda = {1/\mu} {1 + 2r + 3r^2 + ... + mr^(m-1)} / {1 +
r + r^2 + ... + r^m}
- r -> 0: E[R] = 1 / \mu
- r = 1: E[R] = m / (2\mu)
- r -> infinity: E[R] -> m / \mu, which is just m times the service
time
Utilization
- U = 1 - p_0 = 1 - (1-r) / (1-r^(m+1)) = ( r - r^(m+1) ) / ( 1 - r^(m+1)
)
- r -> 0: U = r
- r = 1: U = 1 - (1/(m+1)) = m / (m+1)
- r -> infinity: U -> 1
Example 3: Two Servers versus One Server Twice as
Powerful
One Server Twice as Powerful
Service rate and time:
- service rate: \nu = 2 \mu
- service time 1 / \nu = 1 / (2\nu)
- s = r / 2
Number of requests
- E[N] = s / (1-s) = r / (2-r)
- This is not quite as good as half as many. Why?
Response Time
- R[N] = 1 / (\nu - \lambda) = 1 / {\nu (1 - s)} = 1 / {2 \mu (1-r/2)} =
1 / {\mu (2-r)}
- This is not quite as good as twice as fast.
Utilization
- U = s = r/2
- Utilization is exactly one half, as we expect.
Two Servers with One Queue
Birth & Death Coefficients
| Number of requests in the system, j |
0 |
1 |
2 |
3 |
... |
| Probability of a birth, \lambda_j |
\lambda |
\lambda |
\lambda |
\lambda |
... |
| Probability of a death, \mu_j |
0 |
\mu |
2 \mu |
2 \mu |
... |
Incremental Solution
- j = 0: \mu p_1 = \lambda p_0 ==> p_1 = p_0 * r, where r = \lambda /
(\mu)
- j = 1: 2 \mu p_2 = ((\lambda + \mu) p_1 - \lambda p_0 ) / (2 \mu)
==> p_2 = p_0 * (1/2 r^2
- j = 2: 2 \mu p_3 = ((\lambda + \mu) p_2 - \lambda p_1 ) / (2 \mu)
==> p_3 = p_0 * (1/4) r^3
- ...
- j = n-1: 2 \mu p_n = ((\lambda + \mu) p_n-1 - \lambda p_n-2 ) / (2 \mu)
==> p_n = p_0 * (1/2)^(n-1) r^n
Now normalize,
- 1 = \sum_n p_n = p_0( 1 + 2 \sum_(n=1) (r/2)^n ) = p_0 ( 2 \sum_(n=0)
(r/2)^n - 1 ) = p_0 ( 2 / (1-(r/2)) - 1 ) = p_0 ( 2 + r ) / ( 2 - r )
- p_0 = (2-r) / (2+r) = (2 \mu + \lambda) / (2 \mu - \lambda)
Thus, p_n = (2-r) r^n / (2+r)
Results
The mean number of jobs in the system is
- E[N] = sum_n n * (2 - r ) * r^n / (2+r) = {(2-r) / (2+r) } \sum_n
n*(r/2)^n = 2*r / {(2-r)(2+r)} = r / {(2-r)(1+(r/2))}
- Compare this to E[N] = r / (2-r), the result for the twice as powerful
server.
- We see the queue shrink by a factor of 1/(1 + (r/2))
Little's law
- Mean response time: E(R) = (1/\lambda) * E(N) = 1/ { \mu*(2-r)*(1+r/2)
}
- Compare this to E[R] = 1 / {\mu (2-r) }
- We see the same response speed up by the same factor: 1/(1 +
(r/2))
Utilization
- U = 1 - p_0 - 1/2 p_1= 1 - (2-r) / 2+r - (r/2) (2-r) / (2+r) = r /
2.
- Utilization does not change, as we expect.
Return to: