Interview knowledge

Trade-off explorer

Interviewers look for trade-offs more than for the “right” answer. These are the comparisons from my notes, grouped by area. Filter by what the decision hinges on to drill a specific dimension.

Hinges on

Data stores

Comparison Growing

Immutable datamutable data

An image or a song would be immutable data.
The access pattern for those is a lot of reads, very few writes.
These would be best stored in a system where it's easy to read and stream and store in easily horizontally scalable blob storage systems like AWS S3.
Metadata like where the user stopped listening to the song gets written more often, or ability to search needs a different kind of database.

Comparison Growing

RedisMemcached

Memcached is supposedly a bit faster as it is multi threaded.
Redis has better support of more data types.
Redis has optional disk persistence.

Comparison Growing

PostgreSQLMySQL

MySQL is thread per connection, where PostgreSQL is process per connection.
MySQL is seemingly faster for lots of concurrent simple reads. PostgreSQL takes up more memory, but handles complex queries better with its planner in its own process.

PostgreSQL has many extensions, and good support for JSON for flexible document storage.

Apparently MySQL is slightly more permissive with its SQL syntax.

Comparison Growing

DocumentDBDynamoDB

Amazon DynamoDB and Amazon DocumentDB are both fully managed NoSQL databases on AWS, but they are built for entirely different data models and architectural needs.

  • Choose DynamoDB if you need predictable, single-digit millisecond latency at virtually limitless scale, have well-defined access patterns, and want a truly serverless database.
  • Choose DocumentDB if your data features complex, deeply nested JSON structures, you require powerful ad-hoc queries or aggregation pipelines, or you are migrating an existing MongoDB workload.
Comparison Growing

PostgreSQLDynamoDB

When I'd use DDB:

  • if key value access is enough
  • I need heavy write (more than 10k writes per second)
  • automatic and managed sharding

What you're giving up with postgres:

  • relations and joins: in ddb, you have to manage constraints yourself or duplicate documents
  • ad-hoc querying: harder to find specific data or debug without doing sequential scans
    • you lose ability to do aggregations like group by or avg
  • transactions
  • strong consistency
  • cost predictability (some ddb queries can be expensive as you pay per query)
When to use Established

When to reach for Database Sharding

When to use sharding
  • Write-heavy: Too much data for 1 instance (storage or write per second)
  • Read-heavy: when read replicas or caching are not enough

Trade offs

  • Global queries will be slower
  • Complexity to operate and keep data consistent
When to use Established

When to reach for AWS Aurora

When to use aurora
  • heavy reads making the need of more read replicas
  • heavy writes keeping it cost efficient
When not to use it
  • less than 100GB with predictable traffic
  • 1-2 minutes of downtime is ok
When to use Growing

When to reach for Cassandra Database

When to choose Cassandra
  • Write heavy
  • Zero downtime needed (in traditional master/slave, there is a small downtime if master is down for the failover to happen)
When not to

Messaging & events

Comparison Growing

KafkaSQS

Kafka wins when
  • You need persistence
  • Strict ordering at scale
  • Stream processing
SQS+SNS wins when
  • You're ok with the AWS structure and minimal operations
  • Retry + DLQ built-in
  • Ordering does not matter as much, high throughput does
  • Costs are fine as you pay per ack
When to use Established

When to reach for Message queues

When to use system queues
  • operations too long for a live server, get feedback to users quickly
  • reduce load on a live server
  • when you want the ability to scale differently for different tasks (ie retrievers need less memory than collectors in dogs)
  • reliability: keep messages to be processed in queue until workers are healthy again
When to use Growing

When to reach for Event Driven System

When to use them
  • Dealing with important events that needs to be stored forever (ie refund events)
  • When you need replayability of events (reprocess historical data)
  • Real-time data processing

APIs & communication

Comparison Growing

RESTGraphQL

When is GraphQL is a good idea?
When flexibility of what data to retrieve is important, but it is possibly rarely worth the overhead.

Comparison Growing

API shortlong timeouts

Set long timeouts intentionally, services should be fast, unless it is purposefully (can't do otherwise) slow.

Networking & edge

Comparison Growing

WebSocketsSSEAPI polling

WebSockets is 2 way open connection.
SSE (Server Sent Events) is one way.
API usually have a timeout of 30-60 seconds, configured by an outside system, often.

If the operation you're doing will take more than 5-10 seconds, it's best to make it async.
APIs can be done async if you poll, or you can keep an open connection

When is polling better? Why is it more simple? Doesn't need to keep the connection open? Which one has less load on server?

Consistency & scale

Comparison Growing

GenericConcrete software design

What worked for others in other scenarios might not work for you.

Concrete system design discussions are best done by the people involved in working in the system. It'll be more specific.

This is why the "architect" role is not that good, because their role is to create generic system design. Sean goes as far as:

architects can both claim credit for successes (after all, it was their design) and disclaim failures (if only those fools had followed my design!)

Generic system design is helpful for:

  • new systems
  • tie-breaking between decisions for existing systems
Comparison Growing

ConsistencyAvailability

Consistency = every read gets most recent write
Availability = the system responds even if it's not the most recent data

For example with Ticketmaster, consistency is way more important, but for rate limiters, availability is more important.
It could be different even within Ticketmaster, for example for search, availability is more important, but for booking, consistency is more important

Think of read vs write ratio. People search more than they buy tickets

Comparison Growing

Cron jobs to fix dataTTL

Depending on the data you need to fix, if it's simply releasing something, then a TTL on a row is better.

Comparison Growing

Saga choreographysaga orchestration

Either each service triggers the next one, or there is an orchestrator managing the whole thing.
Queen was an orchestrator whereas in PIMS, it was choreography style, retriever triggers transformer, etc.

Comparison Growing

Batch processingstream processing

In old existing product data, it was stream processing, processing one spider item at a time.
whereas in dogs, it was batch processing, processing 'big' sqlite files

Comparison Established

Forward proxyReverse proxyAPI Gateway

Forward proxy: next to the client before reaching internet
Reverse proxy: server side to go to the right server
API gateway: reverse proxy that does more than routing. it handles auth, rate limiting and other things before going to the right API

Pasted image 20260817115438.png

A forward proxy sits next to the client. Your laptop sends a request, the proxy forwards it out, and the destination never sees your real IP. Corporate networks use this to enforce policy, block sites, and cache traffic.

A Reverse proxy sits next to the server. The client has no idea how many machines are behind it. The proxy decides who handles the request, terminates TLS, and keeps your backend off the public internet. NGINX and HAProxy are commonly used here, typically paired with a Load Balancer in front.

An API gateway is a reverse proxy that does more than route traffic. It also handles auth, rate limits, API keys, versioning, and request shaping. Without it, each microservice has to implement its own version of validation, throttling logic, and request logging.

A forward proxy represents the client, a reverse proxy represents the server, and an API gateway is what you add when ten services need the same authentication and rate limiting rules applied consistently.

In most real systems, all three are running at different layers. The forward proxy filters outbound traffic, the reverse proxy fronts the application servers, and the API gateway sits in front of your APIs to enforce policies before requests reach them.

Comparison Established

Reverse proxyAPI gatewayload balancer

Reverse proxy
An API gateway is a specialized type of reverse proxy

The easiest way to differentiate them is by their core focus: a load balancer focuses on scale, a reverse proxy focuses on security and optimization, and an API gateway focuses on application logic and API management.

Direct Comparison

Feature Reverse Proxy Load Balancer API Gateway
Primary Goal Protects, caches, and isolates backend web servers. Distributes traffic to prevent server overload. Manages, secures, and routes individual API endpoints.
Traffic Focus General web traffic (HTTP/HTTPS, static files). Network layers (TCP/UDP) or application layers (HTTP). Application APIs (REST, GraphQL, gRPC).
Typical Tools NGINX, Apache, HAProxy AWS ALB, F5 BIG-IP, HAProxy Kong, Apigee, AWS API Gateway

  1. Reverse Proxy (The Shield & Booster)

A reverse proxy sits in front of a web server to shield its identity, optimize performance, and handle incoming requests. It acts as an intermediary so clients never talk directly to your actual application servers.

  • Main Job: Privacy, security, and offloading repetitive tasks.
  • Key Capabilities:
    • SSL/TLS Termination: It handles the heavy encryption/decryption work so backend servers don't have to.
    • Caching: It stores copies of popular static content (like images or CSS) and serves them instantly without hitting your backend.
    • Anonymity: It hides the IP addresses and structures of your internal infrastructure from the public internet.
  1. API Gateway (The Smart Concierge)

An API gateway is a specialized type of reverse proxy designed specifically for modern microservices architectures. It doesn't just pass requests along; it inspects, translates, and manipulates them based on application rules.

  • Main Job: Orchestrating API requests and enforcing business logic at the edge.
  • Key Capabilities:
    • Request Routing / Composition: It can take a single request from a mobile app, fetch data from three separate backend microservices (e.g., Users, Inventory, and Shipping), combine the data, and send back one clean response.
    • Authentication & Authorization: It checks if a user's API token is valid before letting the request reach any microservices.
    • Rate Limiting & Throttling: It blocks users who try to spam or abuse specific endpoints (e.g., limiting a user to 60 requests per minute).
    • Protocol Translation: It can convert an incoming REST request into an internal gRPC request.

How They Work Together

In a large production environment, you will often see all three layered together to form a robust architecture:

  1. A Load Balancer sits at the very front to split incoming traffic across multiple instances.
  2. The traffic hits a Reverse Proxy to strip away SSL encryption and handle basic caching.
  3. The request is passed to the API Gateway, which authorizes the user's API token and routes them to the correct backend microservice.
Comparison Growing

StatelessSticky sessions

Sticky session means it'll only work if the user has time come back to a specific server.
Stateless means server needs to treat the request as if the user came in here for the very first time

Engineering practice

Comparison Seedling

Expectations of juniorsenior people

juniors execute, seniors question.

Comparison Growing

Single agentmulti agent

Frontier models are good by themselves (ie Claude Code)
Single agent (could) need more human in the loop to review, where multi agent could review itself.

Counterpoints

How AI changes the software engineer roleHow AI does not change in the software engineer role

How AI changes the software engineer role

Good foundation is still key. AI is a signal amplifier, not just a tool. It will amplify the good and the bad. System design is still very important (some say that hyper-generalists will survive if they have this skill) The bottleneck of writing code is now gone. This allows shipping faster, perhaps at the cost of learning and developing judgement…

Read note →
How AI does not change in the software engineer role

We still think in black boxes and inputs/outputs like before. Collaboration is still key (in theory). We still think in processes rather than language syntax. Systems thinking. Refactoring. Engineering with ai is lot like regular engineering, refactoring with skills.

Read note →
Counterpoints

AI - Single agent vs multi agentAI Multi Agent

AI - Single agent vs multi agent

Frontier models are good by themselves (ie Claude Code) Single agent (could) need more human in the loop to review, where multi agent could review itself.

Read note →
AI Multi Agent

They have an architect, scout, coder, reviewer and verifier. https://github.com/jarod-rosenthal/workermill. They have a planner, a developer (frontend, backend, devops), a tech lead. The tech lead reviews the code. Up to 3 times. Related: Smart hybrid AI usage - Using frontier models for thinking and local models for executing.

Read note →