envoyproxy / nighthawk

L7 (HTTP/HTTPS/HTTP2/HTTP3) performance characterization tool
Apache License 2.0
353 stars 81 forks source link

Evaluate the possibility of switching to libcirclhist #115

Open htuch opened 5 years ago

htuch commented 5 years ago

Envoy uses https://github.com/circonus-labs/libcircllhist, the original design discussion was in https://github.com/envoyproxy/envoy/issues/1965.

In the interest of minimizing total dependencies, we should answer "is there a strong reason to be using HDR histogram vs. this log-linear library?". This library may have already been considered, if we can articulate our rationale in this issue we can have some design history.

oschaaf commented 5 years ago

So reading up, what may be for hdrhistogram is improved accuracy. But seeing is believing, I feel it's worth doing some tests for comparison. On a side-note: one fairly recent observation is that the merge we with perform after the test run to compute the aggregated latencies with HdrHistogram massively slows down when using lots of workers (80 on a 40 cpu (HT-enabled) system with 128GB of ram). I didn't look into that, but it seems very reproducible, so I am making note of it here so I don't forget when getting back to this.

htuch commented 5 years ago

Also worth evaluating is the project health of the various options, some might have more active communities and contributions than others.

HeinrichHartmann commented 4 years ago

Hi @htuch, the qualitiative differences to HDR Histograms are as follows:

I ran some superficial benchmarks for a recent conference talk: https://nbviewer.jupyter.org/github/HeinrichHartmann/Statistics-for-Engineers/blob/master/2019-10-02-SRECon-Dublin/2.4%20Mergeable%20Percentile%20Aggregation%20Comparison.ipynb

Here is the summary table: image

In this benchmark we inserted ~800K samples. The reported time is the time for the insertion of the complete dataset.

oschaaf commented 4 years ago

That is an awesome analysis. Based on that, I'd lean towards switching NH to libcirclhist, because:

@htuch what do you think?

htuch commented 4 years ago

Yep, SGTM, I think the original choice of HDR histogram is we wanted a precise and efficient (memory or serialization wise) histogram for dealing with potentially large ranges, as you typically encounter when measuring latency. This seemed to be a popular algorithm and implementation. I think if we gain via unification and the precision tradeoffs are within reason, i.e. multiple decimal digits when dealing with microseconds, we're good.