The article explains why a MySQL SELECT * query scanning 20 million rows won't cause server-side OOM due to its streaming protocol using a 16KB net_buffer, but warns that full table scans can pollute the Buffer Pool, though InnoDB's midpoint insertion strategy and innodb_old_blocks_time (default 1s) protect hot data from eviction.
The article explains the LRU (Least Recently Used) page‑replacement algorithm, its basis in the locality principle, hit‑rate example, various exact and approximate implementations—including counter, stack, linked‑list, Clock, Aging and Working‑Set methods—its hardware requirements, pros and cons, and practical uses such as a Python cache and Redis eviction policies.
When a device runs out of RAM, page replacement algorithms decide which pages to evict; the article defines page replacement, outlines goals, compares OPT, FIFO, LRU and their approximations, explains the Belady anomaly, and shows real‑world uses in Linux, JVM GC, and Redis.
The article explains why InnoDB must cache disk pages in a Buffer Pool, details the pool's internal structure, eviction policies, dirty‑page flushing mechanisms, multi‑instance and chunk sizing for large workloads, and how to monitor its health with SHOW ENGINE INNODB STATUS.
This article explains why LRU needs a doubly linked list, how to achieve O(1) LFU with two hash maps and a minFreq pointer, and why Redis uses approximate LRU and an 8‑bit Morris counter for LFU, providing full Java, Go, and Python implementations.
Adding a cache layer without proper design can cause data inconsistency, cache breakdown, and performance volatility; this article breaks down cache patterns, eviction strategies, concurrency controls, and distributed consistency models, showing when and how to apply each for reliable high‑performance systems.
The article explains how Linux uses page cache, inode cache, and dentry cache to accelerate file operations, detailing their structures, lookup mechanisms, LRU eviction, and real‑world performance impact, and shows step‑by‑step path resolution with code examples.
The article explains how Redis eviction policies work, why configuring maxmemory and a proper policy is essential to avoid OOM crashes, details each of the eight policies, shows practical configuration and monitoring commands, and dives into the source‑code implementation of LRU/LFU eviction.
This article explains why naive cache eviction fails, why LRU is the go‑to strategy for many Go projects, and provides a production‑ready LRU implementation with detailed code, lock‑granularity tips, key design considerations, and scenarios where LRU is not suitable.
Redis stores data in memory, so when usage reaches the maxmemory limit it triggers one of six eviction policies—noeviction, allkeys‑lru, volatile‑lru, allkeys‑random, volatile‑random, and volatile‑ttl—each suited to different scenarios, and can be set via redis.conf or CONFIG SET, as illustrated with a Java Jedis example.
This article examines recent efforts to make Linux kernel memory management programmable with eBPF, covering BPF‑MM patches for mTHP order, cache‑ext’s customizable LRU, FetchBPF prefetch policies, and BPF OOM hooks, and discusses their design, implementation details, and performance impacts.
This article walks through a production‑grade Go local cache implementation, covering TTL and LRU fundamentals, sharded concurrency, singleflight protection, asynchronous refresh, capacity control, persistence, performance testing, and real‑world usage scenarios.
Redis implements an approximate LRU using random sampling and timestamps, while classic LRU relies on exact access order; the article explains both LRU and LFU fundamentals, their Java implementations, Redis-specific variants, trade‑offs, use‑case recommendations, and configuration tips for selecting the optimal eviction policy.
This article explains how Redis handles key expiration, the TTL and TTI concepts, periodic and lazy deletion strategies, their impact on persistence and replication, and the various memory eviction policies—including LRU and LFU—so developers can efficiently manage data and improve system performance.
This article evaluates five Go in‑memory cache libraries—Ristretto, BigCache, FreeCache, FastCache, and groupcache—detailing their support for large keys, high‑throughput LRU‑like eviction, TPS/QPS benchmarks, core APIs, code examples, and practical selection guidance for backend developers.
This article explains the core principles of the Least Recently Used (LRU) cache algorithm, details its operation and complexity, provides a complete C++ implementation with line-by-line analysis, showcases test cases, and offers practical interview tips and extensions such as LFU and LRU‑K.
Even when scanning a 200 GB InnoDB table on a server with only 100 GB of RAM, MySQL does not consume all memory because it streams results using a limited net_buffer, employs socket send buffers, and InnoDB’s optimized LRU algorithm manages the buffer pool to prevent memory blow‑up.
This article dissects Guava Cache's source code, explaining its segmented lock architecture, data structures, put/get implementations, cleanup and eviction mechanisms, and compares its performance and design choices with the more modern Caffeine cache library.
The article analyzes a Meituan interview question about caching 10 million MySQL rows when Redis can store only 200 thousand rows, presenting a five‑step three‑tier cache architecture that separates cold and hot data, selects appropriate eviction policies, uses proactive hotspot detection, adds multi‑level defense, and employs both scheduled and real‑time pre‑heating, with performance numbers showing an 85% hit rate and 100 ms latency.
The article explains why scanning a 200 GB InnoDB table on a MySQL server with only 100 GB of memory does not cause an out‑of‑memory crash, detailing MySQL's row‑by‑row net buffer transmission, InnoDB buffer‑pool behavior, and the improved LRU algorithm that limits memory impact.
A full‑table scan of a 200 GB InnoDB table on a MySQL server with 100 GB RAM does not exhaust server memory because MySQL streams rows to the client, uses a fixed net_buffer, and InnoDB’s optimized LRU algorithm limits buffer‑pool pressure, ensuring stable performance.
This article explains how Redis uses memory as a cache, details the maxmemory setting and its configuration methods, describes various eviction policies—including LRU, LFU, and random strategies—and outlines expiration handling, replication considerations, and best‑practice recommendations for stable high‑load deployments.
This article explains Redis's LRU and LFU eviction algorithms, their implementation details, code structures, and practical guidance on choosing the right policy based on workload characteristics.
This article explains Redis's eight memory eviction policies, their ideal use cases, and provides step‑by‑step commands and configuration examples for querying and setting both the eviction strategy and maximum memory limits.
Even when scanning tables with tens of millions of rows, MySQL avoids out‑of‑memory crashes by streaming data in small 16 KB net buffers, using socket buffers, and employing an improved LRU algorithm that isolates cold data in the buffer pool’s old generation.
The article explains how to alleviate MySQL bottlenecks in high‑traffic product services by introducing Redis as a local and remote cache, covering data structures, expiration policies, eviction strategies, persistence mechanisms, and a lightweight TCP protocol to achieve scalable, reliable performance.
This article reviews the long‑standing performance problems of TRUNCATE and DROP TABLE in MySQL, tracing their origins through official manuals and historical bugs, summarizing the optimizations introduced in MySQL 5.5.23, 5.7, 8.0, and 8.4, and offering practical guidance for mitigating remaining latency.
This article explains how Python dictionaries can serve as an efficient caching mechanism, covering basic dictionary concepts, common operations, simple cache examples, advanced techniques like LRU cache implementation, and practical use cases such as caching API responses, with complete code snippets.
This guide explains Redis's eight memory eviction policies, their algorithms, ideal scenarios, and step‑by‑step configuration via redis.conf, CONFIG SET, or command‑line options, helping you choose the right strategy to balance performance, data safety, and resource limits.
This article explains Linux's page reclamation mechanisms, covering the LRU list algorithm, the second‑chance method with PG_active and PG_referenced flags, and the direct reclaim path triggered by alloc_page, including the role of kswapd, waiting queues, and key kernel functions such as lru_cache_add, mark_page_accessed, try_to_free_pages, and throttle_direct_reclaim.
This article explains MySQL InnoDB’s linear and random prefetch mechanisms, the role of the innodb_read_ahead_threshold and innodb_random_read_ahead variables, and how the LRU buffer‑pool list manages hot and cold pages to improve overall query efficiency.
This article explains how Redis handles memory exhaustion by configuring maxmemory and maxmemory-policy, detailing each eviction strategy (noeviction, volatile‑lru, volatile‑lfu, volatile‑ttl, volatile‑random, allkeys‑lru, allkeys‑lfu, allkeys‑random), their implementation details, and the underlying approximate LRU algorithm.
This article explains Linux's page reclamation process, describing how the kernel recovers memory under pressure using PFRA, LRU algorithms, direct reclaim, compaction, and OOM handling, and provides detailed source code analysis of the involved kernel functions.
When Redis memory reaches its configured maxmemory limit, it triggers a set of eviction policies—such as noeviction, allkeys‑lru, volatile‑lfu, and others—to decide which keys to discard, and this article explains how to view, configure, and understand each strategy.
This article explores how counters, especially 24‑bit timestamps, are employed in Redis’s LRU eviction algorithm and other memory‑constrained scenarios, detailing implementation tricks, precision trade‑offs, and practical code examples for efficient cyclic counters and compact storage techniques.
This article walks through implementing EasyCache, a Go‑based in‑memory cache with sharding, lock‑free concurrency, LRU eviction, and configurable expiration, explaining the underlying data structures, goroutine cleanup logic, and key handling with concrete code examples.
This article provides a comprehensive overview of Redis memory management, detailing how maxmemory limits trigger various eviction policies, explaining the internal freeMemoryIfNeeded algorithm, and describing expiration mechanisms—including active and lazy deletion—and offering guidance on selecting the appropriate eviction strategy for different workloads.
This article explains how Redis uses the maxmemory setting to trigger memory eviction, details the various eviction policies (including LRU and LFU), shows how to query and modify these settings with config commands, and briefly mentions promotional offers for a ChatGPT community.
This article explains how Redis handles memory exhaustion by distinguishing expiration and eviction policies, detailing the maxmemory setting, enumerating all eviction strategies—including LRU and LFU algorithms—and showing how to view and modify these policies for optimal cache performance.
This article explains the principles, implementation details, and trade‑offs of Redis’s LRU and LFU cache eviction algorithms, including their data structures, code snippets, configuration parameters, and practical guidance on choosing the appropriate strategy based on workload characteristics.
Redis implements approximate LRU and LFU eviction policies by sampling keys and using a compact 24‑bit field to store timestamps and counters, where LRU evicts the least recently accessed items and LFU evicts those with low, decay‑adjusted access frequency, each with trade‑offs for different workloads.
This article explains cache fundamentals, common use cases, design constraints, and a Go implementation that combines hash‑maps with doubly‑linked lists, LRU eviction, TTL handling, and mutex‑based concurrency control, providing practical code examples and deployment tips.
This article explains cache fundamentals, common use cases, pitfalls of distributed caches, and presents a robust Go implementation featuring key‑value storage, LRU eviction, TTL handling, mutex‑protected concurrency, and practical API examples.
This article provides a comprehensive guide to Redis memory architecture, covering memory analysis, fragmentation, object and buffer usage, Linux copy‑on‑write effects, maxmemory settings, eviction policies, and practical tips for monitoring and optimizing Redis in production environments.
This article explains the MySQL Buffer Pool architecture, describing data pages, cache pages, the three page states, the various linked lists (Free, Flush, LRU), pre‑read mechanisms, hot‑cold separation, concurrency handling, and dynamic resizing using the chunk mechanism.
Redis uses key expiration commands, periodic scanning, and a combination of lazy and active deletion strategies, and when memory is full it applies one of eight eviction policies—including refined LRU and LFU algorithms with sampling and decay mechanisms—to decide which keys to discard.
By eliminating unnecessary reverse‑geocode calls, aggregating nearby coordinates with GeoHash, and employing a multi‑layer LRU‑K cache with time‑ and access‑count eviction, the Hellobike map team cut daily requests from 200‑300 million to 20‑30 million while adding fallback and monitoring mechanisms.
This article explains the principles and practical implementation of in‑memory caching using Guava’s LoadingCache, covering cache initialization parameters, put and loading strategies, eviction policies, common algorithms such as LRU, LFU, FIFO, and tips for avoiding memory issues and monitoring cache performance.
This article explains the fundamentals of in‑memory caching, compares it with buffering, introduces Guava's LoadingCache configuration and operations, discusses eviction strategies, illustrates common cache algorithms (FIFO, LRU, LFU), provides a simple LRU implementation using LinkedHashMap, and offers practical guidelines for when and how to apply caching to improve backend performance.
This article explains how Redis handles key expiration, the three expiration deletion strategies, the eight memory‑eviction policies configurable via maxmemory, and the inner workings of Redis's LRU and LFU algorithms, including sampling, lru_clock, and counter decay mechanisms.
This article explains the fundamentals of in‑memory caching, introduces Guava's LoadingCache API, discusses cache sizing, eviction policies, common algorithms like FIFO, LRU, LFU, shows a simple LRU implementation using LinkedHashMap, and provides practical guidance on when and how to apply caching for performance optimization.
Redis caches can fill up, requiring memory eviction; this guide explains how to set Redis maxmemory (e.g., 5GB), choose appropriate eviction policies such as allkeys-lru or allkeys-lfu, and details the underlying LRU and LFU algorithms and their configuration commands.
This article explains how to set Redis memory limits, choose appropriate eviction policies such as noeviction, allkeys‑lru, allkeys‑lfu, volatile‑ttl, and describes the underlying LRU and LFU algorithms, including their implementation details and practical configuration commands.
This article explains how to size Redis memory, configure maxmemory and maxmemory‑policy, and details the various eviction strategies—both non‑eviction and eviction policies—while describing the inner workings of Redis's LRU and LFU algorithms and their practical trade‑offs.
This article reviews virtual memory concepts and explains five page replacement algorithms—Optimal (OPT), First‑In‑First‑Out (FIFO), Least Recently Used (LRU), CLOCK (including a simple and improved version), and Least Frequently Used (LFU)—detailing their principles, operation, advantages, drawbacks, and illustrative examples.
This article explains Redis memory eviction strategies, including volatile and allkeys policies, details the approximate LRU algorithm Redis uses, and provides Java implementations of an LRU cache using LinkedHashMap and a custom doubly‑linked list, complete with code examples and configuration settings.
This article explains how Redis handles memory pressure using configurable maxmemory limits and a variety of eviction policies—including noeviction, volatile‑lru, volatile‑lfu, allkeys‑lru, and allkeys‑random—while offering guidance on selecting appropriate policies and sizing cache capacity for optimal performance.
This article explains how the Linux kernel’s kswapd thread is created, when it is awakened, and the detailed steps it follows—including LRU management, zone migration, balance_pgdat, and shrink functions—to reclaim memory efficiently on memory‑constrained devices.
This collection highlights recent technical articles and resources covering Vue 3.0, ESLint fundamentals, defensive CSS techniques, low‑code system design, React project setup, Nest.js with TypeORM, and an introduction to the LRU caching algorithm, offering practical insights for frontend developers.
This article explains Redis's in‑memory database architecture, detailing data locality, various eviction policies such as LRU, LFU, random and TTL, their configuration via maxmemory settings, and provides code examples of the eviction process and memory‑freeing functions.
On arm64 Linux kernels (e.g., 5.10.27), the mlock system call marks VMAs with VM_LOCKED, forces page faults, sets the PG_mlocked flag and moves pages into the unevictable LRU so they cannot be reclaimed, while munlock clears these flags and returns pages to regular LRU lists, guaranteeing resident memory for latency‑sensitive applications.
This article explores MySQL's client‑server interaction, connection methods, query parsing and optimization, InnoDB storage engine design, data page layout, BufferPool structures, and the free, flush, and LRU linked lists, including their challenges and optimization techniques.
This article explains why a MySQL query that scans a 100‑gigabyte table and returns millions of rows does not exhaust server memory, describing the net_buffer mechanism, socket send buffer behavior, InnoDB buffer‑pool management, and the improved LRU algorithm used to keep large scans from degrading overall performance.
Full table scans on large InnoDB tables do not exhaust MySQL server memory because results are streamed in small net buffers, while InnoDB’s optimized LRU algorithm and buffer pool management ensure that massive scans minimally affect buffer pool hit rates and overall system performance.
This article explains how MySQL handles massive full‑table scans without blowing up server memory, detailing the role of net_buffer, socket send buffers, the "edge‑compute‑and‑send" model, and InnoDB's optimized LRU algorithm that protects the buffer pool during large scans.
This article explains the internal structure and algorithms of Java's HashMap and LinkedHashMap, covering node definitions, constructors, hash calculations, collision handling, treeification, resizing mechanics, power‑of‑two bucket sizing, thread‑safety issues, and how LinkedHashMap enables LRU caching.
This article explores the role of cache in computer architecture, covering why caches are needed, how data is placed and retrieved, various replacement policies, write strategies, and consistency protocols such as MESI, while illustrating concepts with diagrams and code examples.
This article analyzes the Go‑implemented FreeCache library, detailing its project features, internal data structures, zero‑GC design, segment‑based locking for high‑concurrency thread‑safe access, the set operation workflow, index expansion, and its approximate LRU eviction strategy.
This article explains the purpose of CPU caches, their classification, placement and replacement strategies, write policies, and coherence protocols, providing a comprehensive overview of cache concepts essential for modern computer architecture.
This article explains the motivation behind CPU caches, their classification, placement and lookup methods, replacement and write policies, and coherence protocols, providing a comprehensive overview of cache fundamentals for modern computer architectures.
This article explains the Least Frequently Used (LFU) cache eviction strategy, contrasts it with LRU, and provides a complete Java implementation—including node definition, insertion, sorting, removal, and retrieval logic—along with a test scenario and discussion of LFU's drawbacks.
Redis handles key expiration using commands like EXPIRE, PEXPIRE, EXPIREAT, and PEXPIREAT, offers TTL queries, and employs three deletion strategies—timed, lazy, and periodic scanning—while its eight eviction policies (e.g., volatile‑lru, allkeys‑lfu, noeviction) and refined LRU/LFU algorithms manage memory pressure efficiently.
This article explains how Redis handles memory exhaustion by setting key expirations with commands like expire and pexpire, describes its lazy and periodic expiration strategies, details the eight configurable eviction policies, and dives into the internal LRU and LFU algorithms used for key eviction.
This article explains how to set Redis's maximum memory usage via configuration files or runtime commands, details all built‑in eviction policies, demonstrates retrieving and changing these policies, and dives into the LRU and LFU algorithms—including Java sample code and Redis's approximate LRU implementation.
This article explains the LRU cache eviction algorithm, its core principle, real‑world applications in Redis and MySQL, compares naive array and linked‑list solutions, and provides a complete O(1) doubly‑linked‑list‑plus‑hash‑map implementation in Python for interview preparation.
Vue’s keep-alive component enables dynamic tab caching in B‑end applications by storing component VNodes in an internal LRU cache, preserving state across route switches, supporting include/exclude patterns, router‑meta flags, Vuex‑driven lists, and custom strategies for nested routes to prevent stale data and excess API calls.
This article explains how Redis handles memory exhaustion by using key expiration commands, describes the three expiration strategies, details the eight maxmemory eviction policies, and dives into the internal LRU and LFU algorithms with their configuration parameters and code examples.
This article explains how to configure Redis's maximum memory, describes the various eviction policies—including noeviction, allkeys‑lru, volatile‑lru, random and ttl strategies—covers how to query and set these policies, and details the LRU and LFU algorithms used by Redis for cache management.
Learn how to set Redis's maximum memory usage, understand its various eviction policies—including noeviction, allkeys‑lru, volatile‑lru, allkeys‑random, volatile‑random, volatile‑ttl, and the newer LFU strategies—plus see Java code examples and insights into approximate LRU implementation.
This article explains how Redis handles key expiration, the commands for setting TTL, the three expiration strategies, the eight eviction policies, and the internal LRU and LFU algorithms, including their implementation details, sampling techniques, and configuration parameters for memory management.
This article explains how Redis handles key expiration, the commands for setting TTL, the three expiration strategies, the eight memory‑eviction policies, and the internal LRU and LFU algorithms used to manage hot data when memory is exhausted.
This article explains how to set Redis's maximum memory usage, configure eviction policies such as noeviction, allkeys‑lru, volatile‑lru, allkeys‑random, and LFU, demonstrates command‑line and configuration‑file methods, and provides a Java implementation of an LRU cache.
This article explains how Redis handles memory exhaustion by setting key expirations, describes the four expiration commands, details the three expiration strategies, outlines the eight eviction policies, and dives into the inner workings of Redis's LRU and LFU algorithms with configuration examples.
This article provides a comprehensive overview of MySQL InnoDB's Buffer Pool, explaining its memory layout, data and cache pages, free, flush, and LRU lists, hot‑cold separation, dynamic resizing with chunk mechanisms, and practical configuration tips for production environments.
This article examines the YYCache iOS library, covering its multi‑level architecture, LRU implementation, thread‑safe APIs, eviction policies, lock choices, disk‑storage strategies, Swift integration, performance benchmarks, and practical takeaways for building high‑performance mobile caches.
This article explains how to configure Redis's maximum memory usage, describes the built‑in eviction strategies such as noeviction, allkeys‑lru, volatile‑lru, random and ttl policies, shows how to query and set these policies via configuration files or runtime commands, and details the LRU and LFU algorithms used by Redis, including Java sample code and recent improvements in Redis 3.0 and 4.0.
Redis, an in‑memory key‑value store, lets you set a maximum memory limit via configuration files or runtime commands, choose among various eviction strategies such as noeviction, allkeys‑lru, volatile‑lru, and LFU, and understand how approximate LRU works, with Java code examples illustrating these concepts.
This article explains how to configure Redis's maximum memory usage, modify memory limits at runtime, understand the built‑in eviction strategies—including noeviction, allkeys‑lru, volatile‑lru, allkeys‑random, volatile‑random, and volatile‑ttl—how to query and set these policies, and the details of LRU and LFU algorithms with Java examples and performance comparisons.
This article explains how Redis handles memory limits with the maxmemory setting, describes the six eviction policies—including noeviction, allkeys‑lru, volatile‑lru, allkeys‑random, volatile‑random, and volatile‑ttl—covers the LRU and LFU algorithms, and outlines the three key expiration deletion methods as well as RDB and AOF persistence handling.
This article explains how to configure Redis's maximum memory usage, describes the various eviction strategies such as noeviction, allkeys‑lru, volatile‑lru, and introduces both LRU and LFU algorithms with Java examples and practical configuration commands.
This article explains how to configure Redis's maximum memory usage, describes the various eviction strategies including noeviction, allkeys‑lru, volatile‑lru, random and ttl policies, shows how to query and set these policies via configuration files or commands, and provides Java code for a simple LRU cache while discussing Redis's approximate LRU and LFU algorithms.
This article explains the three InnoDB Buffer Pool page types—Free, Clean, and Dirty—their associated LRU, Flush, and Free linked lists, and how MySQL uses configurable parameters to balance memory usage, query speed, and data safety during flushing and checkpoint operations.
This article explains how to set Redis's maximum memory usage via configuration files or commands, describes the built‑in eviction strategies including noeviction, allkeys‑lru, volatile‑lru, allkeys‑random, volatile‑random, volatile‑ttl, and shows how to query and change these policies, while also covering LRU fundamentals, a Java LRU cache example, Redis's approximate LRU implementation, its 3.0 optimizations, and the newer LFU eviction algorithm.
This article explains how to set Redis's maximum memory usage via configuration files or runtime commands, details the various eviction strategies including noeviction, LRU, random, and LFU, and provides Java code for a simple LRU cache implementation.
This article explains how Redis removes expired keys using periodic and lazy deletion, describes the slave expiration handling, details the asynchronous memory reclamation commands like UNLINK and FLUSHALL ASYNC, and outlines the various maxmemory eviction policies including LRU, LFU, and their implementations.
Redis 5.0 builds on 4.x with new Stream data type, enhanced memory management, and several command improvements—including XADD, XGROUP, XREADGROUP, XACK, and ZPOPMIN/ZPOPMAX—while also adding LFU/LRU support in RDB snapshots and client‑side enhancements for easier cluster management.
This article explains the principles of caching, compares memory and disk storage, demonstrates several iOS persistence methods, and details how YYCache combines memory and disk layers with LRU optimization and network synchronization to improve performance in a real‑world mobile app.
This article traces iQIYI's five‑stage journey of Java caching—from simple database queries and in‑process HashMap caches, through Guava's advanced features addressing lock contention, expiration, and refresh, to the high‑performance Caffeine library with its W‑TinyLFU algorithm—while providing code examples and architectural insights.
This article explains the design and inner workings of Google Guava's Cache library, covering JVM‑level caching, the advantages over simple maps, a real‑world Kafka alerting scenario, code examples, expiration policies, LRU handling, concurrency mechanisms, and the builder pattern used to configure caches.