Measuring and Calculating Queue Length ... - Semantic Scholar

Report 8 Downloads 72 Views
M E A S U R I N G A N D C A L C U L A T I N G QUEUE LENGTH D I S T R I B U T I O N S *

J e f f r e y P . Busen BGS S y s t e m s , I n c . B o x 128 Lincoln, MA 01773 and P e t e r J . Denning Senior M e m b e r , IEEE C o m p u t e r Science D e p a r t m e n t Purdue University VJ. L a f a y e t t e , IN 47907

November 1979 R e v i s e d D e c e m b e r 1979 CSD-TR-317

lliis is a p r e p r i n t of a p a p e r to appear in IEEE C o m p u t e r , February 1980.

*This w o r k s u p p o r t e d in p a r t by NSF G r a n t M C S 7 8 - 0 1 7 2 9 at Purdue University.

M E A S U R I N G A N D C A L C U L A T I N G Q U E U E LENGTH D I S T R I B U T I O N S J . P . Buzen and P . J . Denning

Abstract:

Q u e u e length distributions can be described in three w a y s :

as scon b y an a r r i v i n g j o b , by a completing j o b , and b y an outside observer.

We show:

the arriver's distribution and the completer's

distribution are the same if flow is b a l a n c e d ; the arriver's

distribution

is a r e n o r m a l i z a t i o n of the outside observer's distribution if the arrival rate is i n d e p e n d e n t of queue length (homogeneous); w h e n arrivals are not exactly h o m o g e n e o u s , the e r r o r i n t r o d u c e d b y assuming it is can be q u a n t i f i e d .

The generalized "birth-death recursion" can

be used to c a l c u l a t e an arbitrary q u e u e ' s length distribution and a "prime q u e u e r e c u r s i o n " can be u s e d if the q u e u e is p a r t of a c l o s e d network.

These results lead t o mean value a n a l y s i s , a simple m e t h o d

for computing m e a n response times and queue lengths in closed q u e u e i n g networks.

The basis f o r the entire discussion is o p e r a t i o n a l a n a l y s i s ,

w h o s e simple assumptions h e l p e)q)lain w h y q u e u e i n g m o d e l s are r o b u s t .

INTRODUCTION Q u e u e i n g network theory is the m a t h e m a t i c a l foundation for most a n a l y t i c m o d e l s o f computer s y s t e m s and communications n e t w o r k s .

In

the e a r l y 1970's, p e r f o r m a n c e analysts b e g a n employing the equations o f classical s t o c h a s t i c q u e u e i n g n e t w o r k theory to calculate queue lengths, and m e a n response times for real s y s t e m s .

throughputs,

Numerous

e x p e r i m e n t a l studies h a v e shown that these m o d e l s consistently e s t i m a t e the real throughputs to w i t h i n 5% and the real m e a n response times to within 25%.

Q u e u e i n g network m o d e l s are r o b u s t .

2

The s t a r t l i n g s u c c e s s o f q u e u e i n g n e t w o r k m o d e l s caused a good deal of p u z z l e m e n t among p e r f o r m a n c e a n a l y s t s .

The derivations o f the

m a i n results o f s t o c h a s t i c q u e u e i n g theory assume that the q u e u e i n g network has t i m e - i n v a r i a n t p a r a m e t e r s , is in steady s t a t e , and has e x p o n e n t i a l distributions of service time a t all FIFO (first in first out) devices.

These assumptions are o f t e n seriously violated in p r a c t i c c .

Y e t , the m o d e l s w o r k . The e q u a t i o n s to s t o c h a s t i c q u e u e i n g theory are relations among a b s t r a c t q u a n t i t i e s that c a n n o t be o b s e r v e d d i r e c t l y .

To simplify

and solve the e q u a t i o n s , . t h e assumptions o f t i m e - i n v a r i a n t p a r a m e t e r s , steady s t a t e , and e x p o n e n t i a l service distributions are i n t r o d u c e d . To apply to s o l u t i o n s , the a n a l y s t substitutes m e a s u r e d or e s t i m a t e d values for the a b s t r a c t p a r a m e t e r s ; h e then compares the calculated results with other measured values.

Hie i m p o r t a n t p o i n t is that the

a n a l y s t replaces the abstract interpretation by an operational one whenever applying queueing equations. This realization led to a new hypothesis f o r explaining the success of s t o c h a s t i c q u e u e i n g theory: s t o c h a s t i c e q u a t i o n s , when

interpreted

as relations a m o n g o p e r a t i o n a l (measurable) q u a n t i t i e s , have alternate derivations that depend on assumptions commonly s a t i s f i e d in p r a c t i c e . This h y p o t h e s i s is c o r r e c t .

In 1976 o p e r a t i o n a l analysis was i n t r o d u c e d

as a framework for studying q u e u e i n g systems during

given

periods

[1,2].

The systems m a y b e real o r h y p o t h e t i c a l , and the time p e r i o d s may b e past, present or future. Operational v a r i a b l e s r e p r e s e n t quantities that can be measured by o b s e r v i n g a system during any given i n t e r v a l , called the observation period.

O p e r a t i o n a l analysis derives relations among operational

3

q u a n t i t i e s and studies t h e i r c o n s e q u e n c e s . 1 a w s , h o l d in every observation p e r i o d

Some r e l a t i o n s , called

[2,3]; others d e p e n d on assumptions

that m a y b e e x p r e s s e d in terms o f more p r i m i t i v e operational

quantities.

The underlying p r i n c i p l e is t h a t all v a r i a b l e s s t a n d for observable values and all assumptions are e x p e r i m e n t a l l y v e r i f i a b l e .

(It is n o t n e c e s s a r y ,

h o w e v e r , to actually observe the values o r run the experiments for an o p e r a t i o n a l analysis to make s e n s e . ) M a n y o f the i n f o r m a l , i n t u i t i v e arguments used to motivate s t o c h a s t i c theorems b e c o m e rigorous p r o o f s in the formal context of o p e r a t i o n a l a n a l y s i s .

B e s i d e s simplifying d e r i v a t i o n s , operational

analysis extends s t o c h a s t i c theorems by demonstrating their validity in cases w h e r e the conventional s t o c h a s t i c assumptions do not appear justified.

O p e r a t i o n a l analysis has led to n e w results about sensitivity

factors and error bounds; these results are p a r t i c u l a r l y valuable for prediction because the v a l i d i t y of o p e r a t i o n a l (or stochastic)

assumptions

in future p e r i o d s is u n c e r t a i n . In 19 78 w e p u b l i s h e d a tutorial on o p e r a t i o n a l analysis of queuei-ig network m o d e l s paper.

[3].

W e p r e s e n t here n e w topics n o t covered in that

Wc will study the three b a s i c q u e u e i n g distributions that can

be measured a t a device in the system: the q u e u e length seen by an arriving j o b , by a completing j o b , and by an outside o b s e r v e r . study the relations a m o n g these d i s t r i b u t i o n s .

We will

For closed q u e u e i n g

network m o d e l s , we will study the p r o p e r t y that a job arriving at a g i v e n device sees the same q u e u e i n g distribution as the outside observer w o u l d see with one less job (the a r r i v e r ) in the s y s t e m .

This r e s u l t is

the basis o f "mean value a n a l y s i s " , a new m e t h o d i n t r o d u c e d in 1978 by Reiser and Lavenberg

[4] for numerically evaluating q u e u e i n g network m o d e l s .

4

THE T H R E E D I S T R I B U T I O N S A T A QUEUE A s i n g l e - r e s o u r c e queueing system

comprises an input p o r t , an

o u t p u t p o r t , a q u e u e , and a service f a c i l i t y .

A l l arriving jobs

(customers) enter by the input port and all c o m p l e t i n g jobs exit by the o u t p u t p o r t . service.

T h e queue c o n t a i n s all jobs waiting for or receiving

T h e service f a c i l i t y consists of o n e o r m o r e p r o c e s s i n g

units. S u p p o s e that a s i n g l e - r e s o u r c e queueing system is observed for an interval is

[0, T ] .

T h e state o f the q u e u e a t time t , denoted n ( t ) ,

the n u m b e r of jobs p r e s e n t .

a m a x i m u m of N d u r i n g

[0, T ] .

It v a r i e s from a m i n i m u m of 0 to

(A nonzero m i n i m u m on o b s e r v e d queue

length c h a n g e s the b o u n d a r y condition b u t n o t the n a t u r e of the r e s u l t s . ) A record o f n(t) fox 0y the homogeneous arrival assumption is then N-l ®A

Substituting

=

2

n=0

P

A(n)

| (Y-Y(n))/Y(n) j



A A

_ ~

V n=0

e

A(n)'

for e (n) and p(n)Y(n)/Y

for p [n),

p(n)YCn) , Y - Y(n) Y ' Yfnl L J "o

Cancelling Y ( n ) , multiplying and dividing b y Y, and setting Y / Y Q = H(1-p(N))

[Equation (2) of Box 2 ] , this reduces to

Box 5 -- T h e P r i m e Q u e u e Recursion

C o n s i d e r a closed queueing n e t w o r k containing N jobs and K d e v i c e s .

For

a g i v e n b e h a v i o r s e q u e n c e , the overall distribution p^(n,N) at d e v i c e i d e n o t e s the p r o p o r t i o n o f time that n jobs a r e enqueued at d e v i c c i (n = 0 , . . . N ) .

If the b e h a v i o r sequence is flow b a l a n c e d and network-

h o m o g e n e o u s (see t e x t ) , the overall d i s t r i b u t i o n

C14)

where

Pi(n,N)

= X.(N)

satisfies

S.(n)p.(n-1,N-1)

is t h e t h r o u g h p u t a t d e v i c e i (for n e t w o r k load N ) and

S^(n) is the service f u n c t i o n for d e v i c e i .

W e c a l l this the p r i m e

q u e u e r e c u r s i o n b e c a u s e it can b e used to d e r i v e f o r m u l a e for many other p e r f o r m a n c e q u a n t i t i e s of q u e u e i n g n e t w o r k s [18, 1 9 , 2 0 ] . p r o v e d by Reiser and Lavenberg

It was first

[14].

T h e p r i m e queue r e c u r s i o n suggests an a l g o r i t h m for computing a q u e u e d i s t r i b u t i o n g i v e n t h r o u g h p u t s for v a r i o u s network loads N . piC0,0) = 1.

Begin with

Having c a l c u l a t e d p ^ n - 1 , N - l ) for n « 1 , . . . N , a p p l y

E q u a t i o n (14) to c a l c u l a t e p ^ ( n , N ) ; then choose P i ( 0 , N ) b y subtracting the u t i l i z a t i o n ^ ( N ) = p ( l J N ) + . . . + p i ( N , N ) from 1.0. f o r s u c c e s s i v e N u n t i l the d e s i r e d load is r e a c h e d .

This is repeated If this a l g o r i t h m

is applied at a b o t t l e n e c k in t h e system; it will eventually get to a load N at w h i c h L K ( N ) is a p p r o x i m a t e l y 1.0 w h e r e u p o n the subtraction to c a l c u l a t e p ^ ( 0 , N ) m a y g e n e r a t e a r o u n d - o f f error that p r o p a g a t e s to larger v a l u e s of N .

To h e l p control the e r r o r , we check that p^fO.Ni^O

after the subtraction l.O-U.(N); if the subtraction yields a negative

Box b, continued (2)

r e s u l t , s e t p^O,!*!) = 0 .

E v e n w i t h this f i x , h o w e v e r , the a l g o r i t h m

seems to generate s i g n i f i c a n t e r r o r s for larger N ; the normalizingconstant algorithms

[20,25] appear to b e more numerically s t a b l e .

For a g i v e n behavior s e q u e n c e , let p ^ ( n , N ) d e n o t e the a r r i v e r s distribution at d e v i c e i; that is P A ^ ( n , N ) is the fraction o f a r r i v e r s w h o find n in the queue a t d e v i c c i (given n e t w o r k load N ) .

If the behavior

sequence

is.flow b a l a n c e d ,

PAi(n,*0

=

X

.

W

s.Cn+1) '

this can be p r o v e d - b y s u b s t i t u t i n g the d e f i n i t i o n s o f o v e r a l l d i s t r i b u t i o n , t h r o u g h p u t , and service function and using the flow b a l a n c e condition to reduce the r i g h t side to the left [11] -

On applying the p r i m e queue

r e c u r s i o n to p ^ f n + l j N ) , this equation r e d u c e s to

(16)

PAi(n,N) » p.(n, N-l) .

E q u a t i o n (16) was noted informally b y Reiser and Lavenberg [4] and later p r o v e d by them [21]; it is a special case o f a stochastic proved by S e v c i k and M i t r a n i [22].

theorem

T h e d e t a i l s leading to Equation

(16) show that is is true o p e r a t i o n a l l y

[11].

Its i n t e r p r e t a t i o n is

that the arrivers see the same d i s t r i b u t i o n a s the o u t s i d e observer with one. job (the a r r i v e r ) removed form the n e t w o r k .

--

Box 6

Examples of Mean Value Calculations

C o n s i d e r a system w i t h K = 3 and these v i s i t r a t i o s and m e a n service times: = 1

V2 = 2

Sj = 2

$2=1

V3 = 3

S

3

=

1

(seconds)

T h e r e s u l t s of the m e a n - v a l u e c a l c u l a t i o n u p through N = 4 are shown i table

N

R^N)

0

-

R2(N) -

R3(N) -

X0(N)

Q x CN)

Q2CN)

Q3(N)

0.000

0.000

0.000

-

1

2.000

1.000

1.000

.143

.286

.286

.429

2

2.571

1.286

1.429

.212

.545

.545

.909

3

3.091

1.545

1.909

.252

.779

.779

1.443

4

3.557

1.779

2.443

.277

.985

.985

2.030

W e will i l l u s t r a t e the calculation o f the m e a n queue length Q 3 ( 4 ) . first c a l c u l a t e m e a n response times R j ( 4 ) , I ^ ^ Equation A .

5

For e x a m p l e ,

R 2 ( 4 ) = S 2 ( Q 2 ( 3 ) + 1) = (1)(.779 + 1) = 1.779 seconds

T h e n w e c a l c u l a t e the o v e r a l l m e a n r e s p o n s e time:

anc

*

We

Box b , continued

(2)

R0(4) = V ^ W

+ V2R2(4) + V3R3(4)

«= (1)(3.557) + (2) (1.779) + (3) (2.443) - 14.444 s e c o n d s .

Equation B gives the system throughput:

X (4) = 4 / R Q ( 4 ) = 4/14.444 = .277 jobs/sec.

F i n a l l y , Equation C gives the mean queue at device 3:

Q3C4) = V3X0(4)R3(4) = (.277)(3)(2.443) = 2.030 jobs.

If wc are willing to sacrifice some accuracy in the solution, we can obtain the values R ^ , Q ^ , and X ^ for a given value of N without enumerating all these quantities for loads smaller than N . approximation is that Q (N-l) is (N-l)/N as large as Q i ( N ) .

A reasonable (This

approximation w a s suggested to u s b y J . Zahorjan, P . Schweitzer and Y . Bard.) The refore, we seek values of

, Q ^ , and X Q satisfying

R . = S . (Q.^rr- + 1 ) l 1 1 N '

i = 1 , . . . ,K

X n = N/EV.R. 0 11 Q. = V. X . R. l 0 i

i = 1,..., K

Box 6 , continued

(3)

We can obtain a solution i t e r a t i v e l y : start with a guess of all the mean queue lengths Q^ (summing to N ) , a n d then compute a n e w guess b y evaluating these e q u a t i o n s ; r e p e a t this until successive guesses for the Q^ do n o t d i f f e r by much.,

(Termination in guaranteed

a s y m p t o t i c a l l y c o r r e c t f o r large N [24].

[24].)

This i t e r a t i o n is

The table below p r e s e n t s the

v a l u e s o b t a i n e d by applying this approximation for N = 4; the e r r o r s b e t w e e n the approximate and the true values (from the previous

table)

are q u i t e g o o d .

Hxac t (N=4) Approx (N=4) % Error

Rj(N)

R2(N)

R3(N)

Xq(N)

Q1(N) 1

Q2(N)

Q3(N)

3.557

1.779

2.443

.277

.985

.985

2.030

3 . 39 3

1.6 9 7

2.606

.274

.929

.929

2.141

-4.6

-4.6

+6.7

-1.1

-5.7

-5.7

+5.5