Back at the coffee shop, you've seen how queues work: customers arrive, wait in line, and get served by the barista. You understand the parts—arrivals, service, queue discipline, and queue depth—and what to measure, like wait time and queue length. Now, how do you predict what will happen before the shop gets busy? Queue models are the answer. These mathematical tools describe a queue, letting you calculate wait times, line lengths, and more, so you can test strategies without waiting for a rush. In this chapter, we'll explore the simplest model, called M/M/1, and use it to understand the coffee shop's queue. You'll also get to play with the formulas to see how the numbers change, building intuition for smarter queue management.
The M/M/1 model describes a basic queue with one barista (a single server), where customers arrive and are served in a predictable way. The “M” stands for “Markovian,” meaning arrivals and service times follow a random but consistent pattern. In the coffee shop:
This model assumes an unlimited queue depth—customers can line up as long as needed—and no one leaves if the line is long. It's a foundation for understanding how arrival and service rates drive queue behavior.
The M/M/1 model provides formulas to predict the queue's performance. Below, you can try each one by adjusting and to see how the results change in the coffee shop.
How busy the barista is, calculated as:
.
If and , then , meaning the barista is busy 83% of the time. If , the queue grows endlessly because arrivals outpace service. Try it:
The average number of customers waiting (not including the one being served). The formula is:
For , , boxes. Test it:
How long a box waits before processing:
With , , minutes (50 seconds). Try it:
The total time a customer spends in the shop (waiting plus service):
Here, minute, since service takes minutes. Try it yourself:
These formulas show why a healthy queue () keeps wait times and queue lengths manageable. When approaches , the numbers spike, signaling trouble.
The M/M/1 model helps you plan for the coffee shop. If you expect 5 customers per minute () and the barista serves 6 per minute (), the formulas predict customers wait about 50 seconds, with a line of around 4 people. But if a rush pushes to 5.9, things get messy:
This shows why managing overload is critical. You could hire another barista (moving to an M/M/2 model, covered later), limit the queue depth, or tweak the discipline. The M/M/1 model lets you test these ideas with numbers.
The simulator below brings the M/M/1 model to life. Adjust the arrival rate () and service rate () to see how they affect queue length and wait time over time. Start with a healthy queue (), then push close to to see the queue struggle. How do the results compare to the formula calculators? This is your chance to explore the coffee shop's queue and build intuition.
The M/M/1 model is a starting point for understanding queues. It reveals how sensitive a queue is to changes in arrival or service rates, especially near capacity. In the coffee shop, you might use these predictions to train the barista to work faster (increase ), cap the line to avoid chaos, or plan for busy periods. The model helps you weigh tradeoffs—shorter waits versus higher costs, or fairness versus speed—before the rush hits. By playing with the formulas and simulator, you're learning to think like a queue manager, ready to tackle more complex systems.
Next, we'll explore queues with multiple baristas to handle bigger crowds in the coffee shop.