This article demonstrates how to implement distributed multi-rule rate limiting and duplicate submission prevention using Redis sorted sets and atomic Lua scripts, covering annotation design, key generation, concurrency handling, and two Lua implementation strategies with retry logic for timestamp collisions.
This article details how to build real-time collaborative editing in Java using Spring Boot, covering block-level versioning to reduce conflicts, conditional database updates for concurrency control, WebSocket broadcast after transaction commit, reconnection with operation replay, CRDT integration via Yjs for character-level editing, multi-instance deployment with Redis and message brokers, permission validation, and history version recovery without rollback.
This guide explains why Redis default configuration exposes servers to unauthorized access attacks, detailing six critical settings to change—authentication, network binding, protected mode, port exposure, dangerous commands, and non-root execution—plus memory limits, eviction policies, slow logging, big key detection, backup procedures, and a pre-launch checklist for production-ready Redis deployments.
The article details four Redis splitting strategies: sharding oversized single-key values via multiGet or hash fields, bucket-sharding large hash/set/zset/list collections using client-side hash modulo, consolidating hundreds of millions of string keys into hash structures to cut memory overhead, and partitioning large bitmaps or Bloom filters into independent shards while preserving false-positive rates.
This article explains Redis high availability as a three-tier progression — master-slave replication for redundancy, Sentinel for automatic failover, and Cluster for sharding — detailing configuration, split-brain prevention, multi-key limitations, and a decision framework to avoid over-engineering.
This article explains Redis persistence mechanisms (RDB snapshots, AOF logging, hybrid persistence), their trade-offs (fork latency, memory overhead, data loss windows), and provides a decision framework: disable persistence for pure caches backed by a database, enable RDB+AOF everysec for caches with locks/counters, and never rely on Redis as the sole source of truth.
This article explains how to properly implement Redis caching in Spring Boot using @Cacheable, @CachePut, and @CacheEvict, covering JSON serialization, key design, annotation failure scenarios, memory eviction policies, cache penetration/breakdown/avalanche prevention, consistency patterns, and template selection.
This article introduces the bloomfilter-spring-boot-starter library that provides declarative @BloomCheck and @BloomAdd annotations to prevent cache penetration in Spring Boot 3.5+, supporting both in-memory and Redis backends with fail-open safety, keyed SipHash, Micrometer metrics, and scheduled filter rebuilds.
The article argues MongoDB's positioning is awkward: early versions lacked persistence and competed with Redis, but Redis now dominates caching with alternatives like TiKV and Hazelcast; MongoDB's JSON advantage is eroded by PostgreSQL and Redis ReJSON; for OLTP it cannot match MySQL-compatible distributed databases like TiDB; for OLAP it is outclassed by modern lakehouse engines such as ClickHouse and Doris.
This article analyzes three approaches to e-commerce inventory deduction—single-row MySQL, sharded MySQL, and Redis with Lua scripts—detailing why database row locks fail under high concurrency and providing a complete Redis-based implementation with distributed locking for cache initialization and atomic stock decrement.
This article compares eight distributed ID generation approaches—UUID, database auto-increment, segment mode, Redis, Snowflake, Baidu UidGenerator, Meituan Leaf, and Didi TinyID—detailing their mechanisms, pros, cons, and real-world implementations to help choose the right solution for scalable systems.
This tutorial demonstrates how to integrate Spring AI 2.0 into a Spring Boot project, configure OpenAI-compatible models like DeepSeek, implement synchronous and streaming chat endpoints, and add multi-turn conversation memory using Redis-backed ChatMemory, all with minimal code.
This article explains JWT structure, its stateless design, four scenarios where pure JWT fails (account theft, user ban, password change, token expiry), solutions using Redis blacklist or whitelist, double-token refresh, Redis reliability, when pure JWT fits, and how to articulate trade-offs in interviews.
This article explains how to deduplicate 4 billion unsigned integers within a 1GB memory constraint using Bitmap and Bloom Filter data structures, detailing memory calculations, implementation principles, false-positive trade-offs, and practical Java code examples with Guava, Apache Commons, and Redis.
A frontend developer at Huajiao used AI to build a live-stream mini-game 'Guagua Le', covering interaction prototyping, UI design, backend development with PHP/Redis, API design, transaction handling, caching, verification with real data and concurrency tests, and phased deployment, demonstrating how AI lowers the barrier for frontend engineers to expand into full-stack delivery.
This article dissects three real Redis incidents — an 800MB key deletion that triggered cascading failovers, an 180K QPS hot key that saturated one shard while five idled, and an unmonitored disk that killed AOF rewrites — then delivers a complete playbook for detecting, governing, and observing big keys and hot keys using layered tooling, async deletion, local caching, replica sharding, and a four-tier monitoring stack.
This article analyzes three production incidents to explain Redis distributed lock pitfalls, detailing correct implementation with atomic SET NX EX, unique values, Lua unlocking, watchdog renewal for TTL dilemmas, fencing tokens for correctness guarantees, Redlock's five-step majority quorum, the Martin Kleppmann vs antirez safety debate, and a decision tree for choosing between single-instance Redis, Redlock, ZooKeeper, or etcd.
This article analyzes Redis cache consistency through three real incidents, compares four read-write patterns, explains why update-DB-then-delete-cache (Cache-Aside) is optimal, details delayed double delete, binlog subscription fallback, versioning, monitoring, and a decision tree for choosing consistency levels.
This article dissects Redis cache penetration, breakdown, and avalanche as three forms of cache-miss storms, detailing layered defenses — Bloom filters for penetration, mutex locks and logical expiration for breakdown, TTL jittering plus multi-level caching and rate limiting for avalanche — with implementation code, capacity formulas, and production checklists.
This article dissects Open WebUI's architecture, tracing a knowledge-base Q&A flow from file upload and vector indexing through model routing, RAG retrieval, tool calling, and streaming response delivery via Socket.IO, asyncio, and Redis for multi-instance coordination and disconnection recovery.
This article analyzes Redis expiration deletion and memory eviction mechanisms, detailing eight eviction policies, their trade-offs, three production incidents, source code walkthroughs of lazy/active expiration and LFU/LRU approximations, and practical configuration guidelines for avoiding common pitfalls.
This article dissects Redis master-slave replication and Sentinel failover through three real incidents, explaining the replid/offset/backlog trio for incremental sync, async replication trade-offs, Sentinel's quorum/majority election, brain-split risks, and production configuration formulas for backlog sizing and replication storm mitigation.
This article analyzes Redis's internal object encodings (SDS, listpack, skiplist, hashtable, intset, quicklist), their automatic conversion thresholds, memory overhead calculations, and practical pitfalls like silent encoding upgrades that quadruple memory usage, providing a framework for choosing data structures and diagnosing production issues.
This article explains why Redis is fast through four core factors—memory storage, single-threaded command execution, I/O multiplexing, and optimized data structures—illustrated with three real production incidents, source code walkthroughs of key components like SDS and incremental rehashing, and practical guidelines for avoiding common pitfalls such as big keys, hot keys, and misconfigured eviction policies.
A structured Java backend interview preparation guide covering core Java, MySQL, Spring ecosystem, Redis, message queues, microservices basics, deployment, and project practice with flexible 30-day, 8-week, and 12-week schedules for campus recruitment candidates.
This article details a production-grade Spring Boot 3 online exam system covering domain modeling, constraint-based paper assembly algorithms, anti-cheating measures with behavior logging and risk scoring, auto-grading strategies for objective and subjective questions, high-concurrency handling for exam start/submit, and score analysis with streaming exports.
This article demonstrates how to implement API rate limiting in Spring Boot using Redis for request counting and a custom @RequestLimit annotation with an interceptor to enforce limits per user session, including complete code examples for the annotation, interceptor, configuration, and controller usage.
This article explains why token authentication alone is insufficient for open APIs and details a three-layer defense using HMAC-SHA256 signatures, timestamps, and nonces to prevent tampering, long-term replay, and short-term replay attacks, with Java implementation examples.
This comprehensive guide analyzes Redis memory growth causes, details all eight eviction policies with their trade-offs, and provides battle-tested techniques for discovering and safely removing large keys without blocking the instance, backed by a real-world case study of a 1.3GB Hash with 1.2M fields.
This article analyzes distributed locking in Spring Boot using Redis and Redisson, covering atomic locking with SET NX EX, watchdog lease renewal, reentrant Hash-based design, pub/sub wait notification, the RedLock algorithm debate including Martin Kleppmann's GC pause and clock jump critiques, and production pitfalls with annotation-based AOP encapsulation.
This tutorial demonstrates how to implement automatic idempotency in Spring Boot using Redis, a custom @AutoIdempotent annotation, token-based validation, and a HandlerInterceptor to prevent duplicate submissions in high-volume APIs.
This article provides a complete Java implementation of SMS one-click login using Spring Boot 3, Redis, and JWT, covering business flow, configuration, Redis key design, core service code with rate limiting, blacklist, daily limits, one-time verification codes, login verification with JWT issuance, controller endpoints, production security optimizations including Lua atomic scripts, graphical captcha, channel fallback, risk control, and compliance, plus extension directions like carrier authentication and anomaly detection.
This tutorial demonstrates how to implement Redis cache preheating in Spring Boot using an abstract cache class, ApplicationContextAware utility, and CommandLineRunner to automatically load hot data on startup, with a complete NewsCache example using RedisTemplate.
This article details a production-grade risk control engine built with Spring Boot 3 and Java 17, covering five-layer architecture, DSL-based rule modeling with decision tables, Bloom-filter-accelerated list services, sliding-window real-time feature computation via Redis+Lua, timeout-aware orchestration with tiered degradation, and full decision traceability for audit and tuning.
This article details a three-tier semantic chunking approach for RAG systems using LangChain4j: recursive punctuation-based splitting, tokenizer-aware overlapping windows, and parent-child document mapping with Redis and Qdrant to balance retrieval precision and context completeness.
This article explains why cache inconsistency occurs between MySQL and Redis, then analyzes four update patterns—delete-then-update, update-then-invalidate, read/write-through, and write-behind—detailing their execution flows, consistency guarantees, and trade-offs to help choose the best fit for your scenario.
This article details a session-centric Java architecture for multi-device login, covering device session creation, JWT with session IDs, single-device logout, admin forced logout, per-device-type concurrency control using Redis atomic operations, login limits with LRU eviction, device ID generation, refresh token binding, and security considerations for immediate token revocation.
This article shares real-world Redis governance practices covering big key detection via SCAN sampling and RDB analysis, hot key detection using client-side sliding windows, memory fragmentation and eviction strategies, slow query and connection pool tuning, cluster scaling with redis-cli, and building an automated governance platform with scheduled inspections and alerting.
A comprehensive guide to API idempotency covering concept clarification, six sources of duplicate requests, a golden formula (unique key + deduplication storage + atomic operation), four-layer defense architecture, eight implementation patterns with code examples, common pitfalls with solutions, and interview preparation questions.
This article provides a complete Java implementation of SMS one-click login using Spring Boot 3, Redis, and JWT, covering business flow, configuration, Redis key design, code for verification code generation, rate limiting, blacklist, and login validation, plus production security optimizations like Lua scripts, CAPTCHA, channel fallback, and compliance.
This article details the architecture and implementation of a WebRTC signaling service using Spring Boot 3.2 and WebFlux, covering protocol design, room state management, media server integration, recording callbacks, horizontal scaling strategies, and fault tolerance for real-time audio/video applications.
This article demonstrates how to implement Redis cache warming in Spring Boot using an abstract cache class, ApplicationContextAware utility, and CommandLineRunner to preload hot data at startup, with a concrete NewsCache example showing RedisTemplate integration and automatic cache reload on expiration.
This article details the evolution of a unified login system covering phone-based registration, third-party OAuth integration, a normalized database schema separating user profiles from authentication methods, and carrier-based one-click login that reduces authentication time from 20 seconds to 2 seconds.
This article explains how JD-hotkey detects hot keys in milliseconds using a lightweight worker cluster, pushes them to application JVM caches via Caffeine, and reduces Redis read pressure by over 50% during high-concurrency events like flash sales.
This article explains cache preheating concepts and demonstrates a complete Spring Boot implementation using an abstract cache class, ApplicationContext utility, CommandLineRunner for startup loading, and a concrete NewsCache example with RedisTemplate to load hot data at startup, reducing cache penetration and database load.
This article explains how to implement pagination using Redis Sorted Sets (ZSet) and multi-condition fuzzy queries using Hash with HSCAN, then combines both by caching filtered results in pattern-keyed ZSets for efficient paginated retrieval, including TTL-based expiration and data freshness strategies.
This tutorial demonstrates setting up Redis on Windows, configuring a Maven project with Jedis 4.1.1, building a connection pool utility, and providing JUnit test examples for operating Redis Strings, Lists, Hashes, Sets, and Sorted Sets with Jedis API.
The article explains how Redis distributed locks with TTL leases fail to prevent stale writes when a garbage collection pause delays a lock holder past its lease expiry, allowing a new holder to write fresh data that the original holder then overwrites upon resuming; it demonstrates why fencing tokens — incrementing sequence numbers issued atomically with lock grants and checked atomically at the storage layer via conditional updates — are necessary to reject obsolete writes.
A developer shares their successful China Merchants Bank Java backend interview experience, detailing 20 technical questions covering HashMap, ConcurrentHashMap, synchronization, thread pools, Redis cache penetration, MySQL indexing, Spring Boot auto-configuration, Agent memory, RAG, multi-agent orchestration, and more, with answers and preparation tips.
This article analyzes why MongoDB adoption lags behind Redis in China, citing MongoDB's ambiguous positioning between cache and database, operational complexity, weak JOIN support, sharding difficulties, lack of SQL compatibility, and a scarcity of specialized DBAs as key factors.
This article demonstrates building an elegant API rate limiter in Spring Boot using interceptors and Redis, evolving from a basic fixed-window implementation to a flexible annotation-driven design supporting per-endpoint limits, class-level defaults, and solutions for path parameters and sliding window logic.
This article presents five case analysis questions from the May 2026 System Architecture Designer exam, covering time-series databases, MQTT QoS levels, concurrency control strategies, knowledge graph construction, and pipe-filter architecture for intrusion detection, with detailed reference answers for each scenario.
This tutorial demonstrates implementing login attempt limiting using Spring Boot, Redis, and Lua scripts to block IP addresses after three failed password attempts, with automatic lockout expiration.
This guide details a systematic approach to diagnose and resolve Redis high memory usage, covering memory composition analysis, big key detection via SCAN and MEMORY USAGE, root cause identification through TTL and access patterns, safe deletion using UNLINK and batched HDEL, and long-term governance via TTL jitter, index sharding, and monitoring alerts.
This comic-style guide follows an HTTP request's complete journey through DNS resolution, TCP/TLS handshakes, Socket connections, Nginx reverse proxy, gRPC service calls, Redis caching, MySQL queries, and connection pools, revealing how each layer contributes to latency and why observability matters.
This tutorial demonstrates configuring Spring Data RedisTemplate using pure Java annotations, covering Maven dependencies, connection pooling, serialization, and CRUD operations for String, List, Hash, Set, and Sorted Set data types with complete code examples.
This article compares Redis, Caffeine, and Ehcache for Spring Boot 3.5.0, explaining each cache's architecture, ideal use cases, configuration patterns with code examples, and trade-offs between in-process speed and distributed consistency, plus guidance on multi-level caching with JetCache.
Rails 8 replaces Redis with database-backed SolidQueue, SolidCache, and SolidCable, leveraging PostgreSQL's SKIP LOCKED for efficient task queues and arguing that most applications overpay a hidden 'middleware tax' for specialized infrastructure they don't actually need.
This article provides a comprehensive visual guide to Redis architecture, covering single-instance deployment, high-availability setups with Sentinel, Redis Cluster sharding with hash slots, replication mechanics using replication IDs and offsets, and persistence models including RDB snapshots, AOF logging, and the fork/copy-on-write mechanism.
This article details seven common pitfalls in Redis distributed locking, covering atomic acquisition, ownership verification, lease expiration, watchdog limitations, replication risks, Redlock assumptions, and the need for fencing tokens, with code examples and comparisons to ZooKeeper and etcd.
This article details a production-grade five-layer architecture for high-concurrency flash sale systems, covering traffic shaping via message queues, multi-level rate limiting, three-tier overselling prevention using Redis atomic operations and database optimistic locking, and solutions for cache penetration, breakdown, and avalanche, plus nine common failure scenarios and a troubleshooting SOP.
This article walks through designing a production-grade Redis-backed distributed session system, covering why single-node sessions fail under load balancing, secure token generation with SecureRandom, dual-index Redis storage using Hash and Set with Lua atomic writes, sliding vs absolute expiration, multi-device login limits, and complete login/logout/kick-out implementation with Redisson.
This article analyzes four concurrency control patterns — conditional updates, pessimistic locking, optimistic locking with version numbers, and distributed locks — using inventory deduction, order editing, and third-party push examples. It explains when each pattern applies, how to combine them with idempotency, and provides concrete SQL and Redis implementations.
This article dissects 10 high-frequency system design questions — seckill, short URL, distributed ID, delayed tasks, leaderboard, real-time push, short-video feed, sharding, rate limiting, and config center — with architecture diagrams, core code, and comparative solutions for each.
Redis 8.0 introduces native vector search with Vector Set data type, HNSW indexing, quantization, and the Iris platform for agent memory and context retrieval, enabling semantic caching that cuts LLM costs by 70% and integrates with LangChain4j and Spring AI.
The article argues that creators of foundational software like Linux, Python, Redis, Nginx, and SQLite are true geniuses due to their exceptional abstraction skills and system-level boundary control, illustrated by real-world cases where their minimal, convergent designs outperform modern complex solutions, and warns that over-reliance on AI tools erodes deep system understanding essential for solving hard production issues.
This article details a complete disk I/O alert investigation in production, covering core concepts like IOPS vs throughput, iostat/iotop analysis, and five real-world cases including MySQL missing indexes, log misconfiguration, backup conflicts, Redis persistence, and filesystem mount options, providing a reusable troubleshooting methodology.
This article details a distributed Redis-based solution for enforcing multiple rate-limiting rules simultaneously (e.g., 10 requests per minute and 20 per two minutes) while preventing duplicate submissions, using Zset data structures, Lua scripts for atomicity, and Spring AOP annotations.
This article details the evolution of a Spring Boot daily sign-in system from 10K to 100M users, covering Redis bitmap sharding, Lua atomic operations, command outbox pattern, Kafka async reward processing, idempotency guarantees, fault tolerance strategies, and production-grade observability with real incident postmortems.
This article details eight high-frequency Redis production faults—cache penetration, breakdown, avalanche, big keys, hot keys, connection exhaustion, memory OOM, and consistency issues—providing symptoms, root causes, troubleshooting commands, solutions, and a universal SOP for rapid diagnosis and resolution.
This article details a production-ready QR code login implementation using Spring Boot, covering state machine design with Redis and Lua for atomic transitions, SSE for low-latency status push with polling fallback, HMAC-SHA256 with nonce for replay protection, and Redis Pub/Sub for cross-instance consistency in clustered deployments.
The article demonstrates why distributed locks alone fail to guarantee idempotency in Spring Boot order APIs, and presents a three-layer solution combining Idempotency-Key with request fingerprinting, Redis SET NX for fast duplicate interception, and a database unique constraint as the ultimate safeguard against duplicate orders even after crashes or Redis failures.
This guide walks through configuring a Redis vector database with Spring AI, adding the vector store advisor for retrieval-augmented generation, ingesting documents via ETL pipelines, and testing the RAG flow with a sample conversation.
After an external system hammered a Spring Boot search endpoint causing database connection exhaustion, the author builds a distributed fixed-window rate limiter using Redis and Lua for atomicity, wraps it with an annotation-driven AOP aspect supporting user, IP, API key, and global dimensions, returns proper HTTP 429 with Retry-After, discusses fixed-window limitations versus token bucket and sliding window, and covers fail-open/fail-closed strategies for Redis outages plus monitoring metrics.
This article explains five practical solutions to prevent API replay attacks, including unique nonces with Redis storage, timestamp validation, combined signature-timestamp-nonce schemes, backend-issued one-time tokens, and business-level idempotency keys for critical operations like payments.
This tutorial walks through email protocols, third-party SMTP setup for Feishu and QQ, Spring Boot mail starter configuration, core JavaMailSender/MimeMessage/MimeMessageHelper relationships, and a complete email verification code implementation using Redis for storage and Thymeleaf for HTML templates.
This article explains how to implement Single Sign-On (SSO) using CAS to unify authentication across multiple company systems, covering session mechanics, cluster session sharing with Redis, and providing complete Spring Boot code examples for both the CAS server and client applications.
A distributed Redis lock collision returns a default success response with null data, causing client-side NullPointerException when unpacking; the article analyzes the root cause, shows the flawed code, and provides fixes for both server and client sides.
Zhihui Cloud Redis introduces ACL-based multi-account management on Valkey 7.2+, enabling independent credentials, read-write or read-only roles per business, and isolated password rotation while retaining the default account for backward compatibility.
This article details integrating Sa-Token 1.37.0 with Spring Boot 2.7.x and Redis 6.x for authentication, covering dependency setup, configuration, login implementation, dynamic permission via StpInterface, API replay protection using nonce/timestamp/signature, cluster deployment, comparison with Spring Security+JWT, and production pitfalls.
This article explains four approaches to implementing distributed locks with Redis: basic SETNX with expiration, atomic Lua scripts for lock acquire/release, the Redisson Java client with watchdog renewal, and the Redlock algorithm for high-availability multi-master deployments.
This article analyzes why Sa-Token has surpassed 46K GitHub stars by comparing its Core-Plugin-Adapter architecture, zero-config startup, and one-line authentication API against Spring Security's steep learning curve, demonstrating how it reduces permission system implementation from weeks to days.
WeChat avoids server crashes during midnight step-count resets for 1 billion users by using logical time-based versioning instead of physical updates, a custom PaxosStore for atomic increments, delayed double-write buffers for clock skew, Redis ZSet sharding for rankings, and asynchronous cold-data archival during low-traffic hours.
This comprehensive guide details a systematic approach to diagnosing and resolving high Redis client connection counts, covering connection models, configuration tuning, CLI analysis commands, application-level connection pool fixes, temporary mitigation tactics, and long-term monitoring best practices with real-world case examples.
This article compares four Redis deployment modes—standalone, master-slave replication, sentinel, and cluster—detailing their architectures, pros, cons, and ideal use cases to help developers choose the best option for scalability and high availability.
The article walks through a complete Spring Boot implementation of WeChat‑like message recall, explaining why a simple DELETE is insufficient and detailing how to use a status flag, conditional UPDATE, WebSocket, Redis/MQ, and multi‑device session management to synchronize recall across all clients, even under concurrency and offline scenarios.
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.
The article demonstrates how STAROps' full-stack correlation combined with Yaochi Agent's deep database diagnosis enables cross-layer root cause analysis across three real incidents: an RDS missing index, a Redis Lua script blocking the single thread, and an EVAL command causing CPU saturation, showing command-level diagnostic precision.
The article explains how the old pattern of GET‑ing an entire JSON string from Redis, deserializing it in Java, modifying a single field and writing it back is inefficient and error‑prone, and shows how Spring Data Redis 4.2’s RedisJsonTemplate lets you update or read individual JSON paths directly, reducing code, network traffic and race‑condition risks.
This article details a production-grade solution for deduplicating 10 billion order numbers using a sharded Redis Bloom filter with database fallback, covering parameter calculations, cold-start loading, scaling strategies, consistency guarantees, and interview-focused comparisons with offline batch and real-time stream approaches.
The article demonstrates how STAROps full‑stack correlation combined with the Yaoci Agent’s deep database diagnostics can turn a frontend latency alert into a precise root‑cause finding—such as a missing index in RDS or a Lua script blocking Redis—through three real‑world L3 to L4 case studies.
This article analyzes Redis 8's new AI capabilities including vector search with HNSW and int8 quantization, the native Vector Sets data type, LangCache semantic caching for LLM cost reduction, and the Iris real-time context engine for agent memory, with code examples and a comparison of when to use each feature.
This article explores CosId's two ID generation modes—local computation (Snowflake) and segment allocation (SegmentId, SegmentChainId)—with detailed configuration for JDBC, Redis, ZooKeeper, MongoDB, and Proxy backends, plus Spring Boot, MyBatis, and ShardingSphere integration examples.