These are chat archives for HdrHistogram/HdrHistogram

11th
Dec 2014
Viktor Szathm√°ry
@phraktle
Dec 11 2014 11:16
Hi! I saw a new ConcurrentHIstogram was added recently. What are the main differences compared to AtomicHistogram? (i.e. when should one use one over the other)
Gil Tene
@giltene
Dec 11 2014 13:39
Both ConcurrentHistogram and AtomicHistogram support safe lossless recording by multiple concurrent writers. ConcurrentHistogram also supports [multi-writer-safe] auto-sizing and value-shifting, while AtomicHistogram does not support either operation.
In small micro-tests, AtomicHistogram seems to be about 1.5x faster than ConcurrentHistogram (e.g. ~40M recordings/sec vs ~24M on my laptop). So if you do not need either auto-sizing or shifting, AtomicHistogram may be a better choice.
The multi-writer safe shifting support was added in order to support the needs of a ConcurrentDoubleHistogram. DoubleHistogram value recoding operations can result in underlying value shifts in the internal integer value histogram representations, and unless those could be safely supported on mutiple concurrent writers (with ConcurrentHistogram)
we would not be able to provide a safe multi-writer DoubleHistogram version. ConcurrentDoubleHistogram supports safe multi-writer recording by using ConcurrentHistogram under the hood...
Gil Tene
@giltene
Dec 11 2014 13:47
Auto-sizing is a completely different matter. It was added in 2.1.0 to all histograms except for AtomicHistogram. The non-multi-writer-safe histogram variants can obviously safely auto-size on a recoding, as can the synchronized versions. But only ConcurrentHistogram and ConcurrentDoubleHistogram support auto-sizing that is safe in the presence of multiple concurrent writers.
Viktor Szathm√°ry
@phraktle
Dec 11 2014 15:47
awesome, thanks @giltene !