Everything in Backend Dev, page 3
Limits of BackgroundTasks vs Celery or ARQ
BackgroundTasks run in the same worker with no persistence, retries, or visibility, and die with the process; Celery or ARQ add durability, retries, scheduling, and separate workers.
Diagnosing a slow FastAPI endpoint under load
Add timing and tracing to isolate the slow span, watch CPU vs wait time and event-loop lag, then use profilers like py-spy or cProfile and DB EXPLAIN.
WebSocket connection manager and broadcast
A manager class holding a list of active connections, connect accepts and appends, disconnect removes, broadcast iterates sending to each, all wrapped in try/finally to handle disconnects.
BackgroundTasks dependency vs response.background
The injected BackgroundTasks parameter lets endpoints and dependencies stack tasks and is the common path; response.background attaches a single Starlette task when you return a Response object…
Propagating a correlation ID without parameter passing
Middleware reads or generates the header, stores it in a contextvars.ContextVar, service code reads it anywhere, and logging filters inject it.
Revoking stateless JWTs on logout
A server-side denylist of revoked token IDs checked per request, or short-lived access tokens paired with revocable refresh tokens.
SQLAlchemy connection pooling across Uvicorn workers
Each worker has its own pool; total DB connections equal workers times (pool_size plus max_overflow); overflow connections are temporary; misconfiguration exhausts DB…
MongoDB async ODM vs SQLAlchemy sessions
Motor client as a connection pool with no SQLAlchemy-style session or transaction; Beanie document models over Motor; initialize once at startup and await find queries.
asyncio.gather vs asyncio.wait
Gather returns ordered results and propagates the first exception (or captures them); wait returns done/pending sets and never raises, you inspect each.
How FastAPI uses type hints for validation
Hints drive parsing, validation, and conversion; a path declared int is coerced or returns 422; OpenAPI is auto-generated.
Diagnosing intermittent crashes with PM2
PM2 auto-restarts and runs cluster mode for availability, inspect logs and metrics, watch memory for leaks, capture errors.
Unit testing Express auth middleware in isolation
Build fake req/res, use a spy/mock for next and res methods, assert next called on valid token and 401 sent on invalid.
JWT login and protected route flow in Express
Verify credentials, sign a JWT, client stores and sends it (Authorization header or httpOnly cookie), middleware verifies signature on protected routes.
Defining many-to-many relationships in Sequelize
Use belongsToMany through a join table, the through table holds the foreign keys, eager-load courses with include.
Nested routes versus query params for related resources
Nested routes express ownership and scope clearly, query params on the flat resource are flexible for filtering and combining.
Callback hell and how to refactor it
Deeply nested callbacks (pyramid of doom) hurt readability and error handling, refactor with promises or async/await.
Blocking versus non-blocking I/O in Node
Blocking calls halt the thread until done, non-blocking returns immediately and notifies via callback or promise, fs.readFileSync versus fs.readFile.
Managing user presence with reconnection grace periods
Rely on heartbeats, apply a grace period before marking offline, reconcile reconnects by user not socket id, use a shared store for multi-instance.
Pinpointing validation errors in nested request data
Use schema validation that reports a path, collect all errors not just the first, return a 400 with field paths and messages.
Purpose of an ORM like Sequelize
Maps rows to objects, gives a model-based API, handles associations, migrations, and parameterized queries across dialects.
We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.
See open roles