queueing model

Upload: george-reyes

Post on 03-Mar-2016

2 views

Category:

Documents


2 download

DESCRIPTION

This document discusses queues with exponential arrival and service times

TRANSCRIPT

  • Queuing Theory

    October 26, 2015

    Abstract

    This document discusses queues with exponential arrival and service times. Queues usingother distribution functions such as uniform time are not covered by the document.

    1 Notation

    : mean rate of arrival. It is equal to 1/[inter-arrival time]. : mean rate of service. It is equal to 1/Ts. w: the average number in queue r: the average number resident in the system Tw: the average waiting time in the system Tr: the average resident time in the system Ts: the average service time in the system : the server utilization

    2 Littles Theorem

    Littles Theorem shows a fundamental relationship between the average number of customers inthe system, the average waiting time for a customer, and the average arrival rate of customers tothe system. The theorem has been shown to be applicable to all situations involving queues and isuseful in many environments include manfacturing and service industries as well as everyday decisionmaking by individuals.

    Littles Theorem provides the following results:

    r = Tr (1)

    w = Tw (2)

    Tr = Tw + Ts (3)

    1

  • 3 M /M /1 Queueing System

    For an M/M/1 queueing system, the state of the system is the number of customers/jobs/packetsresident in the system. The system state can be illustrated by the finite state transition diagrambelow.

    0 1 2 3 . . . i i+ 1 . . .

    3.1 Formulas

    Let Pn be the probability that the system is in state n, i.e., there are n customers in the system.We say that the system is in equilibrium if the rate of movements in both directions are equal, i.efor any state i, Pi = Pi+1.

    Then,

    P0 = P1,

    P1 = P2,

    P2 = P3,

    . . .

    Pi = Pi+1

    Therefore,

    P1 =

    P0

    P2 =

    P1

    P3 =

    P2

    . . .

    Pi+1 =

    Pi

    Since = , then

    P1 = P0

    P2 = P1 = (P0) = 2P0

    P3 = P2 = (2P0) =

    3P0

    . . .

    Pi+1 = P1 = (iP0) =

    i+1P0

    Sincek=0 Pk = 1, then

    k=0 Pk =

    k=0

    kP0 = 1. Thus1

    1 P0 = 1.Therefore, the probability that the server is idle is

    P0 = 1 (4)

    2

  • and the server utilization is = 1 P0 (5)

    The expected number of customers in the system, r, is also obtained from the expected numberof customers k and the probability of having k customers, Pk. Thus,

    r =

    k=0

    kPk =

    k=0

    k(kP0) =

    k=0

    k[k(1 )] = (1 )k=0

    kk

    Therefore,

    r =

    1 (6)

    From (1),

    Tr =r

    =

    (1 )=

    1

    (1 )

    Tr =Ts

    1 (7)

    Alternatively, it can also be shown that

    Tr =1

    (8)

    From (3) and (8),

    Tw =1

    1

    =

    ( )

    Tw =

    (9)

    From (2) and (9), it can also be shown that

    w =

    (

    )

    (10)

    An alternative formula is

    w =2

    1 (11)

    3.2 Examples

    Example 1. If an M /M /1 queue has arrivals at a rate of 2 per minute and serves at a rate of 4per minute, how many customers are found in the system on the average? How many customers arefound in service on average?

    Solution: Given: = 2 cust/min and Ts = 0.25 min, the utilization will be

    = 2 cust/min 0.25min = 0.5

    3

  • Since r = w + where r is the number of customers resident in the system and w is the number ofcustomers in the queue, it follows that will be the number of customers in service.

    Using (1), the number of customer found in the system is

    r =

    1 =0.5

    0.5= 1 customer

    Example 2. The owner of a shop observes that on average 18 customers arrive per hour andthere are typically 8 customers in the shop. What is the average length of time each customer spendsin the shop?

    Solution: Given = 18 cust/hr and r = 8 customers,

    Tr =r

    =

    8 cust

    18 cust/hr= 0.44 hrs. 26.4 minutes

    Example 3. The measurement of a network gateway reveals that packets arrive on average at126 packets per second (pps) and the gateway takes about 2 ms to forward them on. From thisinformation, what performance measures can be determined?

    Solution: Given = 125 packets/sec and Ts = 2 ms. Thus, =1

    0.002= 500 packets/sec. The

    following performance measures can be determined:

    1. gateway (server) utilization:

    =

    =

    125

    500= 0.25

    2. average number of packets in gateway:

    =

    1 =0.25

    0.75= 0.33

    3. average time spent in gateway:

    Tr =Ts

    1 =2

    1 0.25 = 2.66 ms.

    4. average number of packets in buffer (queue) (using eq. 2):

    w =0.0625

    0.75= 0.0833

    5. average time spent in buffer:

    Tw = Tr Ts = 2.66 2 = 0.66 ms.

    Example 4. The average response time on a database system is 3 seconds. During a 1-minuteobservation interval, the idle time on the system was measured to be 10 seconds. Using an M/M/1model for the system, determine the following:

    1. system utilization

    4

  • 2. average service time per query

    3. number of queries completed during the observation interval

    4. average number of jobs in the system

    Solution: Given Tr = 3 seconds, idle time = 10 seconds, observation time = 60 seconds

    1. System utilization is =50 sec

    60 sec= 0.833

    2. Average service time per query is:

    Ts = Tr(1 )= 3(0.167)

    = 0.501 sec/query

    3. number of queries completed during the observation interval of 60 seconds:

    50 sec

    0.501 sec/query= 99.8 queries 100 queries

    4. average number of jobs in the system is: r =

    1 =0.833

    0.167= 4.99 5 queries

    4 M /M /m Queuing System

    Consider now the M/M/m queueing system. There are m identical servers in the system and eachserver has identical service rate . The system state is illustrated by the state transition diagrambelow.

    0 1 2 . . . m 1 m m+ 1 . . .

    2 3 (m 1) m m m

    4.1 Formulas

    Because there are m servers

    =

    m(12)

    The system is in equilibrium whenever

    P0 = P1,

    P1 = 2P2,

    P3 = 3P3,

    . . .

    Pm1 = mPmPm = mPm+1

    Pm+1 = mPm+2

    . . .

    5

  • Therefore,

    P1 =

    P0 =

    P2 =

    2P1

    P3 =

    3P2

    . . .

    Pm =

    mPm1

    Pm+1 =

    mPm

    Pm+2 =

    mPm+i

    . . .

    Using eq.12,P1 = mP0

    and

    P2 =m

    2P1 =

    m22

    2P0

    P3 =m

    3P2 =

    m33

    3!P0

    . . .

    Pm =m

    mPm1 =

    mmm

    m!P0

    Pm+1 = Pm =mmm+1

    m!P0

    Pm+2 = Pm+1 =mmm+2

    m!P0

    . . .

    The values above can be generalized as

    Pk =

    (m)k

    k!P0, for 0 < k m

    mmk

    m!P0, for k > m

    (13)

    Sincek=0 Pk = 1,

    6

  • m1k=0

    Pk +

    k=m

    Pk = 1

    m1k=0

    (m)k

    k!P0 +

    k=m

    (mm)k

    m!P0 = 1

    P0

    (m1k=0

    (m)k

    k!+mm

    m!

    k=m

    k

    )= 1

    P0

    (m1k=0

    (m)k

    k!+

    mmm

    m!(1 )

    )= 1

    Thus,

    P0 =

    [m1k=0

    (m)k

    k!+

    mmm

    m!(1 )

    ]1(14)

    Let Pq be the probability that all servers are busy, i.e. a customer entering the system getsqueued.

    Pq =

    k=m

    Pk

    =

    k=m

    mmk

    m!P0

    =mm

    m!P0

    k=m

    k

    Pq =mmmP0m!(1 ) (15)

    Equation 15 is known as the Erlang-C formula and is used in the subsequent formulas.

    The expected number of customers in the queue is

    w =

    k=m

    (k m)Pk

    =

    k=0

    kPk+m

    =

    k=0

    kmmk+m

    m!P0

    =mmm

    m!P0

    k=m

    kk

    =mmm

    m!P0

    [

    (1 )2]

    =mmmP0m!(1 )

    (

    1 )

    7

  • w = Pq

    (

    1 )

    (16)

    From (2) and (16),

    Tw =Pq

    (

    1 )

    (17)

    From (3) and (17),

    Tr =1

    +Pq

    (

    1 )

    (18)

    Alternatively,

    Tr =1

    +

    Pqm (19)

    And from (1) and (18),

    r = m+ Pq

    (

    1 )

    (20)

    Or alternatively, using (19)

    r =

    +

    Pqm (21)

    4.2 Example

    Example 6. A dormitory inside the university has a computer room with five terminals/PCs.Dormers arrive in an exponential manner at an average rate of 10 per hour. Each dormer spends anaverage of 20 minutes at a terminal and the time can be assumed to be exponentially distributed.What performance measures can be determined?

    Solution: Given: an M/M/ 5 queueing model with m = 5, = 10/60 = 1/6 per minute andTs = 20 mins. We can determine the following:

    1. Average terminal (server)utilization:

    =

    m=

    0.167

    5(0.05)= 0.67

    2. Probability that all servers are idle:

    P0 =

    [1 + 5(0.67) +

    [5(0.67)]2

    2+

    [5(0.67)]3

    6+

    [5(0.67)]4

    24+

    [5(0.67)]5

    5!(1 0.67)]1

    = 0.0318

    3. Erlang-C value:

    Pq =[5(0.67)]5

    5!(1 0.67)(0.0318) = 0.34

    4. Average number of dormers waiting in queue:

    w =(0.67)(0.34)

    1 0.67 = 0.69

    5. Average number of dormers in the computer room:

    r = 5(0.67) + 0.65 = 4.04

    8

  • 6. Let ns be the average number of dormers using the terminals.

    n2 = r w = 4 0.65 = 3.39

    7. Average waiting time in the system (using eq. 17): Tw = 4.13 minutes

    8. Average resident time in the system: Tr = 20 + 4.13 = 24.13 minutes

    5 M /M /1/B Queueing System

    An M /M /1/B is similar to the M /M /1 queue except that the number of buffers B is finite. AfterB buffers are full, all customer arrivals are discarded and are lost. The system state is illustratedby the finite state transition diagram below. Observer that there are no states greater than B.

    0 1 2 3 . . . B 1 B

    From the state transition diagram, it can be established that

    Pk =

    {kP0, for 0 k B

    0, for k > B

    SinceBk=0 Pk = 1,

    P0 =1

    1 B+1 (22)

    The average number of customers in the system is

    r =

    1 (B + 1)B+1

    1 B+1 (23)

    The average number of customers in the queue is

    r =

    1 1 +BB

    1 B+1 (24)

    All arrivals occurring when the system is in state k=B are lost. The rate of the customersactually entering the system, called effective arrival rate, is

    =B1k=0

    Pk = (1 PB) (25)

    The difference = PB represents the customer loss rate The average resident time is

    Tr =r

    =

    r

    (1 PB) (26)

    The average waiting time in the queue is

    Tw =w

    (1 PB) (27)

    9

  • 6 Queueing System

    The state transition diagram for an M /M /m/B queue is shown in the figure below.

    0 1 . . . m 1 m m+ 1 . . . B

    2 (m 1) m m m m

    From the state transition diagram, it can be established that

    Pk =

    mkk

    k!P0, for 0 k m

    kmm

    m!P0, for m < k B

    SinceBk=0 Pk = 1,

    P0 =

    [1 +

    (1 Bm+1)(m)mm!(1 ) +

    m1k=1

    (m)k

    k!

    ]1(28)

    The average number of customers in the system is

    r =

    Bk=1

    kPk (29)

    The average number of customers in the queue is

    w =

    Bk=m+1

    (k m)Pk (30)

    The effective arrival rate in the system, is

    =B1k=0

    Pk = (1 PB) (31)

    The average resident time is

    Tr =r

    =

    r

    (1 PB) (32)

    The average waiting time in the queue is

    Tw =w

    (1 PB) (33)

    10