http://en.wikipedia.org/wiki/Queueing_theory
It's a fascinating study requiring a good knowledge of probability to use beyond the simplified models. It turns out from the math that throughput using a single queue is better than using multiple queues.
A couple of additional thoughts, pooling queues like this only works if the changeover time to process different types of things is low. So in the case of a grocery store where there is no separate changeover or batch setup time it works well. If you are pooling work to people though it breaks down if only certain people can do certain types of work or the change over time to switch to a different task exceeds a certain threshold.
The other thing is the title of this post is almost certainly incorrect. Switching to a single queue reduces average queue time, but it does not reduce work time. In order to be 3x faster you would have to reduce both. The other factor at play is that people continuously rebalance from slow lines to fast lines, which also helps mitigate some of the problems.
* some grammatical edits
He takes queuing theory down to a slightly non-academic level and applies it to modelling computer systems such as web applications. From that you can fit observed data to your model and predict capacity on shorter cycles.
So I am wondering why don't stores do this already. And I believe it is because of perceptions. They understand that time will be saved, however, they realize that most people will be scared by a long line.
One long line that moves fast will still appear terrible compared to a bunch of small lines that crawl. Because people don't look long enough to estimate the rate of movement. They see both lines as static (not moving).
Other instances of "people are stupid" leading to poor design:
* Some cars come with a CVT (continuously variable transmission) rather than having to shift gears. The audible pitch of the engine just gradually goes up as the accelerator is depressed, rather than revving up and then shifting back down again. Since people were used to the gear-shifting behavior, they thought CVT's were underpowered, so they were actually redesigned to simulate the shifting behavior even though it was suboptimal.
* Coinstar machines are actually much, much faster than they appear. But people don't trust them if they don't take three times as long and make jangly coin sounds, so it just silently sorts the coins as fast as it can and plays a recording of jangly coin sounds, all the while delaying when it displays the final count onscreen.
Single-queue might be faster, the the psychology of customer satisfaction is much more complex than that.
Unfortunately that is the ONLY thing I got from that subject: "single line with lots of servers better than lots of lines with one server each". I can't really remember anything else, like WHY this is the case or how queues work. :/
http://blogs.msdn.com/b/ericlippert/archive/2009/08/20/queue...
From my brief understanding, when someone talks about Queueing theory they are not talking about a singular "theory" but they mean something much broader. It doesn't seem as if there is something here that needs to be proved or disproved.
This is a part of naming in mathematics that has always perplexed me.
edit: not sure why this would get downvoted, seems like a simple neophyte question
//pc = process customer, with a mean time mu per customer
scala> def pc(mu:Int):Double= new expo(mu).sample
// q = queue of n customers with mean process time mu
scala> def q(n:Int,mu:Int):Double=(1 to n).map(_=>pc(mu)).sum
scala> // put 3000 people in 1 queue with mean process time 50
scala> (1 to 1000).map(_=>q(3000,50)).sum/1000
res43: Double = 83107.37275937156
scala> //now put 1000 people each in 3 separate queues with the same mean process time as before
scala> (1 to 1000).map(_=>(1 to 3).par.map(_=>q(1000,50)).sum).sum/1000
res45: Double = 200010.29627921886
200010 = ~3x83107, so yeah, single line to 3 cashiers is ~3x faster than a separate line for each cashier.
// Now make 1 queue that feeds into shortest of the 3 queues
scala> def qq(n:Int,mu:Int)=(1 to 3).par.map(_=>{(1 to n/3).map(_=>pc(mu)).sum}).sum
scala> (1 to 10000).map(_=>qq(3000,50)).sum/10000
res70: Double = 141824.974765643
So our single queue feeding into 3 separate queues still beats 3 separate independent queues.
edited to address MaysonL's question.
I don't know what the "par" function does, but assuming it doesn't do anything crazy, the answer for all three of those expressions should be exactly 150,000, because they just reorder the order of summation.
The poster is a quant working with Scala so I am certain I have just misunderstood something. Nevertheless, my humble bachelor's degree has led me to the same conclusion as you.
I have edited my original response to include that scenario as well. btw for M/M/1 vs M/M/3, here's a good reference: http://people.brunel.ac.uk/~mastjjb/jeb/or/queue.html
Do you mind writing out what you're doing in pseudocode or in words? Intuitively, this result doesn't seem obvious to me.
Imagine where you have a one line scenario - you watch which register people go to. Label people who went to registers A,B,C with A, B and C respectively. Then, repeat the situation, but instead of one line, use 3, where everyone labeled A stands in one line, B in the other, and C in the third.
The transactions play out exactly like before. I realize we're dealing with probabilities and expected values, but it's definitely not obvious to me.
>Intuitively, this result doesn't seem obvious It isn't obvious because human arrival times at checkout counters follow a Poisson distribution and their service times follow an Exponential distribution. The stated results follow immediately if you look at the cumulative density function for the exponential.
Stated another way, suppose service times followed a Uniform distribution. Then none of this would hold. But because they are Exponential, these results come into play. Intuitively, we think in terms of Uniform distribution. So your mind is saying, wait a minute, if there are 1000 people in a queue, they probably average a 10 to 15 service minute per person. But that's like saying if there are 1000 people in an office, they probably make 100k on average because that's about what you (might) make. In reality incomes follow a Pareto, so your janitors will take home 30k and your managers will pull in a couple mil. A similar sort of dynamic applies here with the exponential distribution. The key takeaway is: Service times are not uniform but exponential.
I am also very curious why the total time to process 3000 customers with mean time 50 is not closer to 3000*50. Perhaps I have missed something on the technical side.
It's obvious that single queues for each cashier isn't very efficient, but the tradeoff is that lines are visibly shorter, and progress to the goal is clear.
Having a single line for all cashiers (ala Fry's Electronics or an airline ticket agent) is more efficient, but the long line, logistics of finding the next available cashier, and uncertainty of completion make for a frustrating experience as well.
I posit that having N banks of 4-6 cashiers is a good balance between both. You get the efficiency gains of not being blocked by a bottleneck, and you also get visibly shorter lines and the benefits of estimating when you are next (ok, looks like cashier 1 and 2 are almost done, I should be out of here in a few minutes).
Someone here mentioned this kind of setup with self-checkout at grocery stores, and I think it works well, as long as the number of self-checkout stands in the "bunch" is not too large. There's a local grocery store where there's 8 of them, and it's a little too chaotic (IMO, anyway).
What happens is, another customer comes along, sees three cashiers and one queue (in the middle) and decides to join the "empty queue" in front of the cashier at either end.
Of course they know there's only one queue and that they are queue jumping, but they calculate that they can pretend they didn't know.
I assume there's a cultural factor here. I'm in the UK and have seen this many times in one store nearby, but I imagine that in some parts of the world you would be beaten or shot for it. I have never seen anybody complain about it, they just temporarily disperse into three queues (which is awkward because there is not really enough room.)
I mention this not just because it's relevant to the idea of waiting in line at a store, but because in every store where I've seen these systems installed, the entire bank of scanners has a single line, unlike the rest of the store. I imagine it's mostly because they place the self-check scanners so close together (because they can) that it doesn't make sense to try to form multiple lines, whereas a single queue system for the real checkers would take up a huge amount of space.
At first they were awesome because nobody used them, so you could zip right through and avoid the lines. But now, after they've been here for a few years, a lot more people feel comfortable using them but many of those people use them poorly and far too many people will use them even when they have an entire cart full of groceries. That's an entire cart full of stuff they have to scan without accidentally voiding the whole order (which I've seen happen multiple times), a lot of trial and error on trying to figure out how to scan their produce, etc, etc.
It has reached the point where I rarely bother with self checkout anymore unless there is absolutely no line for it because while the system works great when nobody else is using it, it doesn't scale that well because most people are terribly slow checkers relative to dedicated workers doing that job.
The one problem with the theory described above is that most walmarts have a 6 cashier express with a single line, and besides 'rush hour' when the store is packed it's often faster to go to a till to get <10 items scanned. I've ran in before and been out in minutes by going through a regular cashier and avoiding the express because the single line holds the problem that people are stupid, don't pay attention or can't hear and hold up the line, then they have to unpack their cart.
Theory is great, but it's useless when you're stuck behind a bunch of old women who can't hear them being called and spend 20 minutes chatting with the cashier.
I love these, because I can be done in 10 seconds. The people in front of me in line to use these, however, are rarely able. It's actually faster to wait in the non-self-checkout line these days because the people in the self-checkout line use them so slowly.
(Also, self-checkouts suck. I bet their throughput is terrible compared to manned checkout lines. That teenage checkout girl is WAY better than I am at scanning stuff.)
I use them because I don't want to interact with someone just to get some groceries. I know, it's kind of sad, but I don't want to say 'Hi' and 'Thank you' and I don't want 5 bags when 2 would suffice and don't want to explain that, so I just do it myself.
To self-scan you need to register with the store, and in the beginning you're manually checked a couple of times. They track how many errors you have and on what kind of merchandise, and determine how trust-worthy you are and how often you should be manually checked.
I can't remember if this was already implemented or just a suggestion from somewhere, but the self-scanning devices could track your location in the store, both to analyze customer behaviour but also to monitor any suspicious activity. If you spend 15 minutes in the electronics department without scanning anything, maybe that warrants a manual check.
As a side note, I wonder how much time self-scanning and self-checkout really saves in the end, for the consumer, and how much of it is just letting us do more unpaid labour under the impression of efficiency.
- I have seen at least one store where a single sign is placed at the front of the full collection of scanners stating "line forms here" or something similar, regardless of how many there are or how they are arranged. - I have seen at least one case where, in a store that did not have the above sign, one line formed for each "vertical" bank of scanners. For example, in my local Safeway, there are six scanners: two rows of three each, lined up next to each other, parallel to the checkstands. It is pretty intuitive/obvious that they don't intend for people to line up at each individual unit in a single row, but often a queue will form for each row.
And just in case you feel like killing about 20 minutes of your day, check out the rest of his videos. They are excellent.
In the early days, the food was all built asynchronously from the orders. Cashiers would walk back and fill the order themselves from the bin full of burgers and fries in pretty quick fashion and the customer would be on their way.
When the whole "made as you go" approach was started, McDs decided to keep the 1:1 cashier-customer model (unlike Burger King or Wendy's, who do it 1:N style).
So now you have customers ordering and standing around next to their cashier waiting for the food to be made, which the cashier has no control over. The order of filled requests is also somewhat random. If the kitchen is having trouble, people start piling up by the counter.
I've noticed that some stores are experimenting with a numbering system that is encouraging you to step back and watch a monitor for your order when it is ready.
hrabago's point is important, but it certainly doesn't justify the linkbait title. A single line will decrease the variance of the wait time. Since the customer's impression of the wait time is very non-linear, this might significantly reduce customer unhappiness. But that isn't some brilliant insight into the process of handling customers faster.
0 0 0 (first person in each line has no wait time)
10 1 1
11 2 2
If you sum up the total wait times you get: 27mNow do this with a single file line with three cashiers:
0 (first three people have no wait time)
0
0
1 (only two people get processed at a time now)
1
2
2
3
3
What you see is that one guy basically blocked one of the cashiers for the whole time, but the other two cashiers could continue to process. The total wait time: 12mChange the numbers and you can create different factors for which the single file line is more efficient.
EDIT: Made a typo the first time on the wait times for the 3-line scenario. The wait time is actually 27m, not 25m.
There is a good amount of psychological research on waiting, and people in lines are much happier if certain things can be relied on. One of these things is fairness, as in, my wait time should be as long as everyone else's. Another thing is knowing how long the wait will be, which reduces anxiety over the wait. Single queue feeders enable those two things to happen much better than multiple queues. So even if the math ends up being the same either way, the customer will likely be happier with the single queue.
Because when you pick a line you don't know which line will go the fastest ahead of time. Neither do others on average, so everyone ends up spending more time.
These little mental models of efficiency always make the nervous introvert in me worry that I am wrong, or if society in general publishes people who try something different.
The naive answer is to avoid retail interactions.
But I would fully expect the majority to find fault in it. And reasonably so. The system is in place and it is multiple queues. The consequence of bucking the system is, at its most polite, a sneer and a scoff.
Leading left hand turns at a vehicular intersection may be the wiser alternative, but to flout a trailing left hand turn and jump through at the green is dangerous, rude and illegal.
Spatially, its actually quite complex to make one long line (it will probably have to snake around your store, and you'll need those awful movable tape barriers everywhere to make sure everyone keeps in line - customers hate these) and then to make one long line split evenly into several end points is not easy either (doing this may also take up a lot of valuable floor space).
Also, you could just have a store layout inherited from the 60s and its too expensive to change it right now...
Oh, and airline ticket counters are routinely run this way.
Edit: Yelp says this line system has been eliminated. http://www.yelp.com/biz/target-emeryville-2
It felt more stressful, efficiency be damned. You spend more time at the "front" of your line (A,B,C) , waiting for the board to change. In a traditional system you can hook in behind someone and "zone out" / chat with your SO until you reach the register. In this system I felt like I had to pay attention the whole time and I was interrupted every time the bell rang, even if it was A's turn and I was in line C.
And they prefer to choose their own line rather than wait in a single-file line for the next available register—even though that set-up has proven to be faster, research on queuing shows.
Based on these data points, it would seem as though more crowded places use this optimization.
There are practical reasons to do that. That is common in realtime systems. Trying to isolate the cpu for a particular process. So that is available faster when that process needs it. You could also have n-realtime processes. You don't want them competing for the same CPU if you know ahead of time you can allocate a CPU for each one of them.
Another reason is caching. For example you can assign a CPU to process network interrupt requests from a particular network device. Then you might or might not want to also assign the process that consumes that data to that CPU.
Assuming rebalancing, it seems to me that your wait time EV is the same either way, with less variance in the single queue case. Thus the shopper throughput should remain the same. Can someone explain to me if/why this is wrong?
Also, where did the HN title come from? I could not find that claim in the article.
The author writes about a Little's Law
This is my proposal for a "no change given" line.
You walk up, you plop down at least the amount of money that the items are worth, they quickly scan the <5 items, check the money is at least as much as the total, then you move on. You don't get change, you don't get a receipt, they don't take cards. Just drop the money and run.
Good for business as they would collect many extra $$ from impatient shoppers, and good for shoppers who are impatient. All-round good.
As an aside: The Fry's Electronics store in my city does this and the line does move at a pretty brisk pace, but I had always thought it a rather odd setup till I read this and made the connection to global queuing in Passenger. fascinating.
See "Power of two random choices": http://www.eecs.harvard.edu/~michaelm/postscripts/handbook20...
EDIT: link
When there is one cashier and a dozen customers waiting, that tells me the store is too cheap or too mismanaged to have other cashiers scheduled.
The best thing a store can do for customer relations is to open additional registers when too many customers are waiting, it implies the customer's time is important.
I also enjoy discovering it was the store manager themselves running the extra register - it means they stay in touch with how things are done (and how hard the cashiers have to work).
This isn't really news. WalMart's been doing this forever.
And, IIRC, it's not that there's much impact to average performance, but rather that the variation (sigma) drops by a factor of n.