vozlt / nginx-module-vts

Nginx virtual host traffic status module
BSD 2-Clause "Simplified" License
3.17k stars 456 forks source link

Support the quantile for response time #257

Open u5surf opened 1 year ago

u5surf commented 1 year ago

It should be important for the module users to fetch the response time quantile for various use cases. I consider that it is suitable for using libgkc which is the library within the high performance http server h2o https://github.com/h2o/h2o/tree/master/deps/libgkc

According this code, it follows the algorithm which is written in this paper. Thus it is efficiency spatial complexity for that calculate. https://www.cis.upenn.edu/~sanjeev/papers/sigmod01_quantiles.pdf

sboisson commented 9 months ago

There are other histogram implementations/structures that seems worth considering:

u5surf commented 5 months ago

@sboisson Thanks advice so much. I consider that HdrHistogram is more understandability about its algorithm. But we guess it is suitable the pseudo-quantile algorithm which is called by e-approximate p-Quantile (e.g. ddsketch, CKMS, etc...) if we're willing to save more space of the memory. At least, GK seems to be less accuracy than other pseudo-quantile algorithms.

CKMS: https://grafana.com/blog/2022/03/01/how-summary-metrics-work-in-prometheus/

cohalz commented 5 months ago

If you are using Prometheus, you can calculate quantiles by implementing Prometheus' Native Histogram (OpenTelemetry's Exponential Histogram). In addition to the advantage of compressing the amount of data, there are almost no settings for the user.

SuperQ commented 5 months ago

Agreed, you definitely want to use something like Prometheus native histograms. Directly exposing quantiles like the older Prometheus "Summary" metrics is not useful as the data can't be aggregated over multiple instances.