Part 7 of 8 · 3 min read
Distributed case
Different parts need different characteristics.
Case study: a distributed system (Going, Going, Gone)
The second FSA kata is the online auction Going, Going, Gone (GGG), met on page 6. Its requirements state ambitious levels of scale, elasticity and performance, and different parts need different levels. The choice is between low-level event-driven and microservices. FSA picks microservices because they separate pieces by their operational characteristics, while a purely event-driven design is organised around a communication style (broker or mediator) and not around those characteristics. The book accepts that performance will be a challenge and says to design around the weak spot, for example by avoiding too much orchestration and too aggressive data separation.
The services in the book's design:
| Service | Job |
|---|---|
| Bid Capture | Takes bids from online bidders and passes them on asynchronously. Needs no storage of its own |
| Auctioneer Capture | Takes bids from the auctioneer. Split from Bid Capture because its characteristics differ |
| Bid Tracker | Joins both bid flows and orders bids as close to real time as possible. Both inputs are asynchronous, so queues can buffer very different rates |
| Bid Streamer | Streams bids to online participants, read-only |
| Video Capture / Video Streamer | Capture and stream the live video |
| Auction Session | Runs the workflow of one auction |
| Payment | A third-party payment provider, used after the auction ends |
The reasons for asynchronous links are driven by differing characteristics. FSA's example: if Payment can process only one new payment every 500 ms and many auctions end together, synchronous calls would time out. With 40 auctions ending at once, the 40th payment would wait 20 seconds (40 times 0.5 s). A queue in front of Payment absorbs the burst and adds reliability to a fragile part.
The analysis gives five quanta: Payment, Auctioneer, Bidder, Bidder Streams and Bid Tracker. FSA says this is not the one correct design nor necessarily the best, but one with the least worst set of trade-offs. Using quanta at the component stage helped find service, data and communication boundaries.
Interview angle
Answer in your head first, then open it.
How do you choose an architecture style?
List the top characteristics, find how many quanta the system needs, then match the style: one set suggests a monolith, differing sets suggest distributed. Check the team and budget, then decide data and sync or async.
Monolith or microservices for a new product?
Usually start with a modular monolith unless there are clear needs for independent scaling, teams or reliability.
Why is there no best style?
Each is a bundle of trade-offs, and the right one depends on which characteristics the system needs most.
What do you say when asked for a design out loud?
State the needs and top three characteristics, the style and why, what you give up, and how you would check it (a fitness function) and record it (an ADR).
Check yourself: 1. Why did FSA reject a purely event-driven design for GGG? 2. In the made-up Payment example, how long does the 20th payment wait? 3. What does a queue in front of Payment buy?
Words you will meet
| Word | Meaning |
|---|---|
| Architecture style | A named bundle of structure and trade-offs |
| Decision matrix | Styles against needed characteristics, with strong or weak in each cell |
| Isomorphism | The shape of the problem matches the shape of the style |
| Quantum | A deployable unit with its own set of characteristics (page 4) |
| Fitness function | An automatic check that protects an architecture principle |
| Modular monolith | One deployment, divided by business domain |
| Microkernel | A small core with plug-ins |
| Backends for frontends (BFF) | A thin adaptor per device type in front of a generic backend |
| Kata | A practice problem used to train architects |