Download Poisson Arrivals

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Inductive probability wikipedia , lookup

History of statistics wikipedia , lookup

Foundations of statistics wikipedia , lookup

Law of large numbers wikipedia , lookup

Probability amplitude wikipedia , lookup

Transcript
FIRST
M/M/1 Queueing System
We have already covered queueing theory basics in a previous article. In this article we
will focus on M/M/1 queueing system. As we have seen earlier, M/M/1 refers to negative
exponential arrivals and service times with a single server. This is the most widely used
queueing system in analysis as pretty much everything is known about it. M/M/1 is a
good approximation for a large number of queueing systems.
The following topics will be discussed in detail:




Poisson Arrivals
Poisson Service Times
Single Server
M/M/1 Results
Poisson Arrivals
M/M/1 queueing systems assume a Poisson arrival process. This assumption is a very
good approximation for arrival process in real systems that meet the following rules:
1. The number of customers in the system is very large.
2. Impact of a single customer on the performance of the system is very small, i.e. a
single customer consumes a very small percentage of the system resources.
3. All customers are independent, i.e. their decision to use the system are
independent of other users
Cars on a Highway
As you can see these assumptions are fairly general, so they apply to a large variety of
systems. Lets consider the example of cars entering a highway. Lets see if the above
rules are met.
1. Total number of cars driving on the highway is very large.
2. A single car uses a very small percentage of the highway resources.
3. Decision to enter the highway is independently made by each car driver.
The above observations mean that assuming a Poisson arrival process will be a good
approximation of the car arrivals on the highway. If any one of the three conditions is not
met, we cannot assume Poisson arrivals. For example, if a car rally is being conducted
on a highway, we cannot assume that each car driver is independent of each other. In
this case all cars had a common reason to enter the highway (start of the race).
Telephony Arrivals
Lets take another example. Consider arrival of telephone calls to a telephone exchange.
Putting our rules to test we find:
1. Total number of customers that are served by a telephone exchange is very large.
2. A single telephone call takes a very small fraction of the systems resources.
3. Decision to make a telephone call is independently made by each customer.
Again, if all the rules are not met, we cannot assume telephone arrivals are Poisson. If
the telephone exchange is a PABX catering to a few subscribers, the total number of
customers is small, thus we cannot assume that rule 1 and 2 apply. If rule 1 and 2 do
apply but telephone calls are being initiated due to some disaster, calls cannot be
considered independent of each other. This violates rule 3.
Poisson Arrival Process
Now that we have established scenarios where we can assume an arrival process to be
Poisson. Lets look at the probability density distribution for a Poisson process. This
equation describes the probability of seeing n arrivals in a period from 0 to t.
Where:



t is used to define the interval 0 to t
n is the total number of arrivals in the interval 0 to t.
lambda is the total average arrival rate in arrivals/sec.
Negative Exponential Arrivals
We have seen the Poisson probability distribution. This equation gives information
about how the probability is distributed over a time interval. Unfortunately it does not
give an intuitive feel of this distribution. To get a good grasp of the equation we will
analyze a special case of the distribution, the probability of no arrivals taking place over
a given interval.
Its easy to see that by substituting n with 0, we get the following equation:
This equation shows that probability that no arrival takes place during an interval from 0
to t is negative exponentially related to the length of the interval. This is better illustrated
with an example.
Consider a highway with an average of 1 car arriving every 10 seconds (0.1
cars/second arrival rate). The probability distribution with t is given below. You can see
here that the probability of not seeing a single car on the highway decreases
dramatically with the observation period. If you observe the highway for a period of 1
second, there is 90% chance that no car will be seen during that period. If you monitor
the highway for 20 seconds, there is only a 10% chance that you will not see a car on
the highway. Put another way, there is only a 10% chance two cars arrive less than one
second apart. There is a 90% chance that two cars arrive less than 20 seconds apart.
In the figure below, we have just plotted the impact of one arrival rate. If another graph
was plotted after doubling the arrival rate (1 car every 5 seconds), the probability of not
seeing a car in an interval would fall much more steeply.
Poisson Service Times
In an M/M/1 queueing system we assume that service times for customers are also
negative exponentially distributed (i.e. generated by a Poisson process). Unfortunately,
this assumption is not as general as the arrival time distribution. But it could still be a
reasonable assumption when no other data is available about service times. Lets see a
few examples:
Telephone Call Durations
Telephone call durations define the service time for utilization of various resources in a
telephone exchange. Lets see if telephone call durations can be assumed to be
negative exponentially distributed.
1. Total number of customers that are served by a telephone exchange is very large.
2. A single telephone call takes a very small fraction of the systems resources.
3. Decision on how long to talk is independently made by each customer.
From these rules it appears that negative exponential call hold times are a good fit.
Intuitively, the probability of a customers making a very long call is very small. There is
a high probability that a telephone call will be short. This matches with the observation
that most telephony traffic consists of short duration calls. (The only problem with using
the negative exponential distribution is that, it predicts a high probability of extremely
short calls).
This result can be generalized in all cases where user sessions are involved.
Transmission Delays
Lets see if we can assume negative exponential service times for messages being
transmitted on a link. Since the service time on a link is directly proportional to the
length of the message, the real question is that can we assume that message lengths in
a protocol are negative exponentially distributed?
As a first order approximation you can assume so. But message lengths aren't really
independent of each other. Most communication protocols exchange messages in a
certain sequence, the length distribution is determined by the length of the messages in
the sequence. Thus we cannot assume that message lengths are independent. For
example, internet traffic message lengths are not distributed in a negative exponential
pattern. In fact, length distribution on the internet is bi-modal (i.e. has two distinct
peaks). The first peak is around the length of a TCP ack message. The second peak is
around the average length of a data packet.
Single Server
With M/M/1 we have a single server for the queue. Suitability of M/M/1 queueing is easy
to identify from the server standpoint. For example, a single transmit queue feeding a
single link qualifies as a single server and can be modeled as an M/M/1 queueing
system. If a single transmit queue is feeding two load-sharing links to the same
destination, M/M/1 is not applicable. M/M/2 should be used to model such a queue.
M/M/1 Results
As we have seen earlier, M/M/1 can be applied to systems that meet certain criteria. But
if the system you are designing can be modeled as an M/M/1 queueing system, you are
in luck. The equations describing a M/M/1 queueing system are fairly straight forward
and easy to use.
First we define p, the traffic intensity (sometimes called occupancy). It is defined as the
average arrival rate (lambda) divided by the average service rate (mu). For a stable
system the average service rate should always be higher than the average arrival rate.
(Otherwise the queues would rapidly race towards infinity). Thus p should always be
less than one. Also note that we are talking about average rates here, instantaneous
arrival rate may exceed the service rate. Over a longer time period, the service rate
should always exceed arrival rate.
Mean number of customers in the system (N) can be found using the following equation:
You can see from the above equation that as p approaches 1 number of customers
would become very large. This can be easily justified intuitively. p will approach 1 when
the average arrival rate starts approaching the average service rate. In this situation, the
server would always be busy hence leading to a queue build up (large N).
Lastly we obtain the total waiting time (including the service time):
Again we see that as mean arrival rate (lambda) approaches mean service rate (mu),
the waiting time becomes very large.
An important lesson to learn here is that systems should be designed so that even at peak
throughput of the system, resource occupancy should be a little below 100%. This is required to
keep the queue lengths and delays within bounds.
SECOND
A Simple M/M/1 Queueing Model
A simple example illustrates some of the concepts involved in model building. The network
shown in Figure 2.6 models an M/M/1 queue. Transactions originate at the source node
Sampler. The user chooses the interval between transactions, called the inter-arrival time,
to be a sample of a random variable (from one of several distributions), a fixed amount, or
the value of a variable read from a SAS data set. By default, the inter-arrival time is an
observation of an exponential random variable with parameter 1. This models a Poisson
process for transaction arrivals.
Figure 2.6: An M/M/1 Queueing Model
Queueing
When the transaction leaves the Sampler, it flows down the arc to the FIFO Queue. It is
important to note that the movement of the transaction down the arc does not advance the
simulation clock. On transaction arrival at the FIFO Queue, the queue broadcasts
messages down arcs asking nodes downstream if they are busy. The responses depend on
the types of components that are connected to the queue and the state of the simulation
when the message is received. (Details are given in the next chapter.) It is important to note
that broadcasting and evaluation of these messages does not advance the simulation clock.
If the queue gets a response that there is a nonbusy node, then it sends the transaction
down the arc leading to that node. Otherwise, the transaction remains in the queue. When
the simulation is first started, the Server is empty; when it gets the message "are you busy"
from the queue, it responds "no." As a result, the queue routes the transaction down the arc
to the Server.
Service
When the transaction arrives at the Server, service is scheduled and the transaction ties up
the server. By default, the service time is an observation of an exponential random variable
with parameter 1. Both the service distribution and its parameters can be changed using the
server's control panel. While the server is serving this transaction, any "are you busy"
messages sent to it result in a "yes" response. When service is complete, the server sends
the transaction on any arcs directed away from it and also sends a message up the arcs
directed into it requesting an additional transaction. In this example, if the FIFO Queue is not
empty, it will remove the transaction that has been there the longest and send it to the
Server. By default, all queues in the system have a capacity of 50 transactions. Of course,
this capacity can be changed through the user interface or programmatically, as discussed
in the next chapter. Since by default the inter-arrival times and the service times are
,
exponentially distributed with mean 1, the transaction time in the system would not have a
stationary distribution if the queue had infinite capacity.
Statistics
Finally, the transaction flows to a Bucket, which collects transactions and can also save the
value of transaction attributes in a SAS data set.
Figure 2.7: A Bucket Control Panel
From the bucket control panel (Figure 2.7) you can set the size of the transaction collection
buffer and name the transaction attribute to accumulate. You can also name a SAS data set
into which to collect the transaction attribute values.
Distribution Function Estimate
The UNIVARIATE Procedure
Variable: value
name=age
Moments
N
1803
Sum Weights
1803
Mean
24.5093328
Sum Observations
44190.3271
Std Deviation
14.8024337
Variance
219.112044
Skewness
-0.1060516
Kurtosis
-1.2191446
Uncorrected SS
1477915.34
Corrected SS
394839.903
Coeff Variation
60.3950903
Std Error Mean
0.34860632
Basic Statistical Measures
Location
Variability
Mean
24.50933
Std Deviation
Median
26.21585
Variance
Mode
.
14.80243
219.11204
Range
53.62360
Interquartile Range
26.10309
Tests for Location: Mu0=0
Test
Statistic
Student's t
t
Sign
M
Signed Rank
S
p Value
Pr > |t|
<.0001
901.5
Pr >= |M|
<.0001
813153
Pr >= |S|
<.0001
70.30662
Quantiles (Definition 5)
Quantile
Estimate
100% Max
53.62741148
99%
50.95981599
95%
46.44804080
90%
43.36915659
75% Q3
37.45295397
50% Median
26.21585009
25% Q1
11.34985903
10%
3.08194661
5%
1.38985610
1%
0.28776996
0% Min
0.00381383
Extreme Observations
Lowest
Highest
Value
Obs
Value
Obs
0.00381383
1442
51.9481
819
0.02449773
1486
52.1543
818
0.02846473
1458
52.1938
418
0.04001101
1249
52.4247
419
0.06573967
1700
53.6274
817
Figure 2.8: Statistics on a Transaction Attribute
If you collect data into a SAS data set and then press the Analyze button, univariate
statistics will be calculated by the UNIVARIATE procedure (Figure 2.8) and a sample
distribution function as shown in Figure 2.9 will be plotted.
Figure 2.9: Sample Distribution Function
See Chapter 9, "Analyzing the Sample Path," for more information about collecting statistics
and analyzing simulation data.
THIRD
M / M / 1 Model
The M / M / 1 queueing model is the easiest mathematically to analyse. Hence, this page will work
through some mathematical detail on analysis of the M / M / 1 model. Another section will summarise
results for more complex models. More mathematical detail on the derivations in this section can be
found in Chapter 2 of reference [PAGE72].
With reference to the section on Kendall notation, the reader will realise that the M / M / 1 model
is a queueing model where both the distribution of customer arrivals and the distribution of
service times are assumed to be exponential, and there is a single server.
Definitions




Let f(t) be the PDF of the inter-arrival times and let a be the average inter-arrival time.
Let g(u) be the PDF of the service time and s be the average service time.
Remember that both f(t) and g(u) are exponential distributions (see the section on statistics).
Let and be as defined in the section on mathematics for all queueing models.
Thus,
Probabilities
Let Pt(i) be defined as in the section on notation.
One can look at a small interval of time
equations holds for an natural number i).
and express Pt(i) after the small interval of time (the
For small values of , the chance of a customer arrival to the queue is
, and the chance of a
service completion is
. Thus the equation above can be solved as a differential equation as
tends to 0, with the correct values substituted in. The terms involving multiple events involve
higher powers of , so they drop out during the analysis - demonstrating that multiple events
cannot happen in a 'very short' period of time. The general solution to this equations is:
Also, it can shown from this that in a steady-state queueing system,
and where
Server Utilisation
In the steady state, the server is only being used when there are customers in the system. Thus the
utilisation of the server can be found by subtracting the probability that there are no customers in the
system from 1 (certainty):
Customer Waiting Time
The chance a customer will not have to wait for service at all is the probability that there are no
customers in the queue:
However, one can go one better than this and work out the PDF of the customer waiting time, so
that more information can be found on how long a given customer may have to wait. It can be
shown by consideration of the time the other customers will have to wait in the queue, and the
most likely number of customers in the queue, that:
Average Number of Customers
In the steady state, by considering the probability equations above, it can be seen that:
FOURTH
Introduction
This Section explains the simplest type of single queue - the M/M/1 queue.
The simplest queueing system consists of two components (the queue and the server) and two
attributes (the inter-arrival time, i and the service time, t). The usual schematic
representation of this systems is as follows:
Customers arrive at the queue from the input randomly in time but have mean inter-arrival
time i. The customers take a random amount of time to be served but have mean service time t.
We assume in this case that these random times both have an exponential distribution.
This system is illustrated by the applet below. You may enter the service time and inter-arrival
time in the top-right fields. (Note: for the queue to be stable (ie not get longer indefinitely as
time goes on) the service time must be shorter than the inter-arrival time.)
The applet then uses Queueing Theory to calculate various performance measures for the
queue. These are displayed immediately. You may simulate the queue by pressing 'Run'. This
causes customers to be generated at the Source and move to the queue. Above the illustration
is a representation of the Markov Chain associated with this queue. The states of the Markov
chain represent the number of customers in the system.
As the simulation runs, statistics are collected from it and displayed below the calculated
measures. You can compare these, to see how quickly they approach the predicted values.
Queueing Theory
To solve the queueing system we rely on the underlying Markov chain theory. However we
can abstract away from this and use the traffic intensity to derive measures for the queue. The
traffic intensity, t, is the service time divided by the inter-arrival time. From this we calculate
the measures used in the applet as follows:
Let pi represent the probability that their are i customers in the system. The probability that the
system is idle, p0, (ie the Markov chain is in state 0) is given by
p0 = 1 - t.
The Utilisation, U, of the system is 1 - p0. ie. the proportion of the time that it is not idle.
U = 1 - p0 = t.
The probability that the queue is non-empty, B, is the probability of not being in state 0 or
state 1 of the Markov chain ie.
1-p0-p1 = 1 - (1-t) - ((1-t)t) = 1 -1 + t - t + t2 = t2.
The expectation of the number of customers in the service centre, N, is the sum over all states
of the number of customers multiplied by the probability of being in that state.
This works out to be t/(1-t).
The expectation of the number of customers in the queue is calculated similarly but one
multiplies by one less than the number of customers.
This works out to be t2/(1-t).
Markov chains
A Markov chain is a system which has a set S of states and changes randomly between these
states in a sequence of discrete steps. The length of time spent in each state is the 'sojourn
time' in that state, T. This is an exponentially distributed random variable and in state i has
parameter qi. If the system is in state i and makes a transition then it has a fixed probability,
pij, of being in state j.
We can construct a Markov chain from a queueing system as follows; assign each possible
configuration of the queue a state, define the probability of moving from one state to another
by the probability of a customer arriving or departing. Thus state 0 corresponds to there being
no customers in the system, state 1 to there being one customer and so on. If we are in state i,
then the probability of moving to state i-1 is the probability of a customer departing the
system, and the probability of moving to state i+1 is the probability of a customer arriving in
the system (apart from the special case of state 0 when we cannot have a departure).
The fact that we can construct Markov chains from queueing systems means we can use
standard techniques from Markov chain theory to find, for example, the probability of the
queue having a particular number of customers (by finding the probability of the
corresponding Markov chain being in the corresponding state).