Present a Software System and Defend Its Architecture

Medium · Software Engineering Fundamentals · Software Engineer · Technical Screen

Prompt

Present an end-to-end backend service, internal engineering platform, or substantial technical project where you personally owned core design and implementation work. Organize your walkthrough around five areas:

  1. Problem Space & Individual Scope: Explain the user or operational pain point the system addressed, who depended on it, and the exact boundary between what you personally designed and coded versus what teammates or partner teams owned.
  2. Architecture & Core Mechanics: Trace the end-to-end request or event lifecycle, primary storage schemas or state models, wire protocols, and the engineering rationale behind your stack choices.
  3. Workload & Reliability Figures: Ground the system in concrete operational metrics (such as average and peak throughput, daily storage growth, p50/p99 latencies, worker concurrency budgets, or service-level targets).
  4. Engineering Hurdles & Trade-offs: Walk through at least one major production bottleneck, failure mode, or design dilemma you solved. Compare the competing approaches you ruled out and be explicit about the downsides your chosen design accepted (for instance, trading strict delivery order for multi-tenant isolation, or accepting extra moving parts to guarantee durability).
  5. Live Architectural Evolution: Show how you would extend the existing system to support a significant new product capability—such as low-latency event streaming, cross-region failover, or fine-grained per-tenant data scoping and field redaction—covering zero-downtime schema changes, backward-compatible APIs, and safe rollout.

Scope & Expectations

  • Clear individual ownership: Separate the components, schemas, and runbooks you personally built from shared platform services, while understanding end-to-end production behavior and failure modes.
  • Constraint-driven pragmatism: Justify databases, queues, and protocols through concrete latency, consistency, and team-operations constraints rather than buzzwords.
  • Cohesive numbers & poise under pushback: Share throughput, latency, and sizing figures that fit together mathematically, and engage calmly when probed on rejected alternatives.
  • Evolutionary architecture: Adapt existing schemas, API contracts, and security boundaries incrementally without resorting to disruptive full-system rewrites.

Step-by-step walkthrough

  1. What this interview tests—and how to choose the right project

    A project-defense interview tests four habits in a single conversation: 1. End-to-end ownership: Do you know how code ships, where state is stored, and what happens when dependencies crash—not just the function you edited? 2. Constraint-driven pragmatism: Did you pick tools to solve concrete product and operational limits rather than chasing hype? 3. Connected numbers: Do your request rates, latencies, worker counts, and disk sizes fit together mathematically? 4. Evolutionary design: When requirements change live, can you extend the system cleanly without throwing it away?

    Pick a project using four filters: - You built a core path (the storage schema, background worker, API layer, or core algorithm) and can draw the deployment and failure recovery flow on a whiteboard. - It had at least one genuine trade-off where a smart engineer could reasonably argue for the option you rejected. - You can state or derive the numbers (requests per second, database growth, tail latency, error rate), honestly labeling which figures were measured on dashboards and which are back-of-the-envelope estimates. - It has room to grow when the interviewer asks you to bolt on multi-tenancy, streaming, or tighter latency.

    Budget 10–12 minutes across five beats—Problem Space & Individual Scope (2 min), Architecture & Core Mechanics (3 min), Workload & Reliability Figures (2 min), Engineering Hurdles & Trade-offs (3 min), and Live Architectural Evolution (2 min)—pausing briefly after the architecture diagram so the interviewer can steer.

    Below is a complete model walkthrough of a realistic B2B production service—an outbound webhook delivery engine (for events such as survey.completed or employee.updated). Study how each piece connects, then swap in your own project's facts and numbers.

  2. State context and separate "I" from "we"

    Open with the user pain, who depended on the system, and the exact boundary between your work and your teammates' work. Never hide behind "we" for everything, and never claim credit for shared infrastructure you did not build.

    Model opening: "Our B2B platform notified customer systems of events like survey.completed and user.updated by sending HTTP webhooks synchronously inside web request handlers. That created two production headaches. First, API latency suffered: p99 latency (the 99th percentile, meaning the slowest 1% of requests) hit 900 ms because our web servers sat waiting on slow customer endpoints. Second, if a customer server was down for five minutes, the webhook was dropped forever—generating roughly 30 customer support tickets per month.

    A three-person group replaced this with an asynchronous webhook service serving 1,200 enterprise customer tenants. My direct ownership was designing and coding the two core backend components: the HTTP dispatcher (including per-endpoint concurrency isolation and cryptographic signing) and the Postgres retry scheduler (including deduplication and dead-letter replay), plus authoring our on-call runbook and alerts. A frontend teammate built the customer webhook settings UI, and our platform team operated the shared Kafka cluster."

  3. Walk through the architecture, data model, and guarantees

    Trace a single event from creation to customer receipt so a newcomer can picture every hop:

      Product API ──(single DB transaction: business row + outbox row)──► Postgres Primary
                                                                                 │
                                              Outbox Relay (polls unsent rows, publishes, marks relayed)
                                                                                 ▼
                                              Kafka topic "webhook_events" (24 partitions, key = tenant_id)
                                                                                 │
                                                                                 ▼
                              Dispatcher Fleet (12 Go pods x 100 HTTP worker slots = 1,200 total slots)
                                1. Read tenant subscriptions (60 s in-memory cache)
                                2. Enqueue per endpoint (cap: max 20 concurrent calls per URL, circuit breaker)
                                3. HTTPS POST JSON + HMAC-SHA256 signature (10 s timeout)
                                   │                                             │
                                   │ 2xx response: mark succeeded                │ timeout / 429 / 5xx: backoff retry
                                   ▼                                             ▼
                        deliveries table (daily partitions)         Retry Scheduler (SELECT ... FOR UPDATE SKIP LOCKED
                                                                    on next_attempt_at; 8 retries over ~23 h -> dead letter)
    

    Core database tables (Postgres):

    outbox_events (event_id UUID PK, tenant_id, event_type, payload JSONB, relayed_at, created_at)
    subscriptions (id UUID PK, tenant_id, target_url, signing_secret, event_types TEXT[], is_active)
    deliveries    (id BIGSERIAL, event_id UUID, subscription_id UUID, status, attempt_count,
                   next_attempt_at, last_http_code, updated_at,
                   UNIQUE (event_id, subscription_id))   -- range-partitioned by day
    

    Protocols, guarantees, and why each tool earned its place:

    • Transactional outbox pattern (writing the business change and an outbox_events row inside one atomic database transaction): eliminates the dual-write bug, where an app writes to Postgres and crashes milliseconds before publishing to Kafka—silently losing the event. Because our product data already lived in Postgres, storing the outbox table in the same Postgres database gave us atomic commits with zero new infrastructure.
    • Kafka (distributed append-only event log, 24 partitions keyed by tenant_id): already run by our platform team, buffers spikes if downstream workers slow down, and lets us replay events after a bug.
    • At-least-once delivery + idempotency key: Over the public internet, exactly-once delivery is impossible for the sender alone—if a customer server processes our POST but the network drops their 200 OK reply, we must retry. Instead, we guarantee at-least-once delivery (every event arrives one or more times) and include a unique X-Event-Id header (idempotency key, a unique token receivers store so duplicate retries become safe no-ops) plus a timestamped HMAC signature (a cryptographic hash proving the payload came from us and was not replayed hours later):
    import hashlib
    import hmac
    
    
    def build_webhook_signature(secret: bytes, unix_timestamp: str, raw_body: bytes) -> str:
        """Compute v1 HMAC-SHA256 over '<timestamp>.<body>' so receivers can verify authenticity and freshness."""
        # Binding the timestamp to the body prevents an attacker from replaying a captured request hours later.
        signed_payload = unix_timestamp.encode("utf-8") + b"." + raw_body
        digest = hmac.new(secret, signed_payload, hashlib.sha256).hexdigest()
        return f"t={unix_timestamp},v1={digest}"
    
    • Deployment and crash recovery: Merging to main runs unit and integration tests, builds a container image, and rolls out one canary pod watching delivery failure rates before updating the remaining 11 pods. On SIGTERM shutdown, a pod stops fetching new Kafka batches, drains in-flight HTTP calls for up to 10 seconds, and commits Kafka offsets only after recording each attempt in deliveries.
  4. Share connected scale and performance numbers

    Interviewers spot memorized buzzwords quickly, so present numbers that multiply cleanly into one another using Little's law (concurrent in-flight items = arrival rate × average response time):

    Daily event volume     40M events/day ÷ 86,400 s/day ≈ 463 events/s average; ~1,390 events/s at 3x Monday peak
    Fan-out deliveries     1.5 active subscriptions/event -> 60M deliveries/day ≈ 694/s avg; ~2,080/s at 3x peak
    In-flight HTTP calls   Little's law at peak: 2,080 deliveries/s × 0.30 s mean customer latency ≈ 624 concurrent calls
    Worker capacity        12 Go pods × 100 HTTP worker slots/pod = 1,200 slots (~1.9x headroom over 624 peak calls)
    Postgres storage       60M rows/day × ~300 bytes/row ≈ 18 GB/day -> ~540 GB across 30 days (+ indexes)
                           Partitioned by day so expiring Day 31 is an instant DROP TABLE partition, not a 60M-row DELETE
    Kafka retention        40M events/day × 2 KB ≈ 80 GB/day × 7 days × 3 replicas ≈ 1.7 TB across brokers
    

    Production latencies, SLO, and business impact: - End-to-end delivery latency (database commit to first HTTP POST): p50 (median) 180 ms, p99 1.2 s; 97% succeed on the first try. - SLO (Service Level Objective—our internal reliability target): 99.9% of events targeting healthy customer endpoints attempted within 5 seconds. - Measured outcomes: Product API p99 dropped from ~900 ms to ~250 ms, and missing-webhook support tickets fell from ~30/month to ~1/month.

  5. Detail a real technical hurdle and defend the trade-offs

    Structure your toughest engineering challenge as Symptom → Root Cause → Rejected Options → Chosen Fix → Cost Accepted.

    • Symptom: Two months into production, one large customer suffered a firewall outage where their webhook URL accepted TCP connections and hung silently until our 10 s timeout. Within minutes, webhook latency spiked from under a second to over 8 minutes for unrelated customers.
    • Root cause: That single tenant generated 50 deliveries/s. First, because tenant_id hashed to one Kafka partition owned by a single dispatcher pod, 50 calls/s × 10 s = 500 slot-seconds of demand per second immediately saturated all 100 HTTP slots on that pod—stalling every other tenant sharing that pod's partitions (head-of-line blocking, where one stuck item at the front of a queue freezes everything behind it). Second, as those timed-out attempts spilled into the shared Postgres retry table, all 12 pods picked them up via FOR UPDATE SKIP LOCKED (a SQL lock clause letting multiple workers grab different unlocked rows without waiting on each other), consuming hundreds more slots across the entire 1,200-slot fleet.
    • Options we weighed and rejected:
      1. One Kafka partition per tenant: Rejected—managing 1,200+ partitions (and rebalancing them as tenants sign up) adds heavy broker overhead when 95% of tenants send under 1 event/minute.
      2. Cut HTTP timeout from 10 s to 1 s: Rejected—some legitimate enterprise ERP endpoints take 2–3 seconds under load, so a 1-second cutoff would break healthy customers without actually isolating tenants.
    • Chosen fix (decouple consumption + per-endpoint isolation): Dispatchers persist incoming events and place them into bounded per-endpoint queues capped at 20 concurrent in-flight requests per URL, guarded by a circuit breaker (an automatic safety switch that trips open when an endpoint fails > 50% of calls over 60 seconds, routing new events straight to scheduled backoff retries instead of tying up live HTTP sockets). Even during a 10-second hang, one broken URL can pin at most 20 of our 1,200 fleet slots (1.7%).
    • Trade-off we consciously accepted: Parallel slots and out-of-band retries mean a tenant's webhooks are no longer strictly ordered. We chose multi-tenant availability over strict ordering, documented that trade-off clearly, and embedded created_at plus a monotonic tenant_seq integer in every payload so customers who care about order can sort or ignore stale updates.
  6. Defend choices calmly under "Why not X?" pushback

    Expect sharp interruptions testing whether you understand alternatives:

    • "Why Postgres instead of a NoSQL document store like MongoDB or DynamoDB?" The decisive constraint was the transactional outbox: our core application already stored surveys and users in Postgres, and atomic outbox commits require writing the business row and the event row in the same database engine. Postgres also gave us JSONB for flexible payloads and SELECT ... FOR UPDATE SKIP LOCKED for lock-free worker polling. If our core app had already been on DynamoDB, DynamoDB Streams would have been the natural outbox equivalent—and our choice's downside is that a single Postgres primary eventually caps write throughput at 20× scale.
    • "How do customers avoid double-processing duplicate webhooks?" Because network drops make at-least-once the honest guarantee, we send X-Event-Id and give customers a 5-line reference snippet showing how to record event_id inside the same database transaction as their side effect:
    def process_incoming_webhook(event_id: str, payload: dict, seen_event_ids: set) -> str:
        """Idempotent receiver pattern: skip any event_id that has already been processed."""
        if event_id in seen_event_ids:
            return "duplicate_ignored"
        # In production, insert event_id into a unique DB column inside the same transaction as business updates.
        seen_event_ids.add(event_id)
        return f"processed:{payload.get('type', 'unknown')}"
    
    • "Why run Kafka AND Postgres retries instead of a managed queue like AWS SQS?" Totally fair critique—if we were starting greenfield without a platform Kafka team, Postgres outbox → SQS (with visibility timeouts and a built-in dead-letter queue) would have saved operational work. We used Kafka because our platform team already supported it and multi-consumer log replay saved us twice when backfilling analytics.
  7. Extend the design live: granular multi-tenant field redaction & scoping

    Suppose the interviewer asks: "Enterprise security admins now want each webhook subscription scoped to specific departments (e.g., Engineering only) and want PII fields like employee_email stripped before payloads leave our network. How do you evolve the system with zero downtime?"

    Walk through Schema → API Compatibility → Enforcement Choke Point → Safe Rollout:

    1. Zero-downtime schema migration (expand → migrate → contract): Never lock a live table with a blocking rewrite. Roll the schema forward in three safe steps:

    Phase 1 (Expand):   ALTER TABLE subscriptions ADD COLUMN access_scope JSONB NULL;
                        CREATE TABLE subscription_scope_audit (id, subscription_id, actor_id, old_scope, new_scope, changed_at);
    Phase 2 (Migrate):  Background batch job backfills 10,000 rows at a time:
                        access_scope = '{"org_units": "*", "redact_fields": []}'  (matches current behavior)
    Phase 3 (Contract): Once 100% of rows are populated and all pods read access_scope, add NOT NULL constraint.
    

    2. Backward-compatible API & payload contract: - Keep POST /v1/subscriptions additive: existing API integrations that omit access_scope continue working during a communicated deprecation window before new subscriptions default to redacting PII. - In outbound webhooks, delete redacted keys from the JSON object (rather than setting "employee_email": null, which breaks typed parsers expecting strings) and add header X-Redacted-Fields: employee_email plus "schema_version": 2 so receivers know why a field is absent.

    3. Single enforcement choke point & cache invalidation: - Filter by org_unit and strip redact_fields inside the dispatcher immediately before computing the HMAC signature. Putting enforcement there guarantees that retries and manual dead-letter replays also obey the tenant's latest security rules—not stale rules from yesterday. - Because subscriptions were cached in pod memory for 60 seconds, revoking email access could previously leak PII for up to a minute. Fix that by publishing a lightweight subscription.updated cache-invalidation event so all 12 pods evict stale rules within milliseconds.

    4. Feature-flagged shadow rollout: - Ship behind a per-tenant feature flag in shadow mode first (run the filter, log summary counts of which events/fields would be redacted without altering live traffic), verify with two pilot customers, and then enforce.

Intuition & how it works

Think of defending a software project like giving a structural engineer a tour of a bridge you built—and then being asked on the spot whether it can carry a freight train. Listing the brands of steel and paint you bought ("we used Kafka, Go, and Postgres") tells the inspector almost nothing. What builds trust is showing why each beam is sized the way it is, where the bridge flexed during a real storm, and which pillar would crack first under 20× the load.

Two naive habits sink candidates in this round. First, giving a high-level feature tour full of "we built..." leaves the interviewer guessing what you actually coded and what happens when a database or network call fails. Second, defending choices as flawless ("we picked Kafka because it scales infinitely and has no downsides") signals shallow production experience—every real engineering decision trades away one property (like strict event ordering or extra moving parts) to protect a more important one (like multi-tenant isolation or zero lost events).

Walk through how our model project—an asynchronous outbound webhook service—ties problem, math, trade-offs, and evolution into one tight story: - Concrete problem & role: Synchronous customer webhooks pushed API p99 latency (the slowest 1% of requests) to 900 ms and dropped events during customer outages (~30 tickets/month); you personally built the Go HTTP dispatcher and Postgres retry scheduler. - Connected scale math: 40M events/day × 1.5 subscriptions = 60M deliveries/day (~694/s average, ~2,080/s at 3× peak). By Little's law (concurrent requests = arrival rate × mean duration), 2,080/s × 0.30 s = 624 in-flight HTTP calls at peak, comfortably served by 12 pods × 100 slots = 1,200 worker slots (~1.9× headroom). - Defensible trade-off: When one customer's hung firewall (50 calls/s × 10 s timeout) saturated its Kafka pod and spilled across retry workers, you added per-endpoint concurrency caps (20 slots) and a circuit breaker (an automatic switch pausing calls to failing URLs)—explicitly trading away strict per-tenant delivery order to guarantee multi-tenant uptime.

Key points

  • Pick a system where you own the internals: Choose a project where you wrote a core component, know the deployment pipeline and failure modes cold, and faced at least one non-trivial architectural trade-off.
  • Separate "I" from "we" upfront: State the team context in two sentences, then name the exact modules, schemas, and runbooks you personally authored.
  • Trace one request end to end and tie tools to constraints: Draw the data flow (for example, transactional outbox in Postgres → Kafka → Go dispatchers → FOR UPDATE SKIP LOCKED retry queue), and explain why each piece exists (the outbox shares the product's Postgres transaction so an event is never lost between two separate writes).
  • State honest delivery contracts: Over HTTP to external servers, network drops make at-least-once delivery (sending an event one or more times) paired with an idempotency key (X-Event-Id for receiver deduplication) and timestamped HMAC signatures the right engineering contract.
  • Make your numbers multiply cleanly: Connect daily volume (60M/day) → peak QPS (2,080/s) → concurrent sockets via Little's law (624 in flight) → pod count (1,200 slots) → daily table growth (60M × 300 B ≈ 18 GB/day across daily partitions).
  • Extend incrementally without downtime: Use expand → migrate → contract database migrations (add nullable column, backfill in batches, enforce constraints last), additive API fields, single-choke-point security enforcement, cache invalidation, and shadow-mode feature flags.

Common mistakes

  • Picking a surface-level project: Presenting a thin wrapper where you cannot answer "how are retries persisted?" or "what happens if the queue broker restarts mid-request?".
  • Saying "we" for everything (or taking credit for everything): Leaving your personal technical depth unclear, or claiming sole ownership of shared platform infrastructure.
  • Resume-driven architecture: Naming tools ("microservices, Kafka, Kubernetes") without stating the latency, consistency, or team-operations constraint that justified them.
  • Disconnected or impossible numbers: Claiming 50,000 QPS on a single tiny instance where each call blocks for 500 ms (50,000 × 0.5 = 25,000 concurrent blocked calls!), or sharing zero metrics at all.
  • Claiming "zero trade-offs" or "exactly-once HTTP webhooks": Pretending distributed network calls never drop responses, or getting defensive instead of saying "That's a solid alternative—here is the specific constraint that steered us away, and when I'd switch."
  • Proposing a big-bang rewrite for the feature extension: Breaking existing API clients or locking a 500 GB table with a synchronous ALTER TABLE ... NOT NULL instead of evolving backward-compatibly.

Follow-up questions

  • Suppose traffic or event volume jumped 20x overnight—which component in your architecture would saturate first, and how would you re-architect around it? At 20× scale, peak deliveries jump from 2,080/s to 41,600/s and outbox writes jump from 1,390/s to 27,800/s; the stateless Go dispatchers scale horizontally (41,600 × 0.30 s ≈ 12,480 in-flight calls, or ~240 pods with headroom), so the single Postgres primary hits the wall first under tens of thousands of row inserts/updates per second, WAL (write-ahead log, the disk journal recording every database mutation) I/O saturation, and 360 GB/day of delivery rows. I would mitigate this cheapest-first: stop writing Postgres deliveries rows on first-try successes (97% of traffic) by streaming delivery logs to Kafka/object storage and persisting only failed retries (3%) to Postgres, switch outbox polling to CDC (change-data capture, streaming rows directly from the Postgres replication log), batch writes, and shard by tenant_id only once single-node optimizations run out. I would also expand Kafka partitions ahead of time (noting that changing partition counts temporarily re-hashes tenant keys) and enforce strict per-endpoint rate limits so our 20× surge does not DDoS small customer servers.
  • What metrics, distributed tracing, and paging alerts did you instrument for this system, and what runbook steps did you follow during a live incident? We instrumented RED metrics (request Rate, Error ratio, and Duration percentiles) tagged by tenant and status code, Kafka consumer lag, retry queue depth, and our core user-facing health indicator: age of the oldest undelivered event targeting a healthy endpoint, paired with distributed traces and structured JSON logs keyed by event_id. Alerts fired on multi-window SLO burn rates (paging only when error budget is burning fast enough to threaten our 99.9% target, never on isolated customer 500s) so on-call engineers were not drowned in false alarms. During an incident, our runbook followed mitigate first, diagnose second: acknowledge the page, check tenant-scoped dashboards to see if the blast radius is one broken customer or system-wide, immediately stop the bleeding (roll back a bad deploy, trip a tenant circuit breaker, or scale pods), post stakeholder updates, safely replay missed events using event_id deduplication once healthy, and close with a blameless postmortem tracking concrete action items.
  • Suppose product asked for under-10-millisecond responses on a workflow that currently runs asynchronously—what design changes would that require? First, clarify which boundary must finish under 10 ms: if only our API ingestion acknowledgment needs < 10 ms, we keep delivery asynchronous, trim synchronous cross-service RPCs from the request handler, commit to a same-zone primary (or append to a fast local log) in 2–4 ms, and return 202 Accepted. If an end-to-end synchronous response must return in < 10 ms, physics rules out calling arbitrary third-party servers across the public internet—light in fiber travels roughly 200 km/ms, so a customer server 1,000 km away (2,000 km round trip) burns the entire 10 ms budget on speed-of-light travel alone! For internal workflows where we control both ends, we would co-locate services in the same availability zone, maintain warm connection pools over binary gRPC, serve precomputed state from in-memory caches (process memory or local Redis) rather than disk queries, enforce a strict per-hop latency budget (1 ms network + 2 ms memory lookup + 2 ms CPU + 5 ms tail-latency headroom), and load-test p99 against garbage-collection pauses.

Follow-up questions

Similar questions

More Perceptyx interview questions

All 1 Perceptyx questions →