MMC Queues
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Introduction
Queueing Theory is the quantitative study of operational characteristics of a system of workflows for a service/process given a processing time, an arrival pattern, and a limitation of resources. It can answer questions such as:
- How long would a customer/part/etc. (entities) wait to be processed?
- What is the probability of x or more entities being in the system at the same time?
- What is my expected utilization of resources?
A queue or waiting line is a natural occurence in a system when the demand of customers exceeds the currently available resources that can serve that demand. Queues occur everywhere in our daily life at the grocery store, movie theatre, emergency room, and restaurants.
A Simple Queue
The simplest model has an arrival pattern represented by a distribution of interarrival times. Typically, this is represented as an exponential distribution, which has the property of the mean being equal to the variance. This implies a large amount of variability as to when a entity is ready for processing. The second assumption is that the entity will be processed in the system given a service rate distribution. For simplicity we will start with a service rate that also follows an exponential distribution. The system is represented in the figure below in three stages: Arrival, Processing, and Exit.
Queue Modeling
The queue model sets up the system as states of workload in a steady state. Steady state refers to if the system were to run continuously where would it reach equilibrium. The figure below illustrates the modeling in a birth-death process. The state is the number of entities in the system represented by the numbers in the ellipses. The transition rates represent the entrances and exits to each of those states.
\(\mu\) represents the transitional service rate and \(\lambda\) represents the transitional arrival rate to the next state. c represents the number of servers that are currently busy.
M/M/C Queue
An M/M/C queue is shorthand notation for Markovian arrival rate, Markovian Service Rate, and C the number of resources. In another post I will dive into Queueing Theory notation and distribution classifications. The queueing
package in R makes it very easy to set up queue models. Below, I have created a model that assumes an exponential arrival rate, an exponential service rate, and a limited number of resources processing the entities.
library(queueing) arrivalRate <- 4 #arrivals per hour serviceRate <- 1 #entities processed per hour resources <- 5 mmcInput <- NewInput.MMC(arrivalRate, serviceRate, resources) mmcQueue <- QueueingModel(mmcInput)
The expected utilization is 0.8.
The average waiting time in the queue is 0.55 hours.
The average number of entities in the system is 6.22.
M/M/C Shiny App
I’ve created a Shiny App that allows the user to play around with the inputs to a M/M/C queueing model and perform sensitivy analysis on varying the number of resources (servers in this case). Try it here:
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.