A practical way to defend your architecture, using one small AI report service.
An interviewer points at Redis and asks what happens if you remove it.
You know Redis is fast. You know Kafka handles events. You know PostgreSQL stores data. Somehow, none of that explains why this particular application needs all three.
Honestly, this is where system design preparation can get a little sneaky. Studying more diagrams starts to feel like progress, even when the hardest part is still choosing what to leave out.
I prefer a smaller challenge. Pick one application, give it a few real constraints, and make every new component solve a problem you can name.
We’ll use an AI report generator because it has familiar ingredients without requiring a giant architecture. Users submit documents, a worker generates a report, and the app shows when it is ready. The AI step makes the job slow; it doesn’t automatically make the rest of the system exotic.
By the end, you’ll have a way to explain when a database is enough, when a cache helps, and when an event log becomes worth its operational cost.
Start with the promise you are making
For this practice example, assume 100 report requests per minute, an average processing time of 20 seconds, and a progress screen that can be five seconds behind. Reports are private. Once a request is accepted, a worker crash must not make it disappear.
Those are invented interview assumptions, so change them when the interviewer gives you something different.
Already, the numbers tell us something useful. At a steady arrival rate of roughly 1.67 jobs per second, with 20 seconds of active processing per job, we need about 33 jobs in progress on average just to keep up. That’s concurrency, not 33 physical servers, and it leaves no headroom for bursts or slower jobs.
Adding Redis doesn’t shorten a model call. Adding Kafka doesn’t increase the model provider’s quota. Before drawing either, check which resource actually limits throughput.
For a first design, an API can record a job in PostgreSQL and return its ID after the transaction commits. A separate worker claims pending work, generates the report, and records the result. Large documents and report files can live in object storage, with their locations recorded in the database.
The useful question is whether accepted work survives a failure, not whether the picture looks sufficiently distributed.
Give the database version a fair chance
A jobs table needs more than a status column. Record the job’s owner, input version, attempt count, and the time until which a worker owns its claim. Commit the claim in a short transaction, then do the expensive work outside that transaction.
If a worker disappears, its claim can expire so another worker can retry. A claim token or version prevents an old worker from overwriting a newer attempt’s result. It doesn’t undo an external action the old worker already performed, so those effects need their own duplicate protection.
PostgreSQL’s SKIP LOCKED documentation describes avoiding contention among consumers of a queue-like table. That is a useful building block, not a complete job system. You still own retries, recovery, cleanup, fairness, and monitoring.
This design has limits. Polling and frequent updates can contend with other database work. A managed queue may be preferable because the team already operates one, needs better workload isolation, or doesn’t want to maintain those mechanics.
But 100 requests per minute alone does not prove that a separate broker is required. Measure the actual workload and explain the operational trade-off.
For a different setting, try this Google tagged daily query report design question. Before drawing a streaming pipeline, decide whether the reader needs a result once a day or an answer that changes continuously. Write down how that single requirement changes your architecture. The company tag comes from the reported question, not an official interview specification.
Redis earns its place when repeated reads become a problem
Now imagine the progress screen gets popular. Thousands of users keep checking the same small set of jobs, and measurements show those reads are hurting database latency.
A cache becomes a reasonable candidate because we have both a repeated workload and permission to return slightly stale information.
Suppose the screen receives 1,000 requests per second. With a 95% cache hit rate, about 50 requests per second still need the underlying read. That is a planning estimate, not a performance promise. If keys expire together or every request asks for a different job, the database can see a very different load.
Start by checking the query, index, and polling frequency. If those are already sensible, Redis can store a short-lived progress view while PostgreSQL remains authoritative.
Then separate two questions that often get bundled together.
- A progress bar can show the previous processing state for a few seconds if the product accepts that delay.
- A download permission check cannot rely on that same allowance if access revocation must take effect immediately.
For the progress view, a short TTL and invalidation on update can be a starting design. Neither magically eliminates races. An older read can finish after an update and repopulate stale data, so strict freshness needs stronger coordination or a different read path.
Also explain the miss path. If Redis becomes unavailable, letting every request hit PostgreSQL can turn one outage into two. Back off polling, coalesce repeated loads, or shed nonessential progress requests so the fallback stays within capacity.
Now Redis has a defensible job. It reduces repeated read work under an explicit freshness contract. It is not an architectural good-luck charm.
Kafka earns its place when consumers need their own history
Next, change the product rather than simply multiplying the traffic number.
Completed reports now feed search indexing, analytics, and notifications. Each team deploys independently. Analytics needs to rebuild its derived results after a bug, without generating all the reports again.
That is a stronger reason to consider an event log. We want independent consumers and retained events they can read again.
Kafka’s introduction explains that consuming an event does not delete it. Retention determines how long it remains available, and ordering is guaranteed within a partition rather than across an entire topic.
Separate consumer groups can maintain independent progress. Choose a partition key that matches the ordering you need, such as a job ID, and decide how much history to retain.
Kafka is one option for those requirements, not the only possible implementation. A small system might manage with an event table or another managed service. The point is to justify replay and independent consumption before choosing the product.
There’s still an awkward gap between marking a job complete in PostgreSQL and publishing its event.
If the database commit succeeds but publication fails, downstream consumers may never hear about it. One approach is to write the completion and an outbox record in the same database transaction, then let a relay publish committed outbox records.
A relay can publish twice if it crashes before recording its progress. Consumers therefore need duplicate handling, and an email provider doesn’t become exactly-once merely because Kafka appears upstream.
This is the part worth discussing in an interview. A new component solves one problem and creates responsibilities you must be able to explain.
Practice by changing one requirement at a time
Keep the original diagram on one page. Beside it, write the reason for each component and the condition that would make you reconsider it.
For PostgreSQL, that might be durable job state with transactional updates. For Redis, it might be measured repeated-read pressure plus acceptable staleness. For Kafka, it might be independently consumed events with a defined replay window.
Then give yourself three changes, separately.
First, progress updates must be immediate. Revisit caching and delivery semantics. A shorter TTL alone doesn’t establish immediate freshness.
Next, report creation jumps tenfold. Estimate required processing concurrency and check provider quotas, queue wait time, and database contention before adding infrastructure by habit.
Finally, analytics must recompute last week’s results. Check whether the retained events contain the inputs needed for that computation. Replay cannot recover data you never recorded, and rerunning an AI model is not the same as replaying a stored completion event.
Give yourself twenty minutes for that exercise. Spend the first five agreeing on requirements, the next five sketching a baseline, and the remaining ten changing one assumption and defending the resulting edits.
A useful answer names the requirement, the evidence, the extra failure mode, and the trigger for revisiting the decision. You can use those four prompts even when the technology is completely unfamiliar.
I like this kind of practice because it gives you somewhere to go when an interviewer pushes back. You don’t have to defend a memorized picture. You can return to the requirement and reason forward with them.
Before saving another architecture diagram, try removing one box and explaining what breaks. If nothing meaningful changes, you may have found the most useful part of your next practice session.
~ Emily





Top comments (0)