Tagged articles
8 articles
Page 1 of 1
Java Captain
Java Captain
May 4, 2025 · Backend Development

Understanding Java Counter Implementations: AtomicLong vs LongAdder

This article explains the principles, advantages, and drawbacks of Java's AtomicLong and LongAdder counters, describes the CAS operation and its ABA problem, and analyzes why Alibaba recommends LongAdder for high‑concurrency, high‑availability scenarios in distributed systems.

CASJavaatomiclong
0 likes · 7 min read
Understanding Java Counter Implementations: AtomicLong vs LongAdder
Java Tech Enthusiast
Java Tech Enthusiast
Apr 12, 2025 · Backend Development

Understanding AtomicLong vs LongAdder in Java Concurrency

In high‑concurrency Java applications, LongAdder—introduced in JDK 8 and using partitioned cells to reduce contention—generally outperforms the single‑value AtomicLong, which relies on CAS and can cause CPU waste under heavy load, so Alibaba advises LongAdder for scalable distributed counters, though memory usage and workload specifics must be considered.

BackendCASJava
0 likes · 7 min read
Understanding AtomicLong vs LongAdder in Java Concurrency
FunTester
FunTester
Mar 28, 2022 · Backend Development

Why LongAdder Beats AtomicLong in High‑Concurrency Java Performance Tests

This article explains how Java's LongAdder works, compares its API and performance to AtomicLong, provides usage examples and a benchmark showing its superior throughput under high thread contention, while noting its higher memory cost and appropriate scenarios for adoption.

JavaPerformance Testingatomiclong
0 likes · 7 min read
Why LongAdder Beats AtomicLong in High‑Concurrency Java Performance Tests
Ziru Technology
Ziru Technology
Sep 19, 2019 · Backend Development

Why LongAdder Beats AtomicLong in High Contention: Deep Dive into Java’s Concurrent Counter

This article explains how java.util.concurrent.atomic.LongAdder provides a more efficient counting mechanism than AtomicLong under high contention, discusses its trade‑offs in space and precision, presents JMH benchmark results, and walks through the internal implementation details such as cells, CAS loops, and hash‑based distribution.

CASJMHJava
0 likes · 13 min read
Why LongAdder Beats AtomicLong in High Contention: Deep Dive into Java’s Concurrent Counter