IntermediateTECHNICAL
Given a RESTful API that is experiencing inconsistent response times, outline the technical steps you would take to identify whether the issue is in the database, application server, or frontend, and specify tools/metrics you would use at each layer.
full stack
General

Sample Answer

When I saw a REST API with wildly inconsistent response times at my last role (p95 spiking from 120ms to 2.5s for ~150k daily requests), I treated it like a three-tier detective job. First I validated the client: Chrome DevTools and synthetic tests to confirm whether total time was network vs rendering; I checked bundle sizes and cached assets and saw no frontend-induced spikes. Then I instrumented the app server with APM (New Relic) and distributed tracing (Jaeger) to measure p50/p95/p99 per endpoint and discovered long controller-to-service times. From there I checked DB metrics (pg_stat_statements, slow query log, CPU, I/O, active connections) and found a few queries doing sequential scans under load. I added query plans, introduced indexes, raised connection pool from 50 to 120, and put a 60s cache on high-read endpoints. Within two weeks p95 stabilized from 2.5s to 180ms and error rate dropped 70%.

Keywords

Start by isolating layers: frontend, app server, DB using timing and tracingUse concrete metrics: p50/p95/p99, CPU, I/O, DB slow query logs, connection countsIterate: short-term mitigations (cache, connection pool) + long-term fixes (indexes, query refactor)