performance modeling – part i single queues

39
© 2001 D. Menascé. All Rights Reserved. 1 Performance Modeling – Part I Single Queues Prof. Daniel A. Menasce Dept. of Computer Science George Mason University

Upload: others

Post on 03-Jun-2022

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.1

Performance Modeling – Part ISingle Queues

Prof. Daniel A. MenasceDept. of Computer ScienceGeorge Mason University

Page 2: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.2

Purpose of Models

• Provide a way to derive performance metrics frommodel parameters.

• Examples of performance metrics:– Response time– Throughput– Availability

• Types of parameters:– Workload intensity (e.g., arrival rates)– Service demands.

Page 3: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.3

Type of Models

• Simulation: mimic flow of transactions through asystem.– Distribution-driven– Trace-driven

• Analytic: set of formulas or computationalalgorithms.– Exact– Approximate

• Hybrid

Page 4: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.4

When to Use?

• Use Exact Analytic Models WheneverPossible.

• Use Approximate Analytic Models:– For first-cut analysis– If validated by simulation– To reduce combinations of input parameters to

simulation models.• Use Simulation:

– If there is no tractable analytic model.

Page 5: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.5

Single Queue

customerswaiting line

W S

T

T = W + S

Page 6: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.6

Example of An Analytic ModelM/G/1 Queue

• Single server.• Arrival process is Poisson (interarrival

times are exponentially distributed).• Service time is arbitrarily distributed.

)1(2

)1]([][

)1(2

][][

22

!

!

!

"

#

++=

#+= s

CSESE

SESET

Where 1][ <= SE!"

Page 7: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.7

Little’s Law

NX

RThe average number of customers in a “black box” is equal tothe average time spent in the box multiplied by the throughputof the box.

N = R x X

Page 8: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.8

Little’s Law Example I• An NFS server was monitored during 30 min and the

number of I/O operations performed during this period wasfound to be 32,400. The average number of active requests(Nreq) was 9.

• What was the average response time per NFS request at theserver?

Page 9: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.9

Little’s Law Example I• An NFS server was monitored during 30 min and the

number of I/O operations performed during this period wasfound to be 32,400. The average number of active requests(Nreq) was 9.

• What was the average response time per NFS request at theserver?

“black box” = NFS serverXserver = 32,400 / 1,800 = 18 requests/sec

Rreq = Nreq / Xserver = 9 / 18 = 0.5 sec

Page 10: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.10

Little’s Law Example II• A large portal service offers free email service.

The number of registered users is two million and30% of them send send mail through the portalduring the peak hour. Each mail takes 5.0 sec onaverage to be processed and delivered to thedestination mailbox. During the busy period, eachuser sends 3.5 mail messages on average. The logfile indicates that the average size of an e-mailmessage is 7,120 bytes.

• What should be the capacity of the spool foroutgoing mails during the peak period?

Page 11: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.11

Little’s Law Example II• A large portal service offers free email service. The number of registered users is

two million and 30% of them send send mail through the portal during the peakhour. Each mail takes 5.0 sec on average to be processed and delivered to thedestination mailbox. During the busy period, each user sends 3.5 mail messages onaverage. The log file indicates that the average size of an e-mail message is 7,120bytes.

• What should be the capacity of the spool for outgoing mails during the peakperiod?

AvgNumberOfMails = Throughput x ResponseTime = (2,000,000 x 0.30 x 3.5 x 5.0) / 3,600 =

2,916.7 mails

AvgSpoolFile = 2,916.7 x 7,120 bytes = 19.8 MBytes

Page 12: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.12

Little’s Law Example III• A Web-based brokerage company runs a three-tiered site.

The site is used by 1.1 million customers. During the peakhour, 20,000 users are logged in simultaneously. The e-commerce site processes 3.6 million business functions perhour on a peak-load hour.

• What is the average response time of an e-commercefunction during the peak hour?

Page 13: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.13

Little’s Law Example III• A Web-based brokerage company runs a three-tiered site. The site is used

by 1.1 million customers. During the peak hour, 20,000 users are logged insimultaneously. The e-commerce site processes 3.6 million businessfunctions per hour on a peak-load hour.

• What is the average response time of an e-commerce function during thepeak hour?

Black box = E-commerce siteAverageResponseTime = AvgNumberOfUsers /

SiteThroughput = 20,000 / (3,600,000 / 3,600) =

20 sec

Page 14: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.14

Using Little’s Law in the M/G/1Queue

)1(2

)1(][

22

!

!

"

+= s

q

CNE

)1(2

)1(][

22

!

!!

"

++= s

CNE

Resource LINE

W S

λ λ λ

Resource LINE

T

λ λ λ

Page 15: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.15

Exercise

• Plot the response time for M/G/1 as afunction of ρ for M/M/1, M/D/1, anddistributions with coefficient of variationequal to ½ and 2. Assume that E[S] = 0.2.Vary λ accordingly.

• What conclusions do you take from lookingat the graphs?

Page 16: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.16

0

5

10

15

20

25

30

0.00 0.10 0.20 0.30 0.40 0.50 0.60 0.70 0.80 0.90 1.00

Utilization

Avera

ge R

esp

on

se T

ime

M/D/1 - Cs = 0 M/G/1 - Cs=0.5 M/M/1 - Cs = 1 M/G/1 - Cs = 2

Page 17: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.17

M/G/1, M/M/1, and M/D/1

M/G/1:)1(2

)1]([ 2

!

!

"

+= sCSE

W

)1(2

][

!

!

"=

SEW

)1(

][

!

!

"=

SEW

M/D/1:

M/M/1:

Page 18: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.18

M/G/1 Busy Period

x1

x2x3 x4

x5

x6

t

busy period busy periodidleperiod

Unfinished work: U(t)• U(t) increases every time an arrival occurs by the service time of the arrival.• U(t) decreases at a rate of -1.

Page 19: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.19

M/G/1 Busy Period

• Time elapsed since the server becomes busy untilit becomes idle again.

• Expected number of customers served in a busyperiod.

!"=1

][][

SEBE

!"=1

1][bNE

Page 20: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.20

M/G/1 With Vacation(1) (2)

(4)

(7)

(6)

(3)

(8)

(5)

Page 21: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.21

M/G/1 With Vacation

• The server goes on “vacation” for a time V(V is a generally distributed r.v.) once theserver becomes idle.

• Application: polling systems.

][2

][

)1(2

)1]([ 22

VE

VECSEW

s +!

+=

"

"

regular M/G/1waiting time

Page 22: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.22

Example of M/G/1 with Vacation• A system serves requests that arrive according to a

Poisson process at a rate of 0.2 requests/sec. Therequest processing time characteristics are: E[S] =3.5 sec and Cs = 0.3. When there no requests to beprocessed, the system goes into self-diagnosismode, which lasts for an average of 1 sec with acoefficient of variation of 2. After self-diagnosis,the system goes back to serve requests. If norequests are queued, a new self-diagnosis mode isstarted. What is the average waiting time of arequest?

Page 23: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.23

Solution to M/G/1 with Vacation Example

E[V]

W - M/G/1 no

Vacation

W - M/G/1

Vacation

0.0 4.451 4.451

0.5 4.451 5.201

1.0 4.451 5.951

1.5 4.451 6.701

2.0 4.451 7.451

2.5 4.451 8.201

3.0 4.451 8.951

3.5 4.451 9.701

4.0 4.451 10.451

4.5 4.451 11.201

5.0 4.451 11.951

5.5 4.451 12.701

][2

][

2

][)1(

1][][

][

])[(

])[(][

22

2

2

2

222

VE

VEVEC

VEVE

VE

VE

VEVE

V

V

V

=+

!=

!=

"

"

Page 24: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.24

M/G/1 with Priorities• P static priorities (p= 1, …, P).• P is the highest priority.• FCFS within each priority queue.

1!

2!

P!

Page 25: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.25

M/G/1 with Non-Preemptive Priorities

!

Wp =W

0

(1"# p )(1"# p+1)

W0

=1

2$pE[Sp

2

p=1

P

% ]

& = $pE[Sp ] = &p

p=1

P

%p=1

P

%

# p = &ii= p

P

%

Page 26: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.26

Example of M/G/1 with StaticPriorities

• A router receives requests at a rate of lrequests/sec from a Poisson process. 50% ofthem are of priority 1, 30% of priority 2,and 20% of priority 3.

Priority E[S] (sec) E[S2] (p)

1 0.5 0.375

2 0.4 0.400

3 0.3 0.180

Page 27: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.27

0

2

4

6

8

10

12

14

0.00 0.10 0.20 0.30 0.40 0.50 0.60 0.70 0.80 0.90 1.00

Total Utilization

Av

era

ge

Wa

itin

g T

ime

W1 W2 W3

Page 28: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.28

M/G/1 with Preemptive Resume Priorities

!

!

=

+

=

="

"#"#

+"#

=

P

pi

ip

pp

P

pi

iipp

p

SESE

T

$

%

)1)(1(

2/][)1]([

1

2

Page 29: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.29

Comparing Preemptive vs. Non-Preemptive M/G/1 Queues

a b c d e f g=b*f

Non-

preemptive Preemptive

Priority Lambda E[S] ! " E[S2] T T

1 1 0.50 0.500 0.775 0.375 0.3750 2.103 2.293

2 0.5 0.40 0.200 0.275 0.240 0.1200 0.790 0.543

3 0.3 0.25 0.075 0.075 0.094 0.0281 0.533 0.265

Page 30: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.30

M/G/1 Distributions

)(

)1()()(

sLs

ssLsL

S

ST!!

"

+#

#=

dttfeeEsL

dxxfeeEsL

Tt

stTsT

Sx

sxSsS

)(][)(

)(][)(

0

~0

~

!

!"

=

##

"

=

##

==

==

Laplace Transforms:

Response Time:

Page 31: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.31

M/M/1 Response TimeDistribution

sSEss

SEs

sLs

ssLsL

S

ST

!

"

!!

"

#+

#=

+#

#=

][/

][/)1(

)(

)1()()(

2

][/1

][/1)(

SEs

SEsLS

+=

Laplace Transform of the response time for an exponentially distributed service time:

Page 32: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.32

M/M/1 Response Time Distribution

sSEss

SEs

sLs

ssLsL

S

ST

!

"

!!

"

#+

#=

+#

#=

][/

][/)1(

)(

)1()()(

2

][/)1()1(][

1)( SEt

T eSE

tf !! """=

Probability density function for the response time:

Page 33: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.33

p.d.f. for Response Time forM/M/1

0.0

0.2

0.4

0.6

0.8

1.0

1.2

1.4

1.6

0.0 2.0 4.0 6.0 8.0 10.0 12.0 14.0 16.0

t

fT(t)

Page 34: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.34

M/G/1 Distributions

)(

)1()(

sLs

ssL

S

W!!

"

+#

#=

dttfeeEsL

dxxfeeEsL

Tt

stTsT

Sx

sxSsS

)(][)(

)(][)(

0

~0

~

!

!"

=

##

"

=

##

==

==

Laplace Transforms:

Waiting Time:

Page 35: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.35

G/G/1 Queue

1][ <= SE!"

!"=10p

Page 36: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.36

An Approximation for G/G/1

][/)1(2

)1(

1

2

22

222

SE

C

C

CCW

s

s

sa

!

!

!

!

"

+#

+

+$

2aC

: coefficient of variation of the interarrival time.

Approximation is exact for M/G/1, good for G/M/1, and fair for G/G/1.The approximation improves as ρ increases.

Page 37: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.37

G/G/c Queue

1

2

c1][<=

c

SE!"

Page 38: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.38

An Approximation for G/G/c

2][/)1(

),(22sa CC

SEc

cCW

+!

"#

$

$

Approximation is exact forM/M/c.The error increases with Ca and Cs.

!"

=

+"

=1

0!

)(

!

)()1(

!/)(),(

c

n

cn

c

c

c

n

c

cccC

###

##where is Erlang’s C formula.

Page 39: Performance Modeling – Part I Single Queues

© 2001 D. Menascé. All Rights Reserved.39

The M/M/c Queue

][/)1(

),(

SEc

cCW

!

!

"=

!"

=

+"

=1

0!

)(

!

)()1(

!/)(),(

c

n

cn

c

c

c

n

c

cccC

###

##where is Erlang’s C formula.