6 ms·
Your Coffee Shop Doesn’t Use Two-Phase Commit (Starbucks async processing model)
- sirclueless 15y agoAt busy times, the Starbucks near me even goes farther. They have an extra employee ask people in line for their drink orders and marks them on the cup before you even reach the cashier so that the only bottleneck is actually paying for the drink.
- dshankar 15y agoIt mirrors the various tricks Apple uses to speed up the process (floor reps can checkout without a register)
- ghurlman 15y agoStarbucks was doing this long before there were Apple stores.
- adgar 15y agoYeah, every starbucks I've been to in Manhattan does this in the morning and lunch hours. It's damn efficient considering.
- mattberg 15y agothis started happening at a local Chipotle i go to at lunch. you actually pay while in line, then order your food, then show your receipt to cashier as proof. seems weird to me in this setting because what if i change my mind on what i want to eat based on what looks good. i guess it is more efficient though.
- jasonkester 15y agoThat's for their benefit, not yours: http://www.inc.com/magazine/20080801/how-hard-could-it-be-good-system-bad-system.html http://www.inc.com/magazine/20080801/how-hard-could-it-be-go... They're taking your order as soon as you walk in the door so that by the time you realize that you'll be standing there for 20 minutes waiting for your coffee you're already committed. You'd feel guilty walking out, so they get your business where they otherwise might not.
- ckluis 15y agoExcellent analogy.
- carlob 15y agoI guess none of you has ever set foot in a coffee shop in Italy. Compared to that Starbucks is the most inefficient place ever. I'd like to have hard numbers to prove that, but the sheer fact that one espresso is about $1 in Italy, the cost off coffee is comparable and the cost of land is much higher than in the US, makes me think that Italian baristas are at least twice as efficient.
- calpaterson 15y agoOr perhaps that competition is higher?
- carlob 15y agoYes, competition is higher, but my guess is that the turnaround time and real estate prices are what make most of the price of an espresso: the first through barista wages and the second through the rent. After all an espresso costs probably 5 cents in coffee.
- emeltzer 15y agoI'd be very interested in a description of how italian coffee shops handle a rush
- carlob 15y ago1. nobody ever sits 2. no paper cups 3. no useless lids 4. no endless variants of latte, mocha and what have you [1] Let's suppose the rush hour is after lunch, then everyone will be getting an espresso, someone macchiato (only tourists drink cappuccino after 11 am), but the price is the same. And basically you have a line at the bar and a line to pay. The bar can usually make up to 8 espresso at a time and people cram in front of it by the dozen and drink it in under a minute. You can pay before or after according to where the queue is shorter. [1] http://www.youtube.com/watch?v=rBNOB7FkSSM http://www.youtube.com/watch?v=rBNOB7FkSSM
- funkah 15y ago
- Uchikoma 15y agoYes, because I don't run away after I've paid. Essentially I'm blocked with a lock after I've paid which is a.) released when I get my coffee b.) released with a timeout (I don't want to wait any longer)
- sophacles 15y agoWhen I was in college as an undergrad, I worked at a local dive bar with a grill. Being a CS guy, and working with a couple other CS guys, we had a lot of fun with this same idea. When we worked the kitchen we would apply our understanding of queueing to great effect. We would play with different algorithms, analyze the bottlenecks presented by the various stations, optimize on expected workloads and so on. When some of the younger people also in CS would be taking the relevant classes, we would challenge them or help them (depending the person's skill level and needs) by showing them the applications in terms of the kitchen. It was pretty awesome. I think it really helped us get an intuitive feel for various aspects of decoupled queue based systems -- sometimes I still flash to the kitchen experience when figuring out workflows, and sometimes my early sketches of a system are laid out like the kitchen we worked in. Some cool lessons from this: * If you just look at the infrastructure, there is obviously one optimal way to do it, however if you look at the people doing each task at a station, this may change. We would abstract this out in our systems thinking to imagine various people as various systems or processing algorithms with different runtimes, and which we had no control over. This had strange implications in terms of efficiency, and which method would work best for the feeding and consuming steps around those stations. Also taught us about reordering and parallelizing certain tasks, even if those orders and parallelizations were not optimal in their own right. * If you know there will be a heavy bunch of orders for a certain type of item (e.g. daily special) you can start cooking batches before the orders come in, even if there are not yet orders, optimizing the cook time. Essentially just in time delivery stuff. Similar with fries (this place used a 2 stage fry cooking process). * Exceptional orders and out of band mechanisms: instead of trying to make the main workflow handle exceptional orders (very large, weird items, etc) it is is easier to have a second workflow or an ad-hoc workflow for that situation - it prevents interruptions, starvation issues, etc for the main queue. * It is very amusing to watch the puzzled look on customer's faces when they see the cooks white-boarding math equations during lulls :)
- ColinDabritz 15y agoYou definitely should be trying to improve your kitchen algorithms if they are causing starvation issues! Joking aside, I love that you were applying the modeling, design, and performance analysis ideas to a different domain like this. It's the classic case of cross disciplinary teams or cross discipline thinking yielding surprising benefits. I love that you used it to teach CS as well, which makes a powerful reciprocal relationship. I used to wonder why the fast food places didn't have hefty pattern analysis going on to predict needs, e.g. "it's Tuesday at 4:30, we almost always need 28 chicken strips in the next 30 minutes so put them down" even to the point of balancing speed vs waste and other issues. Maybe they are doing that now, but it's got a lot of potential.
- sedachv 15y agoAnother place where 2PC isn't used is in bank accounts, even though the "bank account transfer" example is the stereotypical example introducing transactions. Networked credit banking was basically worked out in 4th century BC Egypt.
- snowwrestler 15y agoThe illustration makes it easy to see how credit or gift cards benefit Starbucks' workflow, by removing the price interaction. Regulars with a card can just hand the card over with the order and payment is immediately processed. This removes the round trip around price.