M/G/1 and M/G/1/K queuing systemsM/G/1 and M/G/1/K queuing ... · 4.2. How to choose the state of...
Transcript of M/G/1 and M/G/1/K queuing systemsM/G/1 and M/G/1/K queuing ... · 4.2. How to choose the state of...
M/G/1 and M/G/1/K systems
Dmitri A. Moltchanov
http://www.cs.tut.fi/kurssit/ELT-53606/
Network analysis and dimensioning I D.Molthchanov, TUT, 2013
OUTLINE:
• Description of M/G/1 system;
• Methods of analysis;
• Residual life approach;
• Imbedded Markov chain approach.
Lecture: M/G/1 and M/G/1/K systems: part I 2
Network analysis and dimensioning I D.Molthchanov, TUT, 2013
1. Description of M/G/1 queuing systemM/G/1 queuing system stands for:
• single server;
• infinite number of waiting positions;
• Poisson arrival process;
– interarrival times are exponentially distributed.
• generally distributed service times:
– practically, any distribution.
What we also assume:
• ’first come, first served’ (FCFS);
• what it may affect: PDF or pdf of waiting time!
Lecture: M/G/1 and M/G/1/K systems: part I 3
Network analysis and dimensioning I D.Molthchanov, TUT, 2013
1.1. Arrival and service processes
Arrival process:
• Poisson with parameter (mean value) λ
• interarrival times are exponential with mean 1/λ;
• CDF, pdf and LT are:
A(t) = 1− e−λt, a(t) = λe−λt, A(s) =
∫ ∞0
a(t)e−stdt =
∫ ∞0
λe−λte−stdt =λ
s+ λ. (1)
Service process:
• service times are arbitrary with mean 1/µ;
• PDF, pdf and LT are:
B(t), b(t), B(s). (2)
Lecture: M/G/1 and M/G/1/K systems: part I 4
Network analysis and dimensioning I D.Molthchanov, TUT, 2013
2. Methods of analysisThere are a number of methods:
• residual life approach: simple to understand:
– only mean values can be obtained.
• transform approach based on imbedded Markov chain: harder to deal with;
– distributions of desired performance parameters can be obtained;
– the idea: find points at which Markov property holds and use transforms.
• direct approach based on imbedded Markov chain: harder to deal with;
– distributions of desired performance parameters can be obtained;
– the idea: find points at which Markov property holds and use direct integration.
• method of supplementary variables: the most complicated one:
– distributions of desired performance parameters can be obtained;
– the idea: look at arbitrary points and make them Markovian.
Lecture: M/G/1 and M/G/1/K systems: part I 5
Network analysis and dimensioning I D.Molthchanov, TUT, 2013
3. Residual life approach: mean waiting timeNote the following:
• we want to find mean queuing time (mean time spent waiting for service);
• no need to assume FCFS service discipline:
– service order does not influence mean waiting time;
– we have to require that the server does not stay idle when there are waiting customers;
– mean values are the same as for LCFS, RANDOM, PS.
...
Arrivals:1
m
1
lService:
Figure 1: M/G/1 queuing system.
Note: we are looking for E[WQ]: mean waiting time in the buffer.
Lecture: M/G/1 and M/G/1/K systems: part I 6
Network analysis and dimensioning I D.Molthchanov, TUT, 2013
Consider arriving customer, we have two choice:
• customer arrives to non-empty system or;
• it arrives to empty system.
When the customer arrives to non-empty system it finds:
• nq customers waiting in the buffer;
• customer which is currently in service:
– it has R residual service time left to complete its ongoing service;
– residual service time is the time required to complete the ongoing service.
When the customer arrives to empty system:
• no customers waiting nq = 0;
• residual service time R is zero;
• customer can enter service immediately.
Lecture: M/G/1 and M/G/1/K systems: part I 7
Network analysis and dimensioning I D.Molthchanov, TUT, 2013
Let us denote:
• RV R be the RV of residual service time:
– in case of exponential service times R has exponential distribution.
• E[R] be it mean.
Note the following:
• PASTA property holds for M/G/1 system;
• distribution that arrival sees is the same as time-averaged (at arbitrary time);
• using Little’s result we have for the mean waiting time in the buffer, E[WQ]:
E[WQ] = E[NQ]E[X] + E[R]. (3)
– E[NQ] - mean number of packets waiting in the buffer, E[X] mean service time;
– E[R] - mean residual service time.
Using Little’s result E[NQ] = λE[WQ] we get:
E[WQ] = λE[WQ]E[X] + E[R]. (4)
Lecture: M/G/1 and M/G/1/K systems: part I 8
Network analysis and dimensioning I D.Molthchanov, TUT, 2013
Denoting ρ = λE[X] and solving for E[WQ]:
E[WQ] = ρE[WQ] + E[R], E[WQ] =E[R]
(1− ρ). (5)
• to find E[W ] we, therefore, have to find mean residual service time E[R].
• in what follows we take graphical approach.
ô
)(ôr
Figure 2: Residual service times.
• R jumps by the amount of service time X when a new customer enters the service;
• decreases until the customer completes service, duration is X;
• R = 0 when customer completes its service.
Lecture: M/G/1 and M/G/1/K systems: part I 9
Network analysis and dimensioning I D.Molthchanov, TUT, 2013
Time averaged of r(τ) in (0, t) is:
E[r[0, t)] =1
t
∫ t
0
r(τ)dτ. (6)
Approximate previous equation by the following sum:
E[r[0, t)] =1
t
∫ t
0
r(τ)dτ ≈ 1
t
M(t)∑i=1
1
2X2i . (7)
• X2/2 is the square of a service triangle, M(t) – arrivals in (0, t).
Note the following:
• we have an error in the last residual service time in [0, t);
• approximation becomes better as t→∞ (number of components increases!).
Multiplying and dividing it by M(t) we get:
E[r[0, t)] =M(t)
t
1
M(t)
1
2
M(t)∑i=1
X2i . (8)
Lecture: M/G/1 and M/G/1/K systems: part I 10
Network analysis and dimensioning I D.Molthchanov, TUT, 2013
Consider the last equation when t→∞ we get:
limt→∞
M(t)
t→ λ
limt→∞
1
2
1
M(t)
M(t)∑i=1
X2i →
1
2E[X2]. (9)
Therefore, we have the following expression for mean residual service time:
E[R] = E[r] =1
2λE[X2], (10)
Substituting this result in E[W ] = E[R]/(1− ρ) we get:
E[WQ] =λE[X2]
2(1− ρ). (11)
• this result is known as Pollaczek-Khinchine formula:
– they simultaneously got this result.
Lecture: M/G/1 and M/G/1/K systems: part I 11
Network analysis and dimensioning I D.Molthchanov, TUT, 2013
3.1. Performance parameters
Mean time spent in the buffer: E[WQ]
E[WQ] =λE[X2]
2(1− ρ). (12)
Mean number of customers in the buffer: E[NQ]
E[NQ] = λE[WQ] =λ2E[X2]
2(1− ρ). (13)
Mean time spent in the system: E[W ]
E[W ] = E[WQ] + E[X] =λE[X2]
2(1− ρ)+ E[X]. (14)
Mean number of customers in the system: E[NQ]
E[N ] = E[W ]λ =λ2E[X2]
2(1− ρ)+ ρ. (15)
Lecture: M/G/1 and M/G/1/K systems: part I 12
Network analysis and dimensioning I D.Molthchanov, TUT, 2013
4. Imbedded Markov chainRecall M/M/-/-/-: let N(t) be the number of customers at time t:
• we know how the system evolves in time after t in ∆t;
• arrival may occur with probability λ∆t:
– it is independent from previous arrival: memoryless property (A1 = A2)!
• departure may occur with rate µ∆t:
– it is independent from previous departure: memoryless property (D1 = D2)!
• the resulting process is actually birth-death Markov one!
t
A1(t)=A2(t)
A2(t)
D1(t)=D2(t)
D2(t)t
Figure 3: State of M/M/1 queuing system.
Lecture: M/G/1 and M/G/1/K systems: part I 13
Network analysis and dimensioning I D.Molthchanov, TUT, 2013
4.1. Problem with M/G/1 queuing system
Let SQ(t) be the number of customers at time t:
• do we know how the system evolves in time after t in ∆t?
• arrival may occur with rate λ∆t:
– it is independent from previous arrival: memoryless property (A1 = A2)!
• departure may occur with probability µ?∆t:
– µ? 6= µ as D2 is not the same as D1!
• this process is no longer Markovian!
1 1 2( ) : ( ) ( )D t D t D t¹
t
A2(t)
D2(t)
t
A1(t)
Figure 4: State of M/G/1 queuing system.
Lecture: M/G/1 and M/G/1/K systems: part I 14
Network analysis and dimensioning I D.Molthchanov, TUT, 2013
4.2. How to choose the state of M/G/1 system
State of the system: M/G/1 queuing system
• number of customers in the system AND time since the service started:
– in this case we know how the system evolves in time;
– we know the distribution of time till the next arrival: it is the same as initial one;
– we know the distribution of time till the next departure: we track it:
D(t+ x|x) = Pr{(T ≤ t+ x)|T > x} = (D(t+ x)−D(x))/(1−D(x)). (16)
t
t
( ) 1 tA t e
l-= -
( ) ( )( | )
1 ( )
D t x D xD t x x
D x
+ -+ =
-( ) , 0,1,...
QS t k k= =
Figure 5: State of M/G/1 queuing system given by (SQ(t), D(t+ x|x)).
Lecture: M/G/1 and M/G/1/K systems: part I 15
Network analysis and dimensioning I D.Molthchanov, TUT, 2013
Are there any problems with such description?
• two complicated to deal with;
• we better prefer to avoid it if more simple description is available!
State of the system: M/G/1 queuing system
• number of customers in the system at special time instants d+1 , d+2 , . . . :
– choose these instants such that we should not track time since previous service started;
– which instants: just after service completions as D(t+ x|x) = D(t) when x = 0!
t
d1
+d2
+
( ) ( ) ( 0) (0)( | ) 0
1 ( ) 1 (0)
D t x D x D t DD t x x
D x D
+ - + -+ = = =
- -
0x ®
( ) 1 tA t e
l-= -
( )D t
( ) , 0,1,...Q
S t k k= =
Figure 6: State of M/G/1 queuing system.
Lecture: M/G/1 and M/G/1/K systems: part I 16
Network analysis and dimensioning I D.Molthchanov, TUT, 2013
4.3. Steady-state distribution as seen by departure
Doe the following:
• consider Markov chain imbedded at ti, i = 1, 2, . . . when ith customer departs from the system;
• system state: number of customers at ti, i = 1, 2, . . . denoted by ni, i = 1, 2, . . . ;
• departing customer is not included in the system state!
...
Time instant ti-
Time instant ti+
...
ni
-= k
ni
+= k-1 Just departed at ti
Figure 7: Time instants t−i and t+i in M/G/1 queuing system.
Lecture: M/G/1 and M/G/1/K systems: part I 17
Network analysis and dimensioning I D.Molthchanov, TUT, 2013
Denote:
• ai+1 be the number of arrivals in (i+ 1)th service time.
t
0x ®( )D t
ti ti+1
ai+1
ith departure
Figure 8: Arrivals in (i+ 1)th service time.
Consider time diagram of the system and distinguish between:
• ith departure leaves non-empty system: ni > 0;
• ith departure leaves empty system: ni = 0.
Lecture: M/G/1 and M/G/1/K systems: part I 18
Network analysis and dimensioning I D.Molthchanov, TUT, 2013
Consider the case when ni > 0.
ai+1 arrivals in (i+1)th
service time
(i+1)th
departureith
departure
(i+1)th
service timet
...
(system is not empty;
ni>0 ni+1 = ni - 1 + ai+1
(system may be empty may be not;
Figure 9: Time diagram of the M/G/1 queuing system when ni > 0.
In this case we have the following relation between ni and ni+1:
ni+1 = ni − 1 + ai+1, ni = 1, 2, . . . . (17)
Lecture: M/G/1 and M/G/1/K systems: part I 19
Network analysis and dimensioning I D.Molthchanov, TUT, 2013
Consider the case when ni = 0.
(i+1)th
departureith
departure
(i+1)th
service timet
...
system is empty
ni = 0 ni+1 = ai+1
first arrival after empty period
system may be empty may be not
ai+1 arrivals in (i+1)th
service time
Figure 10: Time diagram of the M/G/1 queuing system when ni = 0.
In this case we have the following relation between ni and ni+1:
ni+1 = ai+1, ni = 0. (18)
Lecture: M/G/1 and M/G/1/K systems: part I 20
Network analysis and dimensioning I D.Molthchanov, TUT, 2013
Summarizing both cases (ni > 0 and ni = 0) we have:
ni+1 = ni − 1 + ai+1, ni = 1, 2, . . . ,
ni+1 = ai+1, ni = 0. (19)
Introducing unit step function U(ni) rewrite:
ni+1 = ni − U(ni) + ai+1, ni = 0, 1, . . . , (20)
• where unit step function is given by
U(ni) = 1, ni = 1, 2, . . . ,
U(ni) = 0, ni = 0. (21)
• this expressin gives us the idea how the system evolves between ti and ti+1;
• recall that ti, i = 0, 1, . . . are imbedded points of the Markov chain.
GENERAL RELATION:
ni+1 = ni − U(ni) + ai+1, ni = 0, 1, . . . , (22)
Lecture: M/G/1 and M/G/1/K systems: part I 21
Network analysis and dimensioning I D.Molthchanov, TUT, 2013
Consider imbedded Markov chain at steady-state t→∞:
• let qij, i, j = 0, 1, . . . , be transition probabilities of going from i to j;
• let ak the number of arrivals in the service time;
qik = αk, i = 0, k = 0, 1, . . . ,
qik = αk−i+1, i = 1, 2, . . . , k = i− 1, i, i+ 1, . . . (23)
0 1 2 ...
1a
2a
3
3a
0a 0a 0a 0a
2a
3a
2a2a
Figure 11: Transition probabilities of imbedded Markov chain at steady-state.
Lecture: M/G/1 and M/G/1/K systems: part I 22
Network analysis and dimensioning I D.Molthchanov, TUT, 2013
Observe that αk, k = 0, 1, . . . fully determine the Markov chain.
arrivals
departuredepartureservice time
t
...ka
Figure 12: k arrivals in a service time.
Arrivals come from Poisson process αk, k = 0, 1, . . . , we can get αk:
αk =
∫ ∞0
(λx)k
k!e−λxb(x)dx, k = 0, 1, . . . . (24)
Lecture: M/G/1 and M/G/1/K systems: part I 23
Network analysis and dimensioning I D.Molthchanov, TUT, 2013
4.4. Transform approach vs. direct integration
The difference is twofold:
• in the way we compute αk, k = 0, 1, . . .
αk =
∫ ∞0
(λx)k
k!e−λxb(x)dx, k = 0, 1, . . . . (25)
– first term – number of arrivals from Poisson process in time x (Erlang distribution);
– b(x) service time distribution equals to x;
– we integrate over all length of t: from 0 to ∞.
• in the way we solve linear equations of the Markov chain
– asking Mathlab to do it for us;
– trying to get closed-form analytical solution.
Let us define the following:
• qi, i = 0, 1, . . . : number of customers in the system just after departure;
Lecture: M/G/1 and M/G/1/K systems: part I 24
Network analysis and dimensioning I D.Molthchanov, TUT, 2013
4.5. Brute-force direct approach
What we do:
• estimate αk directly via integration;
• use classic way to get steady-state solution for qi, i = 0, 1, . . . ;
• works when capacity is limited M/M/1/K.
In vector/matrix form:
~qQ = ~q : (q0, q1, . . . )
q00 q01 q02 q03 . . .
q10 q11 q12 q13 . . .
0 q21 q22 q23 . . ....
......
......
= (q0, q1, . . . )
~q~e = 1 : (q0, q1, . . . )
1
1...
= 1 (26)
Lecture: M/G/1 and M/G/1/K systems: part I 25
Network analysis and dimensioning I D.Molthchanov, TUT, 2013
4.6. Other steady-state distributions
What we get:
• PF and moments of the number as seen by departure...
Note: we are usually asked to get state distribution at arbitrary time!
Let us define the following:
• pk, k = 0, 1, . . . : time-averaged (arbitrary time) steady-state distribution of states;
• ak, k = 0, 1, . . . : steady-state distribution of states as seen by arrival;
• dk, k = 0, 1, . . . : steady-state distribution of states as seen by departure.
Question: how to find pk, k = 0, 1, . . . ?
Lecture: M/G/1 and M/G/1/K systems: part I 26
Network analysis and dimensioning I D.Molthchanov, TUT, 2013
Two next results gives us a way to use this PF:
• Kleinrock’s result (!!! remember it as well as PASTA):
– the following holds for those system when state can change at most ±1 in ∆t→ 0:
dk = ak, . . . , k = 0, 1, . . . . (27)
• PASTA property:
– the following holds when the arrival process is homogenous Poisson:
ak = pk, . . . , k = 0, 1, . . . . (28)
• combining both we have for M/G/1 queuing system:
ak = pk = dk, . . . , k = 0, 1, . . . . (29)
What it gives:
• we obtained steady-state distribution at any instant of time;
• qk = ak facilitates derivation of waiting time CDF.
Lecture: M/G/1 and M/G/1/K systems: part I 27
Network analysis and dimensioning I D.Molthchanov, TUT, 2013
4.7. Performance parameters
Mean time spent in the buffer: E[WQ]
E[WQ] =λE[X2]
2(1− ρ). (30)
Mean number of customers in the buffer: E[NQ]
E[NQ] = λE[WQ] =λ2E[X2]
2(1− ρ). (31)
Mean time spent in the system: E[W ]
E[W ] = E[WQ] + E[X] =λE[X2]
2(1− ρ)+ E[X]. (32)
Mean number of customers in the system: E[NQ]
E[N ] = E[W ]λ =λ2E[X2]
2(1− ρ)+ ρ. (33)
Lecture: M/G/1 and M/G/1/K systems: part I 28
Network analysis and dimensioning I D.Molthchanov, TUT, 2013
5. Transform approachConsider ni+1 = ni − U(ni) + ai+1 and take means of both sides to get:
E[ni+1] = E[ni]− E[U(ni)] + E[ai+1]. (34)
Since we consider the system at steady-state E[ni+1] = E[ni] = E[n]:
E[U(ni)] = E[ai+1]. (35)
Note the following:
• assuming that the system is empty with probability d0 we have:
E[U(ni)] = 1− d0. (36)
• mean number of arrivals in (i+ 1)th service time is given by:
E[ai+1] =
∫ ∞0
λtb(t)dt = λE[X] = ρ. (37)
Therefore, in the steady-state we have:
d0 = 1− ρ. (38)
Lecture: M/G/1 and M/G/1/K systems: part I 29
Network analysis and dimensioning I D.Molthchanov, TUT, 2013
Introduce PGFs of ni and ni+1:
Pi(z) = E[zni ] =∞∑k=0
zkPr{ni = k},
Pi+1(z) = E[zni+1 ] =∞∑k=0
zkPr{ni+1 = k}. (39)
Considering ni+1 = ni − U(ni) + ai+1 as the sum of RVs ni − U(ni) and ai+1:
Pi+1(z) = E[zni−U(ni)]E[zai+1 ]. (40)
To simplify it, consider the following:
• since we consider system at steady-state we can drop subscripts i and write:
P (z) = E[zn−U(n)]E[za]. (41)
• defining PGF of number of arriving customers in service time by A(z) = E[za], then:
A(z) =
∫ ∞0
E[za|X = t]b(t)dt =
∫ ∞0
∑zn
(λt)n
n!e−λtb(t)dt =
∫ ∞0
e−λt(1−z)b(t)dt. (42)
Lecture: M/G/1 and M/G/1/K systems: part I 30
Network analysis and dimensioning I D.Molthchanov, TUT, 2013
Rewrite the last result as:
A(z) =
∫ ∞0
e−λt(1−z)b(t)dt =
∫ ∞0
b(t)e−(λ−λz)tdt. (43)
Recall the definition of the Laplace transform:
F (s) =
∫ ∞0
f(t)e−stdt, (44)
Thus, we have for PGF of arriving customers in service time:
A(z) = B(λ− λz). (45)
• where B(·) is the LT.
Now we can get moments of number of arrivals in service time:
A′(1) = λB′(0) = λE[X] = ρ;
A′′(1) = λ2B′′(0) = λ2E[X2]. (46)
• we used moments generating properties of PGF and Laplace transform.
Lecture: M/G/1 and M/G/1/K systems: part I 31
Network analysis and dimensioning I D.Molthchanov, TUT, 2013
Let us get back to P (z) = E[zn−U(n)]E[za]:
P (z) = A(z)E[zn−U(n)] = A(z)∞∑k=0
zk−U(k)Pr{n = k} =
= A(z)
(z0d0 +
∞∑k=1
zk−1pk
)= A(z)
(d0 +
1
z
∞∑k=0
zkpk −1
zd0
)=
= A(z)
(1
zP (z)− 1
zd0(1− z)
). (47)
Use d0 = (1− ρ) to get PGF of the number of customers as seen by departure:
P (z) =(1− ρ)(1− z)A(z)
A(z)− z, (48)
• where A(z) = B(λ− λz).
Substituting A(z) = B(λ− λz), we get Pollaczek-Khinchine transform equation:
P (z) =(1− ρ)(1− z)B(λ− λz)
B(λ− λz)− z. (49)
Lecture: M/G/1 and M/G/1/K systems: part I 32
Network analysis and dimensioning I D.Molthchanov, TUT, 2013
5.1. Mean number of customers as seen by departure
Using using moment generating properties of PGF and LT:
• we can get moments of the number of customers as seen by departure.
To get mean, rewrite (48) as follows:
P (z)(A(z)− z) = (1− ρ)(1− z)A(z). (50)
Taking two derivatives we get:
P ′(z)(A(z)− z) + P (z)(A′(z)− 1) = (1− ρ)(1− z)A′(z)− (1− ρ)A(z),
P ′′(z)(A(z)− z) + 2P ′(z)(A′(z)− 1) + P (z)A′′(z) = (1− ρ)(1− z)A′′(z)− (1− ρ)A′(z). (51)
Let z = 1 and use A(1) = 1, P (1) = 1, A′(1) = ρ and A′′(1) = λ2E[X2] to get:
−2P ′(1)(1− ρ) + λ2E[X2] = (1− ρ)(−2ρ) (52)
Mean number of customers as seen by departing customer:
E[N ] =λ2E[X2]
2(1− ρ). (53)
Lecture: M/G/1 and M/G/1/K systems: part I 33