Tag

LongAdder

0 views collected around this technical thread.

Java Architect Essentials
Java Architect Essentials
Jun 5, 2025 · Fundamentals

Understanding CAS, LongAdder, and AtomicLong in Java for High‑Concurrency Counters

This article explains the principles, advantages, and drawbacks of CAS, LongAdder, and AtomicLong in Java, illustrating why Alibaba recommends LongAdder for high‑concurrency counter scenarios, how the ABA problem arises, and how AtomicStampedReference can mitigate it.

AtomicLongCASDistributedSystems
0 likes · 9 min read
Understanding CAS, LongAdder, and AtomicLong in Java for High‑Concurrency Counters
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.

AtomicLongCASDistributed Systems
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.

AtomicLongBackendCAS
0 likes · 7 min read
Understanding AtomicLong vs LongAdder in Java Concurrency
FunTester
FunTester
Jan 3, 2025 · Backend Development

Java Atomic Package Classes: AtomicBoolean, AtomicInteger, AtomicLong, and LongAdder

This article introduces Java's java.util.concurrent.atomic package, detailing the core atomic classes—AtomicBoolean, AtomicInteger, AtomicLong, and LongAdder—including their constructors, key methods, typical use cases, and performance considerations in high‑concurrency scenarios for developers seeking efficient thread‑safe operations.

JavaLongAdderatomic
0 likes · 9 min read
Java Atomic Package Classes: AtomicBoolean, AtomicInteger, AtomicLong, and LongAdder
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Oct 18, 2021 · Fundamentals

Understanding Java LongAdder and Its Underlying Striped64 Implementation

This article explains why LongAdder was introduced to overcome AtomicLong's CAS contention bottleneck, explores the design of Striped64 and its cells, and walks through key source code snippets of LongAdder, DoubleAdder, and the longAccumulate method, highlighting concurrency mechanisms and performance considerations.

AtomicLongCASJava
0 likes · 13 min read
Understanding Java LongAdder and Its Underlying Striped64 Implementation
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Jul 10, 2021 · Backend Development

Concurrent Unit Testing of AssetService.update with Optimization Techniques

This article explains how to write a concurrent unit test for the AssetService.update method using thread pools, CountDownLatch, AtomicInteger, and then suggests optimizations such as replacing AtomicInteger with LongAdder and employing CyclicBarrier to increase contention, providing full code examples and detailed explanations.

AtomicIntegerCyclicBarrierJava
0 likes · 9 min read
Concurrent Unit Testing of AssetService.update with Optimization Techniques
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Aug 26, 2020 · Backend Development

Testing Volatile Thread Safety and Comparing LongAdder vs AtomicInteger Performance in Java

This article examines the thread‑safety of the volatile keyword under multi‑write scenarios, demonstrates its failure with a concurrent counter test, and benchmarks LongAdder against AtomicInteger using JMH, revealing LongAdder’s superior performance under high contention and AtomicInteger’s advantage in low‑contention environments.

AtomicIntegerJMHJava
0 likes · 8 min read
Testing Volatile Thread Safety and Comparing LongAdder vs AtomicInteger Performance in Java
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Feb 17, 2020 · Backend Development

Understanding JVM-Level Locks in Java: synchronized, ReentrantLock, ReentrantReadWriteLock, and LongAdder

This article explains the evolution and implementation of Java's JVM‑level locks—including synchronized, ReentrantLock, ReentrantReadWriteLock, and LongAdder—detailing their lock‑upgrade process, internal object layout, AQS‑based algorithms, and how they improve concurrency and performance in multithreaded applications.

JavaLocksLongAdder
0 likes · 24 min read
Understanding JVM-Level Locks in Java: synchronized, ReentrantLock, ReentrantReadWriteLock, and LongAdder