I’ve got p90 in k6 of 1 second, but p99 on prometheus is always 4.95 ms and p90 is 4.52 ms.
The formula on prometheus: histogram_quantile(0.99, sum(rate(caddy_http_request_duration_seconds_bucket{code=~"302"}[5m])) by (le))
I was looking for measurements closer to what I got in k6 (excluding client network latency of course).
@francislavoie do you have any insights here? It seems the top duration measurements are always very low, I was expecting more variation under load. Thank you.
These values are not precise enough. Is that really the output of the logs? All the requests likely have different duration values, but they’re so close together that this representation can’t express that.
@matt that’s what the logs are outputting, and those are the highest values.
Caddy is only replying with redirects (www to root domain), perhaps that’s why the duration is so low. But it’s issuing TLS certificates, so I was expecting the first request to take longer.
If I do a curl https://<domain> and the TLS cert is not issued yet, then the metrics should be higher and account for the time of the TLS cert being generated.
You can adjust the log output’s duration_formatlog (Caddyfile directive) — Caddy Documentation. Try unix_milli_float which would move the decimal point to the right by 4 positions, so it shouldn’t use an e exponent in the output.
I think the metrics only include the time taken for the HTTP part of the request, not including the TLS handshake. That’s because the metrics are only initialized after the connection is established and handed off to our ServeHTTP part of the code, because the TLS connection stuff happens lower level inside of the Go stdlib.