Using the Server‑Timing Header to Measure Server Performance
The article explains how the Server‑Timing HTTP header can be used to transmit arbitrary server‑side metrics to the client, shows how to send multiple timing values, demonstrates Chrome DevTools support, warns about exposing sensitive data, and introduces a small hapi plugin that simplifies adding the header.
The Server-Timing header allows you to pass arbitrary server metrics to the client. Its syntax supports different metric types: you can send just a metric name, assign a value, or provide a description.
You can transmit multiple metrics simultaneously so the client can see how long each part of request processing took.
Chrome DevTools already provides an interface to inspect Server-Timing header values.
If you want to understand how the server processes a request, the Server-Timing header can be useful, but you must avoid exposing sensitive information. Enable it only after proper authentication, such as via cookies or custom headers.
We have released a small hapi plugin that makes adding the Server-Timing header easy. You can find it at https://github.com/betterthingsdigital/hapi-server-timing or on npm.
“UC International Technology” is dedicated to sharing high‑quality technical articles on client‑side, server‑side, algorithms, testing, data, front‑end, and more.
UC Tech Team
We provide high-quality technical articles on client, server, algorithms, testing, data, front-end, and more, including both original and translated content.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.