# Intuition of the Mean wait time in queuing system

In queuing theory, (with a single queue and a single server) writing $A$ for the service rate (of customers) and $B$ for the arrival rate (of customers) we know that the average time a customer waits in the system is given by,

$$W=\frac{1}{A-B}$$

What is the intuitive interpretation of this equation?

What I understand from basic intuition is that $A$ customers gets service in 1 sec (as $A$ is the service rate) so, one customer should get service in $1/A$ seconds.

Now, $B$ means, $B$ customers comes in 1 second (the arrival might be bursty or not depending on the probability distribution). So, $(A-B)$ is , how many more customers can the server serve per second, right?

So, why is the waiting time $W=1/(A-B)$?

How can I understand this relationship intuitively?

• If you agree the average number of customers served per second is $A-B$, then the average time in between finishing serving one customer and finishing serving another is the reciprocal of that. That's just dimensional analysis, essentially. (That said, notice that this result makes no sense when $B \geq A$.) – Ian Jul 13 '16 at 4:41
• No, I meant, if, B<A, then, average number of customers served will be B, right? as A>B, the server can serve B customers on average, and, in addition, it can serve (A-B) MORE customers on average, right? – Skynet094 Jul 13 '16 at 4:48
• Be careful: if $B<A$ then you need to first get to the front of the line (which will sometimes take longer if $B$ is larger) and then you need to actually be served. If $B \geq A$, then in the long run you are always serving someone, but the average time that one customer will spend in line will blow up because the length of the line will grow over time. Thus your result doesn't work with $B \geq A$. – Ian Jul 13 '16 at 4:57
• It does work with $B<A$; Andre gave a good sketch of why that should be the case. Another way to look at it: count how long it takes to go from a line of some length to no line at all, then divide that by the number of customers that you served in that amount of time. Then you are not shrinking the length of the line by A per unit time, because the line is also growing due to new customers; you are only shrinking the length of the line by A-B per unit time. – Ian Jul 13 '16 at 4:59
• Okay, got it, thanks! – Skynet094 Jul 13 '16 at 5:09

## 2 Answers

I am canoeing up a river at a speed (relative to the water) of $A$ miles per hour, and the current in the other direction is $B$ miles per hour. If $A\gt B$, my speed relative to the shore line is $A-B$, so it will take me $\frac{1}{A-B}$ hours to travel $1$ mile.

Or if you prefer I am running up a down escalator.

The intuition behind the delay formula for a M/M/1 queue is based on the stability assumption requiring that during my waiting delay same numbers of customers got service and arrived to the queue. Customers arrive with a rate of $$B$$ while being serviced at a rate of $$A$$. I joined the queue and noticed some customers in front of me. Let my aggregate queueing and service delay is $$W$$, then during my waiting time, $$A\times W$$ customers were served (including myself). Provided the system is stable the same number of customers shall arrive during time W. However, this number equals to $$1 + W \times B$$, where "1" counts for myself. Equating both numbers (what flows in shall flow out for stability) we get:

$$1 + WB = WA$$

and

$$W = 1/(A - B)$$