System design fundamentals
38 questions in 9 subtopics.
System design fundamentals are the habits and numbers behind every good architecture discussion, in interviews and in real design reviews. Before choosing databases or queues, an engineer must pin down requirements, estimate load and storage with simple arithmetic, know how long common operations take, and understand what availability targets really demand. Production systems fail where these basics were skipped: launches sized on daily averages, health checks that remove every instance, hidden single points of failure and consistency chosen by accident. The questions cover structuring a design answer, requirements and scope, back-of-the-envelope estimation, latency and throughput numbers, availability and nines, vertical and horizontal scaling, stateless services, consistency trade-offs and redundancy, with worked numbers, real incidents and the strategy decisions senior engineers and leaders own.
Structuring a system design answer
A design answer follows a structure: clarify requirements, estimate the numbers that matter, define the API and data model, draw the high-level design, then go deep on the hardest part and close with failures and evolution. Understand why each step comes in that order, how to adapt when a requirement changes midway, and how the same structure makes design documents and reviews catch problems before production.
A system design interview usually gives 45 to 60 minutes and a short, open prompt such as 'design a photo-sharing service'. Many candidates start drawing databases at once and run out of time before discussing the hard parts.
What structure would you follow through a 45-minute design discussion, roughly how much time does each step get, and what should each step produce?You are joining an interview panel and must score candidates' system design answers. Two candidates both drew the same boxes (load balancer, services, cache, database), yet the panel felt one was much stronger.
What separates a strong system design answer from a weak one when the diagrams look the same, and what evidence would you look for while scoring?Twenty minutes into designing a URL-click analytics service, you have a design built for 5,000 events per second with a single PostgreSQL primary. The interviewer now says the real rate is 250,000 events per second with bursts of twice that.
How do you adapt the design without starting over, and how do you explain which parts survive and which change?You chair design reviews for 12 product teams. In one quarter two incidents came from designs that passed review: one had no plan for a dependency outage, the other doubled load on a shared database nobody had estimated.
How do you change the structure of design documents and reviews so these gaps are caught before production?Requirements and scope
Requirements say what the system must do and how well: functional flows, plus non-functional targets for latency, availability, durability, consistency, security and cost. Learn to turn vague words such as real-time into measurable targets, to agree what is out of scope, and to surface constraints such as data residency early, because a late requirement is the most expensive kind of design change.
Requirements split into functional ones (what the system does for users) and non-functional ones (how well it must do it: latency, availability, durability, consistency, security, cost). A design prompt such as 'design a food-ordering service' leaves both open.
Which clarifying questions would you ask, which functional and non-functional requirements would you write down, and what would you place out of scope?A team spent three months building a streaming pipeline with sub-second updates for an inventory dashboard because the product brief said 'real-time'. After launch it turned out managers open the dashboard twice a day, and the pipeline costs more than the warehouse system it reads from.
What went wrong in the requirements, and how do you turn vague words such as real-time, fast and always available into requirements a design can be tested against?A team built a customer analytics service in a single US region. Two weeks before launch, legal points out that contracts with European customers require their data to be stored and processed in the EU, and that support staff outside the EU may not view it.
What do you do now, and how should requirements gathering have caught this earlier?Your company is entering a new market with a team of eight engineers and six months. The product plan lists 40 features and the architects propose multi-region active-active from day one.
As the senior technical leader, how do you set the scope and decide which non-functional requirements to meet now and which to defer?Back-of-the-envelope estimation
Rough estimates turn users and actions into requests per second, storage per year, memory and bandwidth, so design choices rest on numbers. Know the shortcuts (a day is about 100,000 seconds), why peaks, write amplification and retries matter more than daily averages, and how replication, overhead and growth change raw figures. The aim is the right order of magnitude, stated with its assumptions.
A photo-sharing app has 10 million daily active users. Each user makes about 20 requests a day, and about 10 percent of users upload one photo a day, stored at an average of 2 MB.
Estimate the average and peak requests per second and the storage added per year, showing your arithmetic and assumptions.A team plans to keep login sessions for 50 million active users in Redis, about 1 KB of data each, and asks for one 64 GB Redis instance with a replica.
Estimate the memory really needed and say whether one 64 GB instance is enough.A new 'share to friends' feature was estimated at 2,000 writes per second from 50 million daily users divided over 86,400 seconds. On launch day the database received 18,000 writes per second within minutes of a push notification and fell over.
What did the estimate miss, and how should load estimates for a launch be built?An image service serves 50,000 thumbnail requests per second at an average of 40 KB through a CDN with a 95 percent hit ratio. One origin instance can serve about 1,500 requests per second at the target CPU.
Estimate the CDN egress bandwidth, the origin load and the number of origin instances, and say which case should set the origin size.A messaging product has 50 million daily active users, each sending about 40 messages a day; a message with metadata and indexes takes about 500 bytes. Traffic grows about 40 percent a year, and the storage team must order capacity for the next three years.
Estimate write rates and storage for the three years, and say what you would validate before the order is placed.Latency and throughput numbers
Designers reason with orders of magnitude: memory in nanoseconds, SSD reads in microseconds, round trips within a zone well under a millisecond and across continents near a hundred milliseconds. Understand how sequential calls and new connections add up, why fan-out makes tail latency dominate, and why latency climbs steeply as utilisation approaches saturation, so capacity targets must leave headroom.
Designers use rough latency numbers to judge a design before building it: how long a memory read, an SSD read, a network round trip within a data centre and a round trip across a continent take, in orders of magnitude.
Give the rough order of magnitude for those operations, and use them to judge a request that makes 30 sequential database calls in the same zone and one call to another continent.To save cost, a team proposes running its API fleet at 90 percent CPU instead of 60 percent. In a load test at 90 percent, p99 latency rose from 80 ms to 1.2 seconds, although each request needs only about 8 ms of CPU.
Why does latency rise so sharply as utilisation approaches 100 percent, and what utilisation target would you set?A search endpoint fans out every request to 20 index shards in parallel and waits for all of them. Each shard answers in 8 ms at p50 and 120 ms at p99, yet the endpoint's p50 is already near 120 ms and its p99 is over 400 ms.
Explain why the endpoint is so much slower than a typical shard, and what you can do about it.To improve resilience, a company moved its web tier into a second region 70 ms away, while the database and two internal services stayed in the first region. Requests served from the new region went from 120 ms to 600 ms at p50.
Explain where the time went, and how you would redesign so a second region helps instead of hurting latency.Availability, SLAs and nines
Availability is the share of time or requests a service works, often written in nines. Know how much downtime each target allows, how serial dependencies multiply and redundancy improves availability, why correlated failures break the arithmetic, and the difference between an SLA, a contract with credits, and an SLO, an internal target. Measuring availability where users experience it is as important as the target.
Availability is often stated in nines, the percentage of time or of requests a service works. An SLA is a contract with consequences such as service credits, while an SLO is an internal target, usually stricter than the SLA.
How much downtime do 99.9, 99.95, 99.99 and 99.999 percent allow per year and per 30-day month, and why should the internal target be stricter than the SLA?The monthly availability dashboard for an API shows 99.98 percent, well above the 99.9 percent SLA. Yet support received hundreds of complaints, and a large customer claims the SLA was breached during a 90-minute problem in one region.
How can both be true, and how would you change how availability is measured?Product wants to promise 99.95 percent availability for checkout. Checkout calls six internal services synchronously, each running at about 99.9 percent, plus an external payment provider with a 99.9 percent SLA.
Can the promise be kept with this design, and what would you change to make it achievable?Sales wants to offer enterprise customers a 99.99 percent SLA with 25 percent service credits. The platform runs in one region on a managed database whose provider SLA is 99.95 percent, and it uses a third-party identity provider with a 99.9 percent SLA.
How do you respond, and what would it take to offer 99.99 percent honestly?A company runs 400 services and treats every one as critical: all page on-call at night, all are expected to be multi-zone, and teams argue about priority during incidents. Reliability spending keeps rising.
As the senior technical leader, how would you define service tiers with availability targets, and what would each tier require?Vertical and horizontal scaling
Vertical scaling buys a bigger machine; horizontal scaling adds machines and spreads work. Understand when scaling up is the sensible first step, why shared resources such as hot rows, locks and connection limits stop horizontal scaling and can even reduce throughput, and how to weigh the cost and complexity of partitioning against the evidence that a service will need it.
Vertical scaling makes one machine bigger (more CPU, memory, faster disks); horizontal scaling adds more machines and spreads work among them. A startup's single PostgreSQL VM runs at 85 percent CPU and the team debates both options.
Compare the two approaches, and explain when scaling up is the right first move for this database.An order service went from 8 to 16 pods and throughput rose 60 percent. Going to 32 pods made throughput fall below the 16-pod level, and the database showed many lock waits on a single row of a sequence-like counters table.
Why did adding pods reduce throughput, and how do you fix it?A pricing engine keeps 30 GB of state in memory on one large machine and recalculates prices on every event. It runs at 70 percent CPU, and traffic is forecast to double before a sales season in four weeks.
How would you decide between a bigger machine, partitioning the engine, and other options, and what is your plan for the four weeks?The architecture group proposes a standard: every new service must be horizontally partitioned, with sharded storage, from day one, because 'we will need it eventually'. Several teams object that their services will never exceed a few hundred requests per second.
As the senior technical leader, how do you decide on this standard?Stateless services and session state
A stateless service keeps nothing in memory that another instance would need, so any instance can serve any request and instances can come and go. Learn to spot state that breaks under multiple replicas, such as sessions, counters, schedulers and in-progress jobs, where each kind should live instead, and when a stateful design is justified and what it then requires.
A Spring Boot service is described as stateless, but its code contains: an in-memory per-user rate limiter, a Caffeine cache of product data, a @Scheduled(fixedRate = 60000) job that sends digest emails, and a ConcurrentHashMap<String, UploadState> tracking chunked uploads.
A Spring Boot web app with OAuth2 login was moved from one VM to four Kubernetes pods. About 70 percent of logins now fail on return from the identity provider, and logs show errors containing [authorization_request_not_found].
Explain the failure, and give the fixes from most to least preferable.A document-conversion service runs on 20 autoscaled pods. Each pod accepts jobs over HTTP and keeps job progress in memory while converting files for up to 10 minutes. After autoscaling was enabled, about 3 percent of jobs vanish and users wait forever.
Why are jobs lost, and how would you redesign the service so pods can come and go freely?Your platform standard says all services must be stateless. Teams building a multiplayer game server, a chat connection hub and an in-memory matching engine argue that the rule forces slow and costly designs on them.
As the senior technical leader, when would you allow stateful services, and what would the platform need to provide for them?Consistency trade-offs in design
Every copy of data, from replicas to caches and search indexes, can disagree with its source for a while. Understand how to choose per feature between strong and eventual consistency based on the harm a stale read causes, how to scale counters and similar hot data with approximate values, and how invariants spanning services are kept with sagas and reconciliation rather than distributed transactions.
Strong consistency means every read sees the latest committed write; eventual consistency means replicas converge after a delay, so a read may be briefly stale. Each feature of a product can choose differently.
For a marketplace, decide strong or eventual consistency for: like counts on listings, a wallet balance, reserving the last unit in checkout, a user's display name on old comments, and the stock count shown on a product page. Justify each.Sellers change prices in a catalogue database. Search results come from an index updated through change data capture with a typical lag of 40 seconds, while checkout reads the database. Customers complain that the cart shows a higher price than the search results.
Which reads need which consistency here, and how would you change the design and the user experience?A video platform shows view and like counts. During a live event a few videos receive 200,000 like and view increments per second, and a single database row per video cannot keep up. Advertisers are billed on views.
Design the counting so it scales, and explain where exact counts are required and how you get them.In your organisation, some teams use distributed transactions across five services for every order, causing latency and outages, while others use events with no reconciliation and finance finds mismatches every month.
As the senior technical leader, what guidance would you set for when to pay for strong consistency and how to keep invariants that span services?Single points of failure and redundancy
A single point of failure is any component whose loss stops the system, including hidden ones such as a configuration server needed at startup, a failover tool in the failed zone or one engineer who knows a system. Learn to find them, to add redundancy with spare capacity, and why redundancy only counts when it is monitored and regularly exercised.
A single point of failure is a component whose failure stops the whole system. A small e-commerce site runs one load balancer, two app servers, one PostgreSQL server, one Redis, a nightly cron job on one VM, and everything sits in one availability zone.
Identify the single points of failure and say how you would remove each, starting with the most important.At 02:10 a node upgrade restarted pods across a Kubernetes cluster. A payments API with three replicas spread across zones went completely down for 25 minutes: new pods crash-looped with errors fetching configuration from the single-instance config server, which had been on a drained node.
Explain how three replicas still failed together, and what you would change.The primary database of an order platform failed. Failover was meant to take a minute, but took four hours: the standby was six hours behind because replication had silently stopped, and the failover runbook required a bastion host in the failed zone.
What went wrong with the redundancy, and how would you make sure the standby really works the next time?An incident review finds the billing system's only expert is on leave, one shared library is maintained by one person, all deploys go through a single pipeline, and engineers log into consoles through one identity provider that was down during the incident.
As the senior technical leader, how do you find and reduce single points of failure in people, processes and tooling, not just servers?