Lightweight Latency Measurement with Server-Timing
Blog post from Fastly
Server-Timing, a specification established in 2015, enables servers to communicate performance metrics related to the request-response cycle to user agents via an HTTP response header. This feature, now supported by most browsers, helps visualize these metrics through developer tools, thus offering insights into various stages of web page processing, such as database lookups, template processing, and caching. By implementing Server-Timing headers in different systems such as origin servers, compute applications, and delivery applications, developers can trace end-to-end latency and identify performance bottlenecks. Although the specification suggests focusing on duration metrics, it is possible to include additional information, such as caching behaviors and network protocol metrics, resembling distributed tracing practices. Despite its utility, care must be taken to avoid exposing sensitive information through these headers. Server-Timing’s capability to provide a detailed view of latency across different systems makes it a valuable tool for optimizing web performance and diagnosing complex request pathways.