Chapter 17. Your Coffee Shop Doesn’t Use Two-Phase Commit

Learn About Distributed System Design While in the Queue!

Grande, durable, non-atomic, soy chai latte
Grande, durable, nonatomic, soy chai latte

When designing solutions, architects often look at technical solutions like ACID (Atomic, Consistent, Isolated, Durable) transactions and binary values in order to craft a well-defined and perfect system. In reality, though, designing complex systems isn’t that easy, so there’s one more source of design guidance that you should consider: the real world.1

Hotto Cocoa o Kudasai

You know you’re a geek when going to the coffee shop gets you thinking about interaction patterns between loosely coupled systems. This happened to me on a trip to Japan. Some of the more familiar sights in Tokyo are the numerous Starbucks coffee shops, especially in the areas of Shinjuku and Roppongi. After stretching my limited Japanese skills by muttering “Hotto Cocoa o Kudasai” (“A hot chocolate, please”), I returned to my bubble of foreigner-ness and started thinking about how Starbucks processes drink orders.

Starbucks, like most other businesses, is primarily interested in maximizing throughput of orders because more orders equal more revenue. Interestingly, the optimization for throughput results in a concurrent and asynchronous processing model: when you place your order, the cashier marks a coffee cup with the details of your order (e.g., ...

Get The Software Architect Elevator now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.