Queue Theory at the Convenience Store Checkout (Part 2)
I once analyzed people's behavior at the convenience store checkout using Queue Theory (M/M/1 or M/M/c). I explained that the number of people (N) is not as important as the length of service time for each individual. Well, yesterday when I went to buy a drink for breaking the fast (iftar) at the convenience store near campus, that theory faced a new challenge.
On a regular day, customer arrival rates can be predicted using a relatively constant Poisson distribution, but at five PM during fasting month, the system completely changes into a queue model with a bursty traffic arrival pattern.
In networking, bursty traffic is a condition where thousands of requests hit a server at the exact same time, followed by a fairly long quiet period. At the convenience store, this means from five o'clock to five-thirty, all students within a one-kilometer radius suddenly have an urgent need to buy bottled iced tea, dates, and cold fried snacks.
Can you guess what happens? The queue snakes all the way to the shampoo aisle at the back of the store.
If you use my old strategy (looking at the groceries of the people in front of you), it is no longer relevant. Because during bursty traffic, everyone is buying the same things (iftar snacks) in small quantities. The service time is uniform and very short. But because N (the number of people) explodes exponentially within ten minutes, your waiting time will still feel like an eternity.
In an overcapacity scenario like this, you are witnessing how a system either fails gracefully or crashes and burns.
A good convenience store will implement Load Balancing. The single cashier will call their friend from the back warehouse to open the second and third cash registers. They split the traffic into multiple nodes. But sometimes, even that is not enough if the backend system (for example the card EDC machine or the e-wallet network) also goes down because every store in Indonesia is doing transactions at the exact same second.
So how do you survive in this situation?
First, use the concept of Time Shifting. In computing, this means moving heavy tasks to hours when resources are idle. In the context of breaking the fast, do not buy your snacks at five-fifteen. Buy them at three PM, put them in the fridge. If you force yourself to buy at five, you are voluntarily offering yourself to become a victim of a physical DDOS (Distributed Denial of Service) attack.
Second, if you are forced to be trapped in a bursty queue, bring exact change. Do not pull out an ATM card, do not open an e-wallet app that keeps loading looking for a signal, and especially do not hand over a hundred-thousand rupiah bill to pay for a five-thousand iced tea. If you do that, you are not only breaking the cashier system, but you also become a bottleneck that makes dozens of people behind you late for iftar. In the eyes of Queue Theory, you are an anomaly that should be dropped from the queue.
Third, learn to accept the reality that sometimes, no matter how good your algorithm is, it cannot beat the laws of physics. Spatial capacity is limited, and time moves forward without being able to be paused.
So, stop complaining and apply time shifting next time. If not, just get ready to break your fast with your own saliva while staring miserably at the shampoo aisle.
- Khay