Discussions

News: Starbucks Does Not Use Two-Phase Commit

  1. Starbucks Does Not Use Two-Phase Commit (33 messages)

    Gregor Hohpe observed that Starbucks has an asychronous model to taking care of your coffee orders. He has written up their model, and how they handle "exceptions", by discussing their compensating transactions and such. He concludes with: The coffee shop interaction is also a good example of a simple, but common Conversation pattern.

    Read more: Starbucks Does Not Use Two-Phase Commit

    Threaded Messages (33)

  2. not all cases :)[ Go to top ]

    If you're a regular customer at your local starbucks and the barista's know you, you can get your coffee without asking for it. In fact, sometimes I walk in and the barista hands me my coffee and I give them the money. I should note that this only works if you always get the same thing.

    sometimes I get a coffee for free, or if an order was wrong they'll ask me if I want the other order also. what can I say, I like my coffee. On a technology related note, have people tried to implement the software equivalent and with which design patterns?

    In a messaging system, I would think using something like message types to give certain messages higher priority could be one embodiment of the barista example.
  3. A coffee pattern?:[ Go to top ]

    if (!coffee) CVS=null;

    There has to be a generics way to implement above.
    .V
  4. not all cases :)[ Go to top ]

    I think this is a case where you have a caching mechanism in combination with messaging. Your coffee is simply cached since it is a reoccuring request.
  5. does coherence cache coffee?[ Go to top ]

    maybe cameron can build into the next version of coherence :) ok that's the last bad joke from me.
  6. does coherence cache coffee?[ Go to top ]

    maybe cameron can build into the next version of coherence :) ok that's the last bad joke from me.

    ha ha ha !!! Almost died laughing. Sorry Cameron :-) couldn't help it.
  7. does coherence cache coffee?[ Go to top ]

    maybe cameron can build into the next version of coherence :) ok that's the last bad joke from me.

    ha ha ha !!! Almost died laughing. Sorry Cameron :-) couldn't help it.

    Technically, we just cache the beans.

    You must be thinking about Grinder.

    Peace,

    Cameron Purdy
    Tangosol, Inc.
    Coherence: Shared Memories for J2EE Clusters
  8. man that's impressive[ Go to top ]

    coherence will cache the beans, grind them for me and make the coffee. Sweet jesus, does duncan donuts know about coherence. That might be the secret weapon they need to shoot down the SS Starbucks.
  9. Starbucks Does Not Use Two-Phase Commit[ Go to top ]

    Since Starbucks is the Microsoft of coffee providers it surprises me this one didn't get posted on TSS.Net instead.
  10. Pilots use Two-Phase Commit[ Go to top ]

    Earlier this year, I got my pilot certificate. Pilots in a plane use two-phase commit when transfering control of the plane from one to another. If the pilot wants the co-pilot to take over, the exchange goes like this:

    Co-pilot: "I have the controls."

    Pilot: "You have the controls?"

    Co-pilot: "I have the controls."

    Only after hearing "I have the controls" a second time, does the pilot let go. If the exchange doesn't go like this, the pilot has to assume that he is still the pilot in command of the plane.

    If someone doesn't get their coffee, or they get it free without paying, it's not the end of the world. If no one is flying the plane, it could be the end of the world!

    Two-Phase commit is like that. Use it when you absolutely need it.
  11. Pilots use Two-Phase Commit[ Go to top ]

    Earlier this year, I got my pilot certificate. Pilots in a plane use two-phase commit when transfering control of the plane from one to another. If the pilot wants the co-pilot to take over, the exchange goes like this:Co-pilot: "I have the controls."Pilot: "You have the controls?"Co-pilot: "I have the controls."Only after hearing "I have the controls" a second time, does the pilot let go. If the exchange doesn't go like this, the pilot has to assume that he is still the pilot in command of the plane.If someone doesn't get their coffee, or they get it free without paying, it's not the end of the world. If no one is flying the plane, it could be the end of the world!Two-Phase commit is like that. Use it when you absolutely need it.

    talk about a real-world example of when "two-phase" absolutely is life threatening and critical. man I had a good laugh.
  12. Pilots use Two-Phase Commit[ Go to top ]

    What happen if co-Pilot second message got corrupted and/or lost that Pilot hear as "blah..I blah...".
  13. Pilots use Two-Phase Commit[ Go to top ]

    If no one is flying the plane, it could be the end of the world!
    No, it would just be the end of the world for the planes occupants.

    It seems a terribly bloated system for a small craft. On the Enterprise Picard just has to say "You have the bridge No. 1" and its a done deal.

    Not to worry though. I'm sure someone from JBoss will be along presently to tell you how to transfer control more efficiently using AOP.
  14. Pilots use Two-Phase Commit[ Go to top ]

    It seems a terribly bloated system for a small craft. On the Enterprise Picard just has to say "You have the bridge No. 1" and its a done deal.

    Picard has plenty of time to hand over the controls of the Enterprise, if there's a mistake the ship's not going to go into a roll and hit the ground, firstly there's no up and down, secondly there's no air so it can't stall and lastly there's no ground to hit. In a small plane things are a little different, especially near to the ground and even more so near a busy airport. I'd be more than happy to have Jean-Luc take me into DS9 but I think you'll find he uses two phase nearer the station.

    In a small plane things get a little more relaxed at 10,000 feet when the cruise control's on, [as a pilot] I've never bothered with the 2 phase "you've got the controls" unless the situation is critical where an error can put life at risk.

    -John-
  15. Pilots use Two-Phase Commit[ Go to top ]

    Earlier this year, I got my pilot certificate. Pilots in a plane use two-phase commit when transfering control of the plane from one to another. If the pilot wants the co-pilot to take over, the exchange goes like this:Co-pilot: "I have the controls."Pilot: "You have the controls?"Co-pilot: "I have the controls."Only after hearing "I have the controls" a second time, does the pilot let go. If the exchange doesn't go like this, the pilot has to assume that he is still the pilot in command of the plane.

    You're right, and in fact it even goes beyond that. Usually the pilot gets light on the controls during the transfer and doesn't get off of them until she can feel the yoke and rudder move. It's also good form for the copilot to wiggle each a little to indicate that they have it, in addition to the verbal exchange.

    Important ATC-pilot exchanges also use verification, as in "One five echo whiskey, fly runway heading after departure, cleared for takeoff runway 32" to be replied to with "Runway heading, cleared runway 32, one five echo whiskey." ATC then expects you to do your thing so they can sequence remaining aircraft.

    P.S. Congrats on your PPL Jay!
  16. Pilots use Two-Phase Commit[ Go to top ]

    Important ATC-pilot exchanges also use verification, as in "One five echo whiskey, fly runway heading after departure, cleared for takeoff runway 32" to be replied to with "Runway heading, cleared runway 32, one five echo whiskey." ATC then expects you to do your thing so they can sequence remaining aircraft

    Actually (in US at least), pilots do not need to readback anything - simple ack technically is good enough. Some busy departure procedures state that only callsign and squawk should be readback, unless pilot has questions. I think AIM only calls for readback of altitude and vector assignments for pilots of *airborne* aircraft.
  17. Pilots use Two-Phase Commit[ Go to top ]

    Actually (in US at least), pilots do not need to readback anything - simple ack technically is good enough. Some busy departure procedures state that only callsign and squawk should be readback, unless pilot has questions. I think AIM only calls for readback of altitude and vector assignments for pilots of *airborne* aircraft.

    The minimum req. for readback is alt, headings and clearances to navigate to navaids as well as clearances for landing and also the holding patterns...
  18. Pilots use Two-Phase Commit[ Go to top ]

    My girfriend use this 2 phase in practice:

    She: We need to see other people!
    Me: Are you sure?
    She: I think so

    There is some doubt, as is plain to see.
    Since I did not get the 2nd CLEAR confirmation, she is still with me... I think.

     :-)

    This no doubt this is sad news to all the girls: I am still locked away. But if my current girl does not clear the lock, I will time out!
    You know I can keep going w/ this. :-)

    .V
  19. My girfriend use this 2 phase in practice:She: We need to see other people!Me: Are you sure?She: I think soThere is some doubt, as is plain to see.Since I did not get the 2nd CLEAR confirmation, she is still with me... I think. :-)This no doubt this is sad news to all the girls: I am still locked away. But if my current girl does not clear the lock, I will time out!You know I can keep going w/ this. :-).V

    I think that's because there's some compensating transactions which are missing from the original query.

    she: we need to see other people
    you: are you sure?
    she: i think so
    you: I guess I'll return this ring
    she: I was just joking
    you: I'll hold on to the ring for you

    clearly, you need an EJB to make sure that transaction executes correctly and rolls back if necessary :)

    sorry for the bad joke
  20. My girlfriend use this 2 phase in practice:

    She: We need to see other people!
    Me: Are you sure?
    She: I think so

    The problem with this is that it requires both parties to commit, "she" is clearly not committed to the initial statement and probably changed her mind between statements. Women tend to do this which makes it hard to commit to them, in this case a distributed optimistic model is often better.

    Add locking for more entertainment.

    :-)

    -John-
  21. My girlfriend use this 2 phase in practice:She: We need to see other people!Me: Are you sure?She: I think so

    The problem with this is that it requires both parties to commit, "she" is clearly not committed to the initial statement and probably changed her mind between statements. Women tend to do this which makes it hard to commit to them, in this case a distributed optimistic model is often better.Add locking for more entertainment.:-)

    You might try a heuristic commit then.

    (OK, I'm stopping there. I just took a -5 hit to humor.)

    Peace,

    Cameron Purdy
    Tangosol, Inc.
    Coherence: Shared Memories for J2EE Clusters
  22. My girlfriend use this 2 phase in practice[ Go to top ]

    My girlfriend use this 2 phase in practice:She: We need to see other people!Me: Are you sure?She: I think so
    The problem with this is that it requires both parties to commit, "she" is clearly not committed to the initial statement and probably changed her mind between statements. Women tend to do this which makes it hard to commit to them, in this case a distributed optimistic model is often better.Add locking for more entertainment.:-)
    You might try a heuristic commit then.(OK, I'm stopping there. I just took a -5 hit to humor.)Peace,Cameron PurdyTangosol, Inc.Coherence: Shared Memories for J2EE Clusters

    just testing

    just testing
  23. Starbucks Does Not Use Two-Phase Commit[ Go to top ]

    To quote my local coffee shop "Friends don't let friends drink at Starbucks".
  24. not to digress too much[ Go to top ]

    I don't have a good local gourmet coffee shop, so starbucks is the next best thing. Even with your local coffee shop, I'm sure one could think of how orders are handled in the same way. plus there are far more evil chains out there like duncan dounuts.
    </joke>
  25. not to digress too much[ Go to top ]

    <joke>Maybe I should have added a smiley at the end of the quote to indicate a light hearted remark not to be taken so seriously ;-). I have many friends who go to Starbucks.</joke>

    As for the two phase commit they don't really work that way. Say I asked for two things a Bagel and a Tuna Sandwich (Yum). By accident the toast for my Sandwich gets burnt. In that case they start that part of sandwich again but the Bagel continous on. Therefore the model is much more like having two concurrent transactions running that both need to be completed (joined) to complete the order. Each tranaction also has save points where you can safely rollback to.
  26. does that include a big tip?[ Go to top ]

    I hope that includes a nice tip when both transactions execute without any exceptions.
  27. To quote my local coffee shop "Friends don't let friends drink at Starbucks".

    If you are refering to a cofee shop in bay area, their cofee kick ass Start bucks any given Sunday, and guess what they also don't use the two phase commit:-) not acording to my knowledge. Give me one more reason not to use two phase commit if we don't absolutely have to..
  28. This a good example of not modeling around software world but real world.

    If your client asked you to write coffee shop app what would you do, just follow the same patterns of implementing online shops or actually go and sit at sturbucks like this guy did?
  29. Drinks are delivered out of sequence and need to be matched up to the correct customer. Starbucks solves the problem with the same "pattern" we use in messaging architectures -- they use a Correlation Identifier. In the US, most Starbucks use an explicit correlation identifier by writing your name on the cup and calling it out when the drink is complete.
    Some people do not drink from paper cups, never.
  30. Drinks are delivered out of sequence and need to be matched up to the correct customer. Starbucks solves the problem with the same "pattern" we use in messaging architectures -- they use a Correlation Identifier. In the US, most Starbucks use an explicit correlation identifier by writing your name on the cup and calling it out when the drink is complete.
    Some people do not drink from paper cups, never.

    Their coffee is much too hot to hold in one's hands.
  31. Pilots use Two-Phase Commit[ Go to top ]

    This is one of the coolest (literally!) threads I have seen in recent times :-) . Nice to see the more widespread sense of humor!

    About pilots & 2-pase..
    Co-pilot: "I have the controls."
    Pilot: "You have the controls?"
    Co-pilot: "I have the controls."

    This seems more like redundancy rather than 2-phase commit. In 2-phase commit there is an intermediate state where there is a gaurentee of ensuring either a commit or rollback of all transaction parts. Which is not exactly the case. Here it is more of a handover after double redundancy of confirming "transfer" before the "release".

    Just nit picking :-)

    Cheers,
    Ramesh
    - www.pramati.com
  32. Compare To Mac donalds[ Go to top ]

    I go to Mac D quite a lot for lunch and Mac D is a classic comparision to a High Volume web site.

    This is how mac D functions
    1. There are multiple front end operators whose tasks are following
        a) take the order --> which in tern notifies the backend burger developers on the screens . this starts the process of burger making asynchronously in advance. Also note that Mac D also uses some caching mechanisms like building Big Macs in advance because they are sure to get the order for big macs.
     
        b) make a TOGO/ or dine in Plate
        c) Put salt and ketchup on the plate as per user request
        d) fill up the Soda
        e) Put the plate in queue to be fullfilled

    2. The Middle Tier Guys are responsible for
        a) fetching the Correct burger to the correct plate
        b) filling up the frys as per the size requirements
        c) These guys are also responsible for exception handling like (I had ordered a no meat burger - I got chicken in it).

    3. The backend guys responsible for the actual burger construction / Frys construction

    Lots of things to learn from mac D.
  33. Compare To Mac donalds[ Go to top ]

    Maybe they do it differently in US. In Australia, the front end also fills up the frys, the plate, makes ice cream, etc. The backend only produces the burgers.

    cheers
    romen
  34. Compare To Mac donalds[ Go to top ]

    American fast food is usually not that fast ;) Burger joints are usually relatively small low-volume build-to-order eateries, where customers create an order and then wait for their food to be prepared. In many European McDs the burgers are prepared beforehand, and the restaurants are huge. A good manager must be able to predict which burgers should be produced and in what quantities. If he gets mistaken, then front-end guys try to convince customers to buy overstock burgers. This works very often, because many customers do not really know what they want, so they can be talked into buying a "today's only special". A friend of mine worked in this kind of high-throughput facility and told me a lot of interesting things. For example, fries can be served only within 7 minutes after they were prepared, after that they are thrown away.

    So, in these high-volume McDs there is no middle-tier. There is an object factory, there is a controller/manager, and there are front-end guys who pull the objects from the conveyor lines and put them to the trays.