M/M/1 and M/M/2 in the same Queue based on number of customers

753 Views Asked by At

Suppose you have a queue that starts as M/M/1 with an initial birth rate and initial death rate but the birth rate is larger than the death rate. Once you have n customers in the Queue it switches to M/M/2 with the same birth rate but the death rate is now doubled because of the extra server. The new death rate is now larger than the birth rate. It would go back to M/M/1 once the queue has less than n customers. How would you find the long term proportion of having more than n customers and the probability of going from i -> j customers in the system? And the expected amount of time in line?

There is a ton of information online talking about these two queues independently but not in the same system.

1

There are 1 best solutions below

2
On BEST ANSWER

Assuming $\mu<\lambda<2\mu$, this system can be modeled by a continuous-time Markov chain with generator $Q$ whose entries are $$ q_{ij} = \begin{cases} \lambda,& j=i+1, i<n\\ \mu,& j=i-1, i<n\\ 2\mu,& j=i-1, i\geqslant n\\ \end{cases} $$ and $q_{ii} = \sum_{j\ne i}q_{ij}$. Since this is a birth-death process, we have the detailed balance equations \begin{align} \lambda\pi_{i-1} &= \mu\pi_i,\quad 1\leqslant i<n\\ \lambda\pi_{i-1} &= 2\mu\pi_i,\quad i\geqslant n. \end{align} By induction it is readily seen that \begin{align} \pi_i &= \left(\frac\lambda\mu\right)^i\pi_0,\quad 1\leqslant i<n\\ \pi_i &= \left(\frac\lambda{2\mu}\right)^{i-n+1}\left(\frac\lambda\mu\right)^{n-1}\pi_0,\quad i\geqslant n. \end{align} From $\sum_{i=0}^\infty \pi_i=1$ we find that \begin{align} \pi_0 &= \left[\sum_{i=0}^{n-1}\left(\frac\lambda\mu\right)^i + \sum_{i=n}^\infty \left(\frac\lambda{2\mu}\right)^{i-n+1}\left(\frac\lambda\mu\right)^{n-1} \right]^{-1}\\ &=\frac{(2 \mu -\lambda ) (\lambda -\mu )}{\mu \left(\lambda +\mu \left(\left(\frac{\lambda }{\mu }\right)^n-2\right)\right)}, \end{align} and hence $$ \pi_i = \begin{cases} \frac{(2 \mu -\lambda ) (\lambda -\mu )}{\mu \left(\lambda +\mu \left(\left(\frac{\lambda }{\mu }\right)^n-2\right)\right)}\left(\frac\lambda\mu\right)^i,& 0\leqslant i < n\\ \frac{(2 \mu -\lambda ) (\lambda -\mu )}{\mu \left(\lambda +\mu \left(\left(\frac{\lambda }{\mu }\right)^n-2\right)\right)}\left(\frac\lambda{2\mu}\right)^{i-n+1}\left(\frac\lambda\mu\right)^{n-1},& i\geqslant n. \end{cases} $$ The long-term fraction of time that there are more than $n$ customers in the system is given by \begin{align} \sum_{i=n+1}^\infty \pi_i &= \sum_{i=n+1}^\infty \frac{(2 \mu -\lambda ) (\lambda -\mu )}{\mu \left(\lambda +\mu \left(\left(\frac{\lambda }{\mu }\right)^n-2\right)\right)}\left(\frac\lambda{2\mu}\right)^{i-n+1}\left(\frac\lambda\mu\right)^{n-1}\\ &= \frac{\lambda (\lambda -\mu ) \left(\frac{\lambda }{\mu }\right)^n}{2 \mu \left(\lambda -2 \mu +\mu \left(\frac{\lambda }{\mu }\right)^n\right)}. \end{align} The long-run expected number of customers in the system is given by \begin{align} L &= \sum_{i=1}^\infty i\pi_i\\ &= \lambda \left(\frac{1}{2 \mu -\lambda }-\frac{1}{\lambda-\mu }\right)+\frac{\lambda +n (2 \mu -\lambda )}{\lambda +\mu \left(\left(\frac{\lambda }{\mu }\right)^n-2\right)}+n. \end{align} We use Little's Law to find the long-run expected time in system : $$ W = \frac L\lambda = \left(\frac{1}{2 \mu -\lambda }-\frac{1}{\lambda-\mu }\right)+\frac{1 +n (2 \mu -\lambda )/\lambda}{\lambda +\mu \left(\left(\frac{\lambda }{\mu }\right)^n-2\right)}+\frac n\lambda. $$