I have a use case for high concurrent writes to an AtomicLong variable. I just need to set current epoc time in this variable. What would be the fastest way to do so?
Is LongAccumulator.accumulate a better alternative to AtomicLong.set, are there any stats out there which tell after how many concurrent requests/second which is better if I just want to set variable to some value without any addition or calculation?
Primitive volatile and atomic long will perform the same for a simple set because atomic long uses volatile long field internally. Doing few million concurrent updates per second on the same volatile will for typical apps not be a performance problem.
Also I would be careful optimizing code if you don't know if something is a performance problem at all.