4.5.5 · D3Software Engineering

Worked examples — Software architecture — layered, MVC, event-driven, microservices, serverless

4,528 words21 min readBack to topic

The names we will use (defined before anything else)

Because the whole page is about counting connections and dollars, let me name the few quantities we will keep re-using — in plain words, with a picture in mind — before they appear anywhere else.

Now that , , and are earned, here are the two formulas everything on this page plugs into.

Two more plain-words ideas we lean on for the team/scaling examples, defined here before they appear:


The scenario matrix

Now enumerate the whole space. Every architecture decision is really a point in a grid. Below are the case classes — think of them as the quadrants and edge cases of our topic. Each worked example later is tagged with the cell it fills.

# Case class The knob that moves Degenerate / limiting version
C1 Small team, simple CRUD team size → small team size = 1 (a solo dev)
C2 One data, many views number of view types grows exactly 1 view (MVC is overkill)
C3 Many independent reactions consumers per event grows 1 producer, 1 consumer (events overkill)
C4 Fan-out wiring cost producers × consumers or (no savings)
C5 Independent scaling need one part is hot, rest cold all parts equally loaded (split useless)
C6 Bursty / idle traffic invocation count (idle) and huge (steady)
C7 Real-world word problem mixed drivers e-commerce at launch vs at scale
C8 Exam twist a "gotcha" that inverts the naive answer "microservices first" trap

C4 · The fan-out wiring count (with pictures)

Let us start here because it produces the single most-cited number in event-driven advocacy, and it is easy to get wrong at the edges.

Figure — Software architecture — layered, MVC, event-driven, microservices, serverless

The figure shows the two shapes side by side: on the left, direct calls — every violet producer draws a magenta line to every orange consumer, making a dense mesh. On the right, the broker — the magenta square in the middle — turns that mesh into two simple fans, so each dot connects only to the hub. Keep this picture in view for the counting below.

Recall When does the broker start winning?

Solve for the smallest symmetric case ::: at : is false (tie); at : true — so the broker wins from about 3×3 upward.


C6 · Serverless cost across the whole traffic range

This is the "quadrants" of serverless: traffic can be near-zero (idle), bursty, or huge-and-steady. We compute all three from one formula.

Figure — Software architecture — layered, MVC, event-driven, microservices, serverless

In the figure the magenta line rises with (serverless is — every call costs) while the violet dashed line is flat at $70 (a reserved server you pay for regardless). The orange dotted crossover marks where they meet: left of it serverless is cheaper, right of it the flat server wins. The navy dot marks our 100-million-call worked example.


C1 & C5 · Team size and the scaling knob

The figure below shows C5 concretely: on the left, a monolith replicated 50 times — each copy drags along all three modules (magenta search, violet profile, orange checkout), so the cold modules are duplicated needlessly. On the right, only search (magenta) is replicated 50 times while profile and checkout stay at one copy each. Count the boxes: the right side is far leaner.

Figure — Software architecture — layered, MVC, event-driven, microservices, serverless
Recall C5 degenerate: all parts equally loaded

If every part gets equal traffic, does splitting for scale help? ::: No — you'd scale all services equally, which is the same as replicating the monolith. The split only pays when load is uneven.


C2 · One model, many views (MVC's sweet spot and its edge)


C3 & C7 · Word problem, and the "add a reaction" test

The figure shows the C7 event flow: the violet Order code emits one OrderPlaced event into the magenta broker, which fans it out to four orange consumers (email, inventory, analytics, shipping). Note the caption — adding shipping later means drawing one new orange arrow from the broker, with zero edits to the order code on the left.

Figure — Software architecture — layered, MVC, event-driven, microservices, serverless

C8 · The exam twist


Recap — the decision in one breath

Recall Serverless idle bill for 1000 tiny calls

Roughly how much? ::: about $0.0006, i.e. well under a cent.

Recall Serverless vs

61.67, just under the $70 server — near the crossover.

Recall The exact serverless/server crossover for this profile

How many calls? ::: about (≈113 million), from (cost per call ).

Recall Direct vs broker wiring at 4 producers, 5 consumers

The two counts? ::: direct , event .