Reviewing for Performance, Scalability & Reliability

The code is correct. Now: what does it cost per event, and what breaks when traffic doubles?

For an engineer coming from high-throughput ad-events infrastructure, this is home turf and the interviewer knows it. The question is whether you can spot the performance and reliability footguns that don't show up in a functional test — the ones that pass in review, pass in staging at 1x load, and then take down a service at peak. A correct algorithm with an accidental N+1, an allocation in a per-event loop, an unbounded cache, or a missing timeout is a latent incident. Your job as a reviewer is to read a diff for its behavior at scale and under failure, not just its behavior on the happy path with one request.

Flow of reviewing for performance: hot paths, N+1 and loops, unbounded growth, blocking I/O, big-O regressions, backpressure, caching, pipeline cost
Read the diff at scale: find the hot path, then check for N+1s, per-iteration allocations, unbounded memory/cardinality, blocking I/O, big-O regressions, missing backpressure, caching, and data-pipeline cost.

What this question is really testing

Whether you carry a cost model in your head while you read code. Anyone can say “check for performance.” The signal is specificity: you locate the hot path first (what executes per request or per event), then you know the concrete anti-patterns to look for and why each one bites at scale. It also tests whether you treat reliability as part of performance — timeouts, retries, backpressure, and pool sizing are what keep a fast system from becoming a cascading-failure amplifier.

How to answer What the interviewer is looking for

A concrete before/after that captures the most common catch — an N+1 plus an allocation inside a per-event loop:

# WRONG: one RPC per event, new client + list built inside the hot loop
def enrich(events):
    out = []
    for e in events:                      # runs per event, millions/sec
        client = DimClient()              # new connection every iteration
        dim = client.lookup(e.campaign_id) # N+1: one round trip each
        out.append(merge(e, dim))
    return out

# RIGHT: batch the lookup, reuse the pooled client, size the result
def enrich(events, client):               # pooled client injected
    ids = {e.campaign_id for e in events}
    dims = client.batch_lookup(ids)       # one round trip, bounded fan-out
    return [merge(e, dims[e.campaign_id]) for e in events]

Common follow-ups

You suspect a perf problem but there's no benchmark. What do you do?

How to answer

How do you review retry logic?

How to answer

What performance issues are specific to data pipelines?

How to answer

How do you avoid over-optimizing in review?

How to answer
Where to get your data (Meta)