Computer Engineering is coming soon

We're still writing and reviewing the notes for every subject, and we'll open it when every subject is ready. Meanwhile you can practise aptitude, ask Aria about any subject, or see the branches that are ready.

System design decisions

Study notes on making system design decisions: definitions of key terms, laws (Amdahl, Little, CAP), trade-offs, metrics, worked examples (Amdahl speedup, availability calc, architecture choice), common mistakes and exam tips.

Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.

Why it matters

System design decisions choose the high-level structure and constraints of a software system. Engineers use them when selecting an architectural style (e.g., layered, microservices), deciding trade-offs between quality attributes (performance, availability, maintainability), and justifying those choices to stakeholders.

Key ideas

Start from the goal: deliver required behaviour and qualities within cost, time and risk constraints.

  • System design decision — a choice among alternative architectures, patterns, technologies, or allocations of responsibilities that affects system qualities, cost and risk. Decisions are recorded because they are hard to change later.

  • Quality attribute — a measurable property of a system other than its basic functions (examples: performance, scalability, availability, reliability, maintainability, extensibility, security, usability). Define target values for each attribute during requirements. Capture them as quality attribute scenarios (Source, Stimulus, Environment, Artifact, Response, Response measure).

  • Architecture driver — a requirement or constraint that strongly influences architecture (e.g., regulatory constraint, expected number of users, required 99.99% uptime). Drivers guide decisions.

  • Trade-off — when improving one quality reduces another (for example, higher performance may reduce maintainability). Document the trade-off and the rationale.

  • Tactic — a low-level design choice that helps achieve a quality attribute (e.g., caching is a tactic for performance; replication is a tactic for availability).

  • Pattern — a reusable, tested solution at a higher level than a tactic (e.g., Client-Server, Microservices, Event-driven). Each pattern comes with its pros and cons.

  • Non-functional requirement (NFR) — requirement describing quality attributes (often measurable); contrast with functional requirement (what the system does).

  • Constraint — any fixed limitation (technology lock-in, regulatory rule, hardware limit) that limits possible decisions.

  • Stakeholder — any person or role affected by the decision (users, operators, managers, auditors). Their priorities determine which quality attributes matter.

  • Coupling — the degree of interdependence between modules. Low coupling is generally better for maintainability.

  • Cohesion — how closely related the responsibilities within a module are. High cohesion is desirable.

  • Separation of concerns and modularity — divide system into modules each handling a specific responsibility; essential to manage complexity.

Exact statements of important theorems/laws and assumptions:

  1. Amdahl's Law (for parallel speedup)
  • Statement: If fraction p of a program's execution is perfectly parallelisable and fraction (1-p) is strictly serial, then the maximum speedup S on N processors is: S(N) = 1 / ( (1 - p) + p/N ).
  • Assumptions: fixed total workload, perfect parallelism for the parallel portion, no parallel overheads (no communication, synchronization, or load imbalance), processors identical.
  • Derivation (step by step): Let total original time = T. Serial part time = (1-p)T; parallel part = pT. On N processors, serial part still takes (1-p)T, parallel part ideally takes pT/N. Total time T_N = (1-p)T + pT/N. Speedup S = T / T_N = 1 / ( (1-p) + p/N ).
  1. Little's Law (for queues)
  • Statement: For a stable system (work arrival rate = departure rate) over long time, average number in system L = λ · W, where λ is average arrival rate and W is average time in system.
  • Assumptions: stationarity (long-run averages exist), system stable (not growing unbounded), averages well-defined.
  • Derivation: Over long interval T, let A items arrive. Average arrival rate λ = A/T. Each item spends W on average, so total item-time = A·W. Average number L = (total item-time)/T = (A·W)/T = λ·W.
  1. Availability formula (simple model)
  • Statement: For a component with Mean Time Between Failures MTBF and Mean Time To Repair MTTR, steady-state availability A = MTBF / (MTBF + MTTR).
  • Assumptions: failures are followed by repairs (no permanent failures), cycles repeat, MTBF and MTTR are mean values.
  1. CAP theorem (distributed systems)
  • Statement: In an asynchronous distributed system where network partitions can occur, during a partition you must choose between Consistency and Availability; Partition tolerance is not optional if partitions are possible. Here Consistency means linearizability (single-copy semantics) and Availability means every request eventually receives a non-error response.
  • Assumptions: asynchronous network (unbounded message delay), partitions may occur; definitions per Gilbert and Lynch; in the absence of partitions you can have both C and A.

What to draw (diagrams to include in an exam answer):

  • Trade-off triangle: draw a triangle and label corners "Performance", "Cost", "Time-to-market". Draw an arrow showing moving toward one corner reduces one or both of the others.
  • Decision record box: draw a box with fields: Decision, Context (drivers & constraints), Alternatives, Rationale, Consequences, Date, Owner. This shows how to document decisions.
  • Simple component diagram: draw boxes for major components (e.g., API Gateway, Auth Service, Data Service) with arrows for dependencies and annotate where tactics apply (cache, replica, queue).

Formulas

S(N) = 1 / ((1 - p) + p / N)

  • S(N): speedup with N processors (dimensionless). p: fraction of workload parallelisable (0 ≤ p ≤ 1). N: number of processors (integer). Applies when workload is fixed and parallel part has no overhead.

S_G(N) = N - α · (N - 1) (Gustafson–Barsis's Law, scaled workload)

  • S_G(N): scaled speedup with N processors (dimensionless). α: serial fraction of runtime on 1 processor (0 ≤ α ≤ 1). Applies when workload scales with N (parallel work grows) and overheads are negligible.

L = λ · W

  • L: average number of items in system (dimensionless, count). λ: arrival rate (items per second, s⁻¹). W: average time an item spends in system (seconds, s). Applies to stable queuing systems (Little's Law).

Availability A = MTBF / (MTBF + MTTR)

  • A: steady-state availability (fraction between 0 and 1). MTBF: mean time between failures (seconds, s). MTTR: mean time to repair (seconds, s). Applies when failures are followed by repairs and statistics are stable.

Throughput = Concurrency / ResponseTime (from Little's Law)

  • Throughput: operations per second (s⁻¹). ResponseTime: average time per operation (s). Concurrency: average number of operations in progress (dimensionless). Applies to stable systems (long-run averages exist). Special case: if Concurrency ≈ 1, then Throughput ≈ 1/ResponseTime.

Worked examples

  1. Amdahl's Law numerical Question: A program has 80% parallelisable code (p = 0.8). What is the maximum speedup on 8 processors? Show steps. Steps:
  • Formula: S(N) = 1 / ( (1-p) + p/N ).
  • Put numbers: (1-p) = 0.2, p/N = 0.8 / 8 = 0.1.
  • Denominator = 0.2 + 0.1 = 0.3.
  • S(8) = 1 / 0.3 = 3.333... . Answer: Maximum speedup ≈ 3.33×. (Interpretation: even with 8 processors, speedup limited because 20% is serial.)
  1. Availability calculation Question: A server has MTBF = 90 days and MTTR = 4 hours. Compute availability percentage. Steps:
  • Convert to hours: MTBF = 90 days × 24 h/day = 2160 h. MTTR = 4 h.
  • A = MTBF / (MTBF + MTTR) = 2160 / (2160 + 4) = 2160 / 2164 ≈ 0.99815.
  • In percent: 0.99815 × 100% ≈ 99.815%. Answer: Availability ≈ 99.815%. (Show effect: reducing MTTR to 1 h increases availability slightly to 2160 / 2161 ≈ 99.953%.)
  1. Model answer: Choose architecture for a small e-commerce product expected to grow rapidly Question: Which architecture — monolithic or microservices — and why? Provide design decisions and trade-offs. Model answer (short):
  • Identify drivers: rapid time-to-market, expected rapid user growth, need for independent deployments, limited initial team size, requirement for 99.9% uptime.
  • Alternatives: (A) Monolith; (B) Microservices.
  • Evaluate against drivers:
    • Time-to-market: Monolith wins (single deploy, simpler). Microservices slower initially.
    • Scalability: Microservices win (can scale hot spots independently). Monolith scales by whole-app replication.
    • Team size and skills: Small team -> monolith easier. Microservices require DevOps maturity.
    • Availability: Microservices with replication and circuit breakers can localise failure; monolith failure affects whole app.
    • Complexity & cost: Microservices increase operational complexity and cost.
  • Decision: Start with a well-modularised monolith (apply separation of concerns, modular layers, clear interfaces) to meet time-to-market and small-team constraints, but design module boundaries and APIs so the most volatile/scalable parts (e.g., catalog, cart) can be extracted later into microservices. Record this as a decision with triggers (e.g., when requests/sec > X or when team grows to Y).
  • Rationale: balances early delivery and later scalability; reduces upfront operational cost; makes later migration feasible.
  • Consequences: need discipline on module boundaries and tests; small technical debt expected to enable future extraction.

Common mistakes

  • Using Little's Law on unstable systems (arrivals > service capacity) — L will grow unbounded and law assumptions break.
  • Confusing availability and reliability (availability is fraction of time system is up; reliability is probability of no failure over interval).
  • Choosing microservices because of buzzwords without checking team/ops maturity and cost.
  • Not recording the context and assumptions of a decision; later reviewers cannot judge correctness.

For your exam

Typical question types:

  • Definitions and short notes: define terms like system design decision, quality attribute, tactic.
  • Derivations: derive Amdahl's Law or Little's Law with stated assumptions.
  • Design tasks: given drivers and constraints, propose architecture and justify with trade-offs and tactics.
  • Calculations: compute speedup (Amdahl) or availability (MTBF/MTTR) with units.
  • Diagrams: draw a component diagram showing how chosen tactics (replication, cache, queue) are placed. A full-marks answer includes: clear statement of drivers and constraints, explicit alternatives, quality attribute trade-off analysis, selected tactics with rationale, and decision consequences. For derivations, show every algebra step and state assumptions.

Quick check

  1. What is a design tactic?
  2. Give Amdahl's Law formula and name its assumptions.
  3. If MTBF = 1000 h and MTTR = 2 h, what is availability (in %)? Answers: A tactic is a low-level design choice to achieve a quality attribute (e.g., caching for performance); S(N) = 1 / ((1 - p) + p/N), assumes fixed workload, perfect parallelism of fraction p and no parallel overheads; Availability = 1000/(1000+2) ≈ 99.800%.

Finished this topic? Mark it so your progress, study plan and readiness keep up.

Stuck on something here?