Web Framework Internals interview question · Most asked

What layers does a request pass through before reaching application code, and how should their timeouts relate?

Summary

Typically client → CDN or load balancer → reverse proxy or web server (nginx, Apache) → application server (PHP-FPM, Gunicorn/Uvicorn, Node.js, Tomcat) → framework pipeline → your code and its outbound calls. Inner timeouts should be shorter than outer ones, so the innermost layer gives up first, returns a meaningful error and stops the work.

Longer Answer

If an outer layer times out first, users see a generic 504 while inner layers keep working and logging success, and retries multiply the load. Propagate a request ID or W3C trace context through every layer to correlate logs.

Key Points

  • CDN/LB → web server → app server → framework → code.
  • Inner timeouts shorter than outer ones.
  • Outer-first timeouts waste work and confuse logs.
  • Propagate request IDs end to end.

Deep dive: Request Lifecycle: The Anatomy of a Request

Explanation

What interviewers look for

The layer chain and correct timeout ordering.

More most-asked Web Framework Internals questions

← All Web Framework Internals questions