Bin's Tech Cabin
Author

Bin's Tech Cabin

Original articles dissecting source code and sharing personal tech insights. A modest space for serious discussion, free from noise and bureaucracy.

38
Articles
0
Likes
13
Views
0
Comments
Recent Articles

Latest from Bin's Tech Cabin

38 recent articles
Bin's Tech Cabin
Bin's Tech Cabin
Dec 25, 2024 · Backend Development

Unveiling Netty and Kafka Time Wheels: High‑Performance Scheduling Explained

This article explores the design and implementation of time wheel algorithms in Netty and Kafka, comparing their single‑layer and multi‑layer approaches, analyzing performance trade‑offs, and detailing how these systems achieve O(1) scheduling for massive delayed tasks while avoiding empty ticks.

KafkaNettybackend
0 likes · 76 min read
Unveiling Netty and Kafka Time Wheels: High‑Performance Scheduling Explained
Bin's Tech Cabin
Bin's Tech Cabin
Nov 7, 2024 · Backend Development

How Netty Detects Memory Leaks: Deep Dive into LeakAwareBuffer and ResourceLeakDetector

This article provides a comprehensive analysis of Netty's memory‑leak detection mechanism, covering the design principles, leak‑aware buffers, reference handling, sampling strategies, detection levels, and the internal models that enable accurate identification of unreleased native memory in both pooled and unpooled ByteBuf allocations.

JavaNettyReference Counting
0 likes · 44 min read
How Netty Detects Memory Leaks: Deep Dive into LeakAwareBuffer and ResourceLeakDetector
Bin's Tech Cabin
Bin's Tech Cabin
Aug 20, 2024 · Backend Development

How Netty’s ByteBuf Reference Counting Evolved: From Simple Counters to Parity‑Based Concurrency Safety

This article examines Netty 4.1.x’s ByteBuf reference‑counting mechanism, explains why reference counting was introduced, traces its original design, shows instruction‑level optimizations, reveals concurrency bugs in version 4.1.17, and details the clever even‑odd redesign that guarantees thread‑safe memory release while preserving high performance.

ByteBufConcurrencyJava
0 likes · 34 min read
How Netty’s ByteBuf Reference Counting Evolved: From Simple Counters to Parity‑Based Concurrency Safety
Bin's Tech Cabin
Bin's Tech Cabin
Jun 19, 2024 · Fundamentals

Why PhantomReference Can Track GC While WeakReference Can’t in ZGC

Exploring the differences between PhantomReference and WeakReference in Java’s ZGC, this article explains how ZGC’s concurrent phases and the should_drop method use distinct bitmap bits to determine object liveness, revealing why only PhantomReference reliably tracks object reclamation in certain finalization scenarios.

Garbage CollectionJVMJava
0 likes · 11 min read
Why PhantomReference Can Track GC While WeakReference Can’t in ZGC
Bin's Tech Cabin
Bin's Tech Cabin
Jun 17, 2024 · Fundamentals

How Does Java’s FinalReference Keep Objects Alive During GC?

This article explains how the JVM creates and manages FinalReference objects, how they interact with the finalize() method, and how the ZGC and other GC phases discover, revive, and eventually reclaim objects, detailing the roles of ReferenceHandler, FinalizerThread, and related internal data structures.

FinalReferenceFinalizerThreadGarbage Collection
0 likes · 20 min read
How Does Java’s FinalReference Keep Objects Alive During GC?
Bin's Tech Cabin
Bin's Tech Cabin
Jun 15, 2024 · Fundamentals

When Does ZGC Actually Clear SoftReferences? Inside the JVM Reference Policy

This article explains how ZGC in OpenJDK 17 decides whether to reclaim SoftReference objects, detailing the unconditional clearing scenarios, the policies governing SoftReference lifetimes, and how the JVM quantifies memory pressure using heap size and the -XX:SoftRefLRUPolicyMSPerMB flag.

Garbage CollectionJVMReference Policy
0 likes · 15 min read
When Does ZGC Actually Clear SoftReferences? Inside the JVM Reference Policy
Bin's Tech Cabin
Bin's Tech Cabin
Apr 1, 2024 · Fundamentals

Why System.gc Matters for Java NIO Memory Management

This article explains how Java's System.gc triggers full or concurrent garbage collection in NIO scenarios, detailing the JVM's handling of out‑of‑memory errors during memory‑mapped file operations and direct buffer allocations, and examines the behavior across various garbage collectors such as Serial, Parallel, G1, ZGC, and Shenandoah.

DirectByteBufferGarbage CollectionJVM
0 likes · 20 min read
Why System.gc Matters for Java NIO Memory Management
Bin's Tech Cabin
Bin's Tech Cabin
Mar 28, 2024 · Backend Development

Why MappedByteBuffer Beats FileChannel (And When It Doesn’t) – Deep Linux Kernel Insights

This article examines the internal read/write mechanisms of Java's FileChannel and MappedByteBuffer on Linux kernel 5.4, compares their performance through detailed source analysis and benchmarks, and explains why MappedByteBuffer often outperforms FileChannel for small I/O but can be overtaken for larger transfers due to page‑fault and dirty‑page handling.

JavaLinux kernelMappedByteBuffer
0 likes · 28 min read
Why MappedByteBuffer Beats FileChannel (And When It Doesn’t) – Deep Linux Kernel Insights