Choosing a style for three product scenarios
Work through three product briefs: knock out styles that break a constraint, score the rest against prioritised drivers, recommend one, and write the observable condition that would make another style win, including one case where the obvious choice is wrong.
Contentsand lesson path
On this page
- The problem
- Scenario 1: Kiln, a converter for laboratory instrument files
- Scenario 2: Fleetline, a bike-share back end
- Scenario 3: Waymark, where the obvious choice is wrong
- Common mistakes
- Check your understanding
- Apply it
- Review prompt
Lessons of Architecture Styles
- Single-deployable styles: layered, modular, microkernel, pipeline Concept · 25 min
- Distributed styles: from client-server and SOA to actors and serverless Concept · 30 min
- Style characteristics and the price of distribution Concept · 20 min
- Choosing a style for three product scenarios Worked example · 30 min
- Style selection check Knowledge check · 6 questions
What you will learn
- Rate candidate styles against a system's prioritized quality attributes and constraints, including team size and operational maturity.
- Recommend a style for a scenario and state what would have to change for a different style to win.
Prerequisites: Quality Attributes & Trade-offs
01. The problem
You are the architect for three unrelated products. Each brief lists its drivers (what matters most, in order), its constraints (decisions already made for you) and its team. For each you will produce what the practice task asks for: a scored comparison of candidate styles and a recommendation that names the conditions that would reverse it.
The method has five steps, and the same five steps work for any brief:
- List the drivers in priority order, and the constraints.
- Knock out every style that breaks a constraint. A constraint is not traded against anything, so it never becomes a weight.
- Score the remaining candidates from 1 to 5 per driver, with a reason that uses the conditional claims of lesson 3, and weight the scores by priority. The arithmetic and the sensitivity check are taught in the architecture decision records skill; here the reasons matter more than the totals.
- Recommend a style, and say which levels it applies to, since styles combine.
- Write a revisit if line: an observable condition, with a number where possible, under which a different style would win.
02. Scenario 1: Kiln, a converter for laboratory instrument files
Product Open-source desktop tool that converts files from lab instruments
into one table format for analysis.
Drivers 1. New instrument formats are added often, mostly by outside
contributors (about one a month), without forking the tool.
2. Easy to maintain for 3 volunteer maintainers.
3. Reproducible: the same input and versions give the same output.
4. One faulty importer must not corrupt other results.
Constraints Runs offline on locked-down lab PCs. No servers, no budget.
Team 3 maintainers, no operations staff, releases a few times a year.The constraint does most of the work. Offline on lab PCs, no servers knocks out every distributed style, from client-server to serverless, because each needs a network or something running elsewhere. Two candidates remain: a modular monolith, where the maintainers write every importer into the core, and a microkernel, where importers are plug-ins built against a published contract.
Driver (weight) Modular monolith Microkernel
------------------------ ---------------------- -------------------------------
outside formats (5) 2 every format is a 5 contributors ship a plug-in;
core pull request the core does not change
easy to maintain (4) 5 one codebase 4 a contract and its versions
to keep stable
reproducible (3) 4 one version number 4 if output records plug-in
names and versions
faulty importer (2) 4 all code reviewed 3 in-process plug-ins share
the fate of the host
------------------------ ---------------------- -------------------------------
Total (best 70) 50 59Recommendation: a microkernel at the top level, discovered through package entry points, with a pipeline inside the core: read, parse (the plug-in's job), validate, normalise units, write. The output file records every plug-in name and version, which protects reproducibility. Plug-ins run in-process, as in lesson 1, because the maintainers review every plug-in listed in the project's documentation.
Revisit if one of these becomes true. Fewer than two outside formats arrive in a year: the plug-in contract then costs more than it gives, and a plain modular monolith wins. Plug-ins start to come from a public index that nobody reviews: run them out of process, with time and memory limits. Labs ask for shared history across users: a client-server product is then a different system, and needs a new decision.
03. Scenario 2: Fleetline, a bike-share back end
Product Back end for a city bike-share: unlock and lock, trips, pricing,
payments, maintenance and rebalancing of bikes.
Drivers 1. Unlock path: 99.95% of unlock requests succeed each month, p95
under 1 s from tap to unlock command.
2. Pricing ships experiments weekly without waiting for others.
3. Operations load fits one platform engineer.
4. Summer peaks are about 3x the winter load.
5. Running cost.
Workload Pricing recomputes all tariffs every hour, using several CPU-minutes.
Constraints Card data stays with the payment provider (tokens only).
The unlock path must keep the persistent connections that the lock
gateways in each district open; their firmware cannot change.
Team 30 engineers in 4 teams: Rides, Pricing, Payments and Accounts,
Fleet Ops. Automated CI/CD and on-call per team; tracing is partial.The gateway constraint knocks out standard serverless functions: a function cannot hold a persistent connection between calls, and the gateways cannot change. The payment constraint holds for any style. Three candidates remain: a modular monolith, a service-based design with one coarse service per team, and microservices.
Driver (weight) Modular monolith Service-based Microservices
------------------ -------------------- -------------------- ------------------
unlock path (5) 3 a heavy pricing 4 Rides runs alone, 3 more hops creep
job shares the with its own data into the path
process with unlock
Pricing ships (4) 2 one release train 4 own service; the 4 no gain over one
for four teams shared DB needs care service per team
ops load (3) 5 one unit to run 3 four units 1 dozens of units,
partial tracing
summer peaks (2) 3 scale everything 4 scale Rides alone 4 scale per service
cost (2) 5 smallest floor 4 four floors 2 many floors
------------------ -------------------- -------------------- ------------------
Total (best 80) 54 61 46Recommendation: service-based. Four services, one per team. Rides owns its own database, and the unlock path waits only for Rides and the lock gateway: the current tariff is copied into Rides whenever Pricing publishes one, so a slow Pricing service cannot block an unlock. Pricing, Payments and Fleet Ops share one database server with a schema each. Trip and fault events go through a broker to Fleet Ops and analytics, which do not need to answer the rider.
Notice why microservices lost: not because they are bad, but because the conditions of lesson 3 do not hold. Four teams gain no release independence from dozens of services beyond what four services already give, and partial tracing with one platform engineer makes every extra unit expensive. The modular monolith lost mainly on driver 2 and on sharing a process with the unlock path.
Revisit if two teams commit to the same service in most weeks of a quarter, or if changes to the shared database need sign-off from more than one team more than twice a month: split further, starting with the busiest seam. Revisit the other way if Pricing's experiments move into configuration and it stops releasing weekly: the modular monolith's simplicity would then outweigh driver 2.
04. Scenario 3: Waymark, where the obvious choice is wrong
Product Route-planning API for regional delivery firms: send a list of
stops, get back the best order and route for each van.
Drivers 1. p95 response under 2 s.
2. No operations staff: as little to run as possible.
3. Cost: traffic is high from 07:00 to 19:00, near zero at night.
Workload Every request searches a 3 GB road graph held in memory.
Loading and indexing the graph at start-up takes about 40 s.
Peak 20-60 requests/s; 0.2-0.8 s of work per request.
Team 5 developers, no dedicated operations.The obvious choice is serverless functions. Drivers 2 and 3 read like its advertisement: nobody wants to run servers, and the nights are quiet. But one line of the workload decides the matter, and it is not in the drivers: every process that serves a request needs its own copy of a 3 GB graph that takes 40 s to load. The estimate below assumes standard functions, where one execution environment handles one request at a time, and long-running instances whose 8 worker threads share one graph; every assumption sits at the top of the script.
"""envelope.py: copies of the road graph in memory at peak, two ways to run Waymark.
Back-of-the-envelope with stated assumptions. Change them and run it again.
"""
import math
GRAPH_GB = 3.0 # the road graph, held in memory by every process that serves requests
LOAD_S = 40 # seconds to download and index the graph when a process starts
THREADS = 8 # requests one long-running instance serves at once, sharing one graph
MIN_INSTANCES = 2 # keep a spare, so one instance can fail or be replaced
TARGET_BUSY = 0.7 # plan for 70% of threads busy at peak, leaving room for bursts
CASES = { # peak requests per second, seconds of work per request
"best": (20, 0.2),
"expected": (40, 0.5),
"worst": (60, 0.8),
}
print("case in flight function envs GB held instances GB held")
for name, (rate, seconds) in CASES.items():
in_flight = rate * seconds # Little's law: requests in progress at once
envs = math.ceil(in_flight) # one request at a time per function environment
instances = max(MIN_INSTANCES, math.ceil(in_flight / (THREADS * TARGET_BUSY)))
print(
f"{name:<9}{in_flight:10.0f}{envs:15}{envs * GRAPH_GB:9.0f}"
f"{instances:11}{instances * GRAPH_GB:9.0f}"
)
print(f"\neach new environment or instance: about {LOAD_S} s before it can answer")python3 envelope.pycase in flight function envs GB held instances GB held
best 4 4 12 2 6
expected 20 20 60 4 12
worst 48 48 144 9 27
each new environment or instance: about 40 s before it can answerIn the expected case, 20 requests are in progress at once. As standard functions, that is 20 environments, each holding its own copy of the graph: 60 GB, against 12 GB for four long-running instances planned at 70% busy. Every new environment also spends about 40 s loading, far beyond the 2 s target. AWS limits the initialisation phase of on-demand Lambda functions to 10 seconds and then retries it inside the first invocation, so the user who triggered the cold start waits for the whole load. The morning ramp creates environments by the dozen, and the platform replaces environments every few hours even under steady traffic.
AWS's documentation (checked November 2026) offers ways around parts of this, and each deserves a line in the record. Provisioned concurrency keeps environments initialised and can follow a schedule, but means 20 to 48 warm copies of the graph. SnapStart (Java, Python 3.12+, .NET) restores new environments from a snapshot instead of reloading; each still holds its own copy for one request at a time, and restoring a multi-gigabyte snapshot must be measured. Lambda Web Functions serve many requests per environment, but for Node.js (Python in preview, November 2026), with 2 GB of memory and 10 seconds to start. Lambda Managed Instances run multi-request environments on EC2 instances in your account, billed per instance and scaled to a minimum, not to zero: that is the design below hosted by Lambda, not the pay-per-request model that made serverless look obvious.
Recommendation: one deployable service, a modular monolith with modules for the graph, routing and the API, running as two to nine long-running instances (sized for 70% of threads busy at peak) on a managed container platform or Lambda Managed Instances. Each instance is marked ready only after its graph has loaded. Instances scale on a schedule (more by day, two at night) and on CPU, and a deploy starts new instances before it stops old ones. Serverless still fits the side jobs: rebuilding the graph from nightly map updates and sending usage reports.
Revisit if a load test shows a function environment, restored from a snapshot or serving several requests, answering within 2 s at p95 from a cold start while holding the graph within its memory limit, or if start-up falls to a second or two, for example with a prebuilt, memory-mapped graph file. Then run the estimate again: drivers 2 and 3 could tip the decision.
05. Common mistakes
06. Check your understanding
07. Apply it
Now do the practice task of this skill with the notes from lessons 1 to 3. Take the startup brief (one team, a domain that is still unclear) and the enterprise brief (eight teams, strict availability goals) and, for each:
- Write the brief as a card like the three above: drivers in order, constraints, team and operations.
- Knock out styles that break a constraint, with the reason.
- Fill in a score sheet for the remaining candidates, with a reason in every cell.
- Write a one-page recommendation: the style at each level, the costs you accept, and at least two revisit lines with a signal and a threshold.
- If one candidate looks obvious, write down which fact about the workload or the team would make it wrong, and check whether the brief contains that fact.
08. Review prompt
Without looking back: list the five steps used for every scenario and say why constraints are applied before scores. Explain why Kiln ended with two styles, why microservices lost for Fleetline despite four teams, and which single fact made serverless the wrong choice for Waymark. Then write one revisit line for each scenario from memory, with a signal and a threshold.
References
- Architecture styles (Azure Architecture Center)
- MonolithFirst (Martin Fowler, 2015)
- Lambda quotas (AWS documentation)
- Understanding the Lambda execution environment lifecycle (AWS documentation)
- importlib.metadata: entry points (Python documentation)
- Improving startup performance with Lambda SnapStart (AWS documentation)
- Lambda Managed Instances (AWS documentation)
- AWS Lambda Web Functions (AWS documentation)
- Configuring provisioned concurrency, including scheduled scaling (AWS documentation)
Your progress
Reading state
Sign in to save that you finished reading this lesson.
Prove this skill
6 questions · about 5 minutes · scored automatically. Marking a lesson as read never demonstrates a skill.