I would like to collect some metrics from various places in a web app. To keep it simple, all these will be counters and therefore the only modifier operation is to incremen
I did a benchmark to compare the performance of LongAdder and AtomicLong.
LongAdder had a better performance in my benchmark: for 500 iterations using a map with size 100 (10 concurrent threads), the average time for LongAdder was 1270ms while that for AtomicLong was 1315ms.