TTFB (Time to First Byte) measures the elapsed time from the moment a browser sends an HTTP request to the moment it receives the very first byte of the server's response. It is the most fundamental indicator of server responsiveness and the starting point for all web performance analysis.
TTFB is the sum of three components: request transmission time (network transit from browser to server), server processing time (handling the request, running database queries, generating the response), and response initiation time (the first byte traveling from server back to browser).
Google classifies TTFB as a supplementary Core Web Vitals metric. A good TTFB is 800 ms or less; anything above 1800 ms needs improvement. For shortened URL redirects, where the server simply looks up a mapping and returns a 301/302, the target should be under 50 ms.
Optimization techniques for a URL shortening service include CDN deployment (serving responses from edge locations close to the user), in-memory caching with Redis (caching URL mappings for sub-millisecond lookups), database index tuning, and enabling HTTP/2 for connection multiplexing.
Measurement tools include Chrome DevTools' Network tab (the "Waiting (TTFB)" column), Lighthouse performance audits, curl (curl -w '%{time_starttransfer}' URL), and WebPageTest. Separating server processing time from network transit time pinpoints the actual bottleneck. You can find related books on Amazon.