# Expected Waiting Time in a Queuing System $(M | M | 2 | 5)$

In the queuing system $$(M | M | 2 | 5)$$, the input flow rate is $$240$$ requests per hour, the average service time for one request is $$30$$ seconds. Find the average waiting time for an application in the queue.

How do I find that?

Let $$\pi_k$$ denote the steady-state probability that there are $$k$$ requests. We have $$\lambda=4\,\texttt{min}^{-1}$$ and $$\mu=2\,\texttt{min}^{-1}$$. Write $$\rho:=\dfrac{\lambda}{\mu}=2$$. We have the balance equations $$\lambda\,\pi_0=\mu\,\pi_1\,,$$ and $$\lambda\,\pi_k=2\mu\,\pi_{k+1}$$ for $$k=1,2,3,4$$. That is, $$\pi_1=\rho\,\pi_0\,\text{ and }\,\pi_{k+1}=\frac{\rho}{2}\,\pi_k$$ for $$k=1,2,3,4$$. If $$p:=\pi_0$$, then $$\pi_1=\rho\,p\,\text{ and }\,\pi_k=\frac{\rho^k}{2^{k-1}}\,p$$ for $$k=2,3,4,5$$. Since $$\sum\limits_{k=0}^5\,\pi_k=1$$, we obtain $$p=\frac{1}{1+\rho+\frac{\rho^2}{2}+\frac{\rho^3}{4}+\frac{\rho^4}{8}+\frac{\rho^5}{16}}\,.$$ The expected queue size is $$L_q=0\,\pi_0+0\,\pi_1+0\,\pi_2+1\,\pi_3+2\,\pi_4+3\,\pi_5=\frac{\frac{\rho^3}{4}+\frac{2\rho^4}{8}+\frac{3\rho^5}{16}}{1+\rho+\frac{\rho^2}{2}+\frac{\rho^3}{4}+\frac{\rho^4}{8}+\frac{\rho^5}{16}}\,.$$ From Little's Law, the expected wait time $$W_q$$ is $$W_q=\frac{L_q}{\lambda}=\frac{1}{\lambda}\,\left(\frac{\frac{\rho^3}{4}+\frac{2\rho^4}{8}+\frac{3\rho^5}{16}}{1+\rho+\frac{\rho^2}{2}+\frac{\rho^3}{4}+\frac{\rho^4}{8}+\frac{\rho^5}{16}}\right)\,.$$ For $$\lambda=4\,\texttt{min}^{-1}$$ and $$\rho=2$$, we get $$W_q=\left(\frac{1}{4}\,\texttt{min}\right)\frac{2+4+6}{1+2+2+2+2+2}=\frac{3}{11}\,\texttt{min}\,.$$