Advanced Markovian queues -...

21
Advanced Markovian queues Advanced Markovian queues Bulk input queue M [X] /M/1 Bulk service queue M/M [Y] /1 Bulk service queue M/M /1 Erlangian queue M/E k /1 1

Transcript of Advanced Markovian queues -...

Page 1: Advanced Markovian queues - cfins.au.tsinghua.edu.cncfins.au.tsinghua.edu.cn/personalhg/xiali/teaching/queue_2012/lectures/lect_07.pdfBalance equation of M[X]/M/1 • Global balance

Advanced Markovian queuesAdvanced Markovian queues

• Bulk input queue M[X]/M/1• Bulk service queue M/M[Y]/1Bulk service queue M/M /1• Erlangian queue M/Ek/1

1

Page 2: Advanced Markovian queues - cfins.au.tsinghua.edu.cncfins.au.tsinghua.edu.cn/personalhg/xiali/teaching/queue_2012/lectures/lect_07.pdfBalance equation of M[X]/M/1 • Global balance

Bulk input queue M[X]/M/1Bulk input queue M[X]/M/1

• Batch arrival, Poisson process, arrival rate λ– number of customers in each arrival is an integer grandom number X

– Probability of X is c =Pr[X=n]Probability of X is cn=Pr[X=n]

• State transition rate diagram– X={1,2} as example, pp.118 of textbook

2

Page 3: Advanced Markovian queues - cfins.au.tsinghua.edu.cncfins.au.tsinghua.edu.cn/personalhg/xiali/teaching/queue_2012/lectures/lect_07.pdfBalance equation of M[X]/M/1 • Global balance

Balance equation of M[X]/M/1Balance equation of M[X]/M/1 

• Global balance equation0 ( ) 1

n

p p p c nλ μ μ λ= − + + + ≥∑11

0 1

0 ( ) , 1

0

n n n k kk

p p p c n

p p

λ μ μ λ

λ μ

+ −=

= + + + ≥

= − +

• To solve these equations, use Z‐transforms of c and pp

3

Page 4: Advanced Markovian queues - cfins.au.tsinghua.edu.cncfins.au.tsinghua.edu.cn/personalhg/xiali/teaching/queue_2012/lectures/lect_07.pdfBalance equation of M[X]/M/1 • Global balance

Balance equation of M[X]/M/1Balance equation of M[X]/M/1 

• Multiply zn on both sides and sum all

0n

n n n nμλ μ λ∞ ∞ ∞ ∞

+ +∑ ∑ ∑ ∑∑

W h

0 1 1 1 10 n n n n

n n n n k kn n n n k

p z p z p z p c zzμλ μ λ −

= = = = =

= − − + +∑ ∑ ∑ ∑∑

• We have 0 00 ( ) [ ( ) ] [ ( ) ] ( ) ( )P z P z p P z p C z P z

zμλ μ λ= − − − + − +

• Thus, z

0 (1 )( ) | | 1p zP z zμ −= ≤( ) , | | 1

(1 ) [1 ( )]P z z

z z C zμ λ= ≤

− − −

4

Page 5: Advanced Markovian queues - cfins.au.tsinghua.edu.cncfins.au.tsinghua.edu.cn/personalhg/xiali/teaching/queue_2012/lectures/lect_07.pdfBalance equation of M[X]/M/1 • Global balance

Average metrics of M[X]/M/1Average metrics of M[X]/M/1 

• Let z=1, obtain the average metrics1 / [ ]p r rE Xρ λ μ ρ= − = =0

2 2

1 , / , [ ]

( [ ] [ ]) [ ]2(1 ) 2(1 )

p r rE X

r E X E X rE XL

ρ λ μ ρ

ρρ ρ

= = =

+ += =

− −2(1 ) 2(1 )ρ ρ

0(1 )qL L p L ρ= − − = −

/ , /q qW L W Lμ μ= =

5

Page 6: Advanced Markovian queues - cfins.au.tsinghua.edu.cncfins.au.tsinghua.edu.cn/personalhg/xiali/teaching/queue_2012/lectures/lect_07.pdfBalance equation of M[X]/M/1 • Global balance

Example of M[X]/M/1Example of M[X]/M/1 

• X is a constant K, apply the results we have1K K Kρ ρ ρ λ+ +1 ,

2(1 ) 2 1K K KL ρ ρ ρ λρρ ρ μ

+ += = =

− −

• What’s the difference from M/M/1 with Kλ?• Equivalent to M/M/1 with Kλ and a scaleEquivalent to M/M/1 with Kλ and a scale factor (K+1)/2

f– Worse performance metrics– Why? more bursty

6

Page 7: Advanced Markovian queues - cfins.au.tsinghua.edu.cncfins.au.tsinghua.edu.cn/personalhg/xiali/teaching/queue_2012/lectures/lect_07.pdfBalance equation of M[X]/M/1 • Global balance

Example of M[X]/M/1Example of M[X]/M/1 

• X is a geometric r.v. with parameter a1 (1 )( ) (1 ) n n z aC λ∞− −∑

• Thus

1

1

( )( ) (1 ) , 1 (1 )

n n

n

C z a a zaz a

ρμ=

= − = =− −∑

0 (1 )( ) p zP z μ −=Thus,  ( )

(1 ) [1 ( )]

1(1 )

P zz z C z

az

μ λ

ρ

=− − −

⎡ ⎤= − −⎢ ⎥

• The steady‐state probability is 

(1 )1 [ (1 ) ] 1 [ (1 )]z a a z a a

ρρ ρ⎢ ⎥− + − − + −⎣ ⎦

y p y1(1 )[ (1 ) ] (1 )n

np a a aρ ρ ρ−= − + − −

7

Page 8: Advanced Markovian queues - cfins.au.tsinghua.edu.cncfins.au.tsinghua.edu.cn/personalhg/xiali/teaching/queue_2012/lectures/lect_07.pdfBalance equation of M[X]/M/1 • Global balance

Bulk service queue M/M[Y]/1Bulk service queue M/M[Y]/1 

• Similar to M/M/1, except the server serves K customers at a time, called M/M[K]/1. K is a constant. 

• Two model for different service mode• Two model for different service mode– Partial‐batch

• Start service no matter n<K

– Full‐batch• Start service until n>=k

8

Page 9: Advanced Markovian queues - cfins.au.tsinghua.edu.cncfins.au.tsinghua.edu.cn/personalhg/xiali/teaching/queue_2012/lectures/lect_07.pdfBalance equation of M[X]/M/1 • Global balance

Partial batch model of M/M[K]/1Partial‐batch model of M/M[K]/1 

• Global balance equation10 ( ) , 1n n K np p p nλ μ μ λ+= − + + + ≥

itt i ti f

1

0 1 2

( ) ,0 ...

n n K n

K

p p pp p p p

μ μλ μ μ μ

+ −

= − + + + +

• rewritten in operation form1[ ( ) ] 0K

nD D pμ λ μ λ+ − + + =

• root of characteristic equation above, we have1

1

Kn

n i ii

p C r+

=

=∑1

( 1) ( 1) 0 ( 1)[ ... ] 0

K

K K

r r rr r r rμ λ

μ μ μ λ−

− − − = ⇒

− + + + − =

9

Page 10: Advanced Markovian queues - cfins.au.tsinghua.edu.cncfins.au.tsinghua.edu.cn/personalhg/xiali/teaching/queue_2012/lectures/lect_07.pdfBalance equation of M[X]/M/1 • Global balance

Partial batch model of M/M[K]/1Partial‐batch model of M/M[K]/1 

• Only one root r0 within (0,1)0n

np Cr=

• With the law of total probability, C=1‐r0

• Similar to M/M/1 r instead of ρ0 0(1 ) n

np r r= −

Similar to M/M/1, r0 instead of ρ0 0,

1 (1 )r rLL W

r rλ λ= = =

− −1, q qL L W Wλ

μ μ= − = −

• For M/M/1, let K=1, how is the above result?0 01 (1 )r rλ λ− − μ μ

10

Page 11: Advanced Markovian queues - cfins.au.tsinghua.edu.cncfins.au.tsinghua.edu.cn/personalhg/xiali/teaching/queue_2012/lectures/lect_07.pdfBalance equation of M[X]/M/1 • Global balance

M/M[K]/1 v s M/M/1M/M[K]/1 v.s. M/M/1

• formulas of metrics are similar– Formulas for distribution, L, W, Lq, Wq are similar, , , q, q

• similar to M/M/1 with service rate Kμi h f h i i i– r0 is the root of characteristic equation

– ρ=λ/Kμ, is the utilization factor of M/M/1– which one is bigger? 

• Guess: r0 > ρ (because M/M[K]/1 is more bursty  more 0  ρ ( / / ycrowded)

– Metrics of M/M[K]/1 is worse than those of M/M/1/ / / /

11

Page 12: Advanced Markovian queues - cfins.au.tsinghua.edu.cncfins.au.tsinghua.edu.cn/personalhg/xiali/teaching/queue_2012/lectures/lect_07.pdfBalance equation of M[X]/M/1 • Global balance

Example of M/M[K]/1Example of M/M[K]/1 

• Drive‐Thr Car wash– λ=20/h, μ=12/h, K=2/ , μ / ,

• Characteristic equation12 3 32 20 3 3 8 5 0 1 ( 3 69) / 612r3‐32r+20=3r3‐8r+5=0, roots are 

• So, r0=0.884 and L=7.6, Lq=5.9, W=38min, Wq=33min

1, ( 3 69) / 6r r= = − ±

0 q q

• Compare the equivalent M/M/1 with λ=20 and μ=24ρ=5/6=0 833 and L=5 L =4 167W=15minW =12 5minρ=5/6=0.833 and L=5,Lq=4.167,W=15min,Wq=12.5min

• M/M[K]/1 is worse than M/M/1

12

Page 13: Advanced Markovian queues - cfins.au.tsinghua.edu.cncfins.au.tsinghua.edu.cn/personalhg/xiali/teaching/queue_2012/lectures/lect_07.pdfBalance equation of M[X]/M/1 • Global balance

Erlangian queuesErlangian queues

• Exponential distribution – Memoryless property, simplify the analysis y p p y, p y y– Limitation, more general cases

E l di t ib ti f i ti d• Erlang distribution for service time and interarrival time– Sum of K‐stage exponential distributions– More general modelMore general model

• Other distributions– PH, Coxian, hyperexponential, etc.

13

Page 14: Advanced Markovian queues - cfins.au.tsinghua.edu.cncfins.au.tsinghua.edu.cn/personalhg/xiali/teaching/queue_2012/lectures/lect_07.pdfBalance equation of M[X]/M/1 • Global balance

Erlang distributionErlang distribution

• k‐stage Erlang distribution, each stage is exponentially distributed with rate kμp y μ

• By convolution, pdf is 1( )( )

( 1)!

kk xk k xf x e

kμμ μ −

−=−

2

1 1 1[ ] , [ ] , XE X Var X ck kμ μ

= = =μ μ

kμ kμ kμkμ… …

1 2 i k

14

Page 15: Advanced Markovian queues - cfins.au.tsinghua.edu.cncfins.au.tsinghua.edu.cn/personalhg/xiali/teaching/queue_2012/lectures/lect_07.pdfBalance equation of M[X]/M/1 • Global balance

Erlang distributionErlang distribution• Distribution with 2‐parameters,Distribution with 2 parameters, cx<1, to model smooth stochastic processprocess– Approximate empirical distribution, use the mean and variance to match μ and k

• If cx>1, we can use other If cx , we can use otherdistribution model, such as hyperexponential distributionyp p

15

Page 16: Advanced Markovian queues - cfins.au.tsinghua.edu.cncfins.au.tsinghua.edu.cn/personalhg/xiali/teaching/queue_2012/lectures/lect_07.pdfBalance equation of M[X]/M/1 • Global balance

Phase Type distributionPhase‐Type distribution

• A generalization of concept of phases• PH distribution: the time to enter anPH distribution: the time to enter an absorbing state in Markov processF l E l 2 di ib i• For example, Erlang‐2 distribution:

μ μ 0μ μ−⎡ ⎤⎢ ⎥1 2 3 0

0 0 0Q μ μ⎢ ⎥= −⎢ ⎥

⎢ ⎥⎣ ⎦

16

Page 17: Advanced Markovian queues - cfins.au.tsinghua.edu.cncfins.au.tsinghua.edu.cn/personalhg/xiali/teaching/queue_2012/lectures/lect_07.pdfBalance equation of M[X]/M/1 • Global balance

PH distributionPH distribution

• Coxian distributionμp1 μ 1 1(1 )p pμ μ μ− −⎡ ⎤

1 2 3μp1 μ 1 1(1 )

00 0 0

p pQ

μ μ μμ μ

⎡ ⎤⎢ ⎥= −⎢ ⎥⎢ ⎥⎣ ⎦

• Hyerexponential distributionμ(1-p1)

⎣ ⎦

Hyerexponential distribution1 μ1

1 10μ μ−⎡ ⎤⎢ ⎥

with an initial

23μ2

2 200 0 0

Q μ μ⎢ ⎥= −⎢ ⎥⎢ ⎥⎣ ⎦

distribution p(0)=(q,1-q)

17

Page 18: Advanced Markovian queues - cfins.au.tsinghua.edu.cncfins.au.tsinghua.edu.cn/personalhg/xiali/teaching/queue_2012/lectures/lect_07.pdfBalance equation of M[X]/M/1 • Global balance

The calculation of pdf of PH distribution

• Use the C‐K equation and matrix calculation of Q

• Calculate the transient behavior of absorbing state p (t)state, pn(t). – pn(t)=P{T<t}, so pn(t) is cdf of PH and p’n(t) is pdf.

• Chalk writing, use hyperexponential distribution as exampledistribution as example– For any PH distribution, we can similarly analyze by its Q matrix of Markov processby its Q matrix of Markov process

18

Page 19: Advanced Markovian queues - cfins.au.tsinghua.edu.cncfins.au.tsinghua.edu.cn/personalhg/xiali/teaching/queue_2012/lectures/lect_07.pdfBalance equation of M[X]/M/1 • Global balance

M/E /1 queueM/Ek/1 queue

• Service time is Erlang‐k distribution– k stage, each stage is exponential with kμg , g p μ

• State definition( i) d i i i i– (n,i): n customers and customer in service is in phase i, i=1,2,…,k. (k is the first phase and 1 is the l h )last phase)

• Global balance equation q

19

Page 20: Advanced Markovian queues - cfins.au.tsinghua.edu.cncfins.au.tsinghua.edu.cn/personalhg/xiali/teaching/queue_2012/lectures/lect_07.pdfBalance equation of M[X]/M/1 • Global balance

Average metrics of M/E /1Average metrics of M/Ek/1 

• Consider equivalent queue with state (n‐1)k+i, # of phase requestsp q

• Equivalent to M[k]/M/1, average # of customer is average # of phase requests 1kL ρ λ+is average # of phase requests

• So, ,

2 1L ρ ρ

ρ μ= =

−21 1k kW L Wρ ρλ+ +,

2 (1 ) 2 (1 )q q qW L Wk k

λμ ρ ρ

= = =− −

11 , q qW W L L ρμ

= + = +Can we use PASTA  to do mean value analysis? 

20

Page 21: Advanced Markovian queues - cfins.au.tsinghua.edu.cncfins.au.tsinghua.edu.cn/personalhg/xiali/teaching/queue_2012/lectures/lect_07.pdfBalance equation of M[X]/M/1 • Global balance

Example of M/E /1Example of M/Ek/1 

• Suppose a queuing system– λ=16/h, Poisson arrival/ ,– Mean service time 2.5min, std. deviation is 1 25min1.25min

• not exponentially distribution• Use Erlang k to approximate C =0 5=(1/k)0.5 k=4• Use Erlang‐k to approximate, CX=0.5=(1/k)0.5, k=4

– M/E4/1 queue, with λ=4/15/min, μ=0.4/min, ρ=2/3– So, 

Lq=5/6, Wq=25/8minq q

21