Choose the appropriate Histogram implementation
mainHdrHistogram provides several implementations of HistogramBase depending on your data type and concurrency needs:
LongHistogram: The standard implementation. It tracks value counts inlongfields and is recommended for most use cases.IntHistogram: Tracks counts inintfields. Use this when you have a limited range of counts and want to save memory (e.g., when managing tens of thousands of histograms in memory).ShortHistogram: Tracks counts inshortfields. Use this for very small count ranges to minimize storage.SynchronizedHistogram: A thread-safe variant.
Note on Concurrency: LongHistogram, IntHistogram, and ShortHistogram are NOT internally synchronized and do not use atomic variables to maintain high performance. For multi-threaded updates, you should either use SynchronizedHistogram or use a pattern of per-thread non-synchronized histograms that are aggregated later.