A production-ready generic utility class for RocketMQ consumer message idempotent deduplication, with no additional configuration overhead beyond basic setup. Core Capabilities Supports using Redis or MySQL as the idempotent record storage layer Flexible deduplication key options: use business prima...
Defining Memory FragmentationWhen Redis deallocates memory, the freed space is not immediately returned to the operating system. Instead, it remains under the control of the underlying memory allocator. A critical issue arises when these released blocks are non-contiguous. While technically free, th...
In 2018, live quiz shows like Wang Sicong's "Chongding Dahui," Xigua Video's "Million Heroes," and Inke's "Cheese Superman" became wildly popular. An e-commerce company I worked for joined this trend, and the tech team developed a live quiz feature. After a quiz ended,...
Establishing a Redis Connection Pool To efficiently manage connections to a Redis server, it's best practice to use a connection pool. This avoids the overhead of establishing a new connection for every request. import redis # Define the Redis connection pool configuration redis_pool = redis.Connect...
Redis Deployment Options When deploying Redis, several common approaches are available: Approach Advantages Disadvantages Single Server Simple deployment, only one server required Service unavailable if the server fails Sentinel Mode Can continue service when less than half of nodes are unreachable...
Redis Cleints in Java In Java applications, interacting with Redis requires a Redis client library, similar to using JDBC for MySQL operations. Several reliable Java clients are available: Jedis Lettuce Spring Data Redis Spring provides comprehensive integration through Spring Data Redis, and Spring...
Prepare all nodes in the cluster by installing build dependencies and extracting the Redis source distribution: yum install -y gcc make tcl curl -fsSL https://download.redis.io/releases/redis-7.0.12.tar.gz -o /usr/src/redis.tar.gz tar -xzf /usr/src/redis.tar.gz -C /usr/src/ cd /usr/src/redis-7.0.12...
Redis achieves exceptional speed by keeping the entire dataset in memory. To prevent data loss during restarts, crashes, or power failures, it provides two persistence strategies: RDB (Redis Database) snapshots and AOF (Append Only File) logs. RDB Persistence RDB acts as the default persistence mech...
Overview Manual master-slave failover requires human entervention—stop the application, reconfigure a slave, update configuration files, and restart. This process is time-consuming and introduces service downtime. Redis Sentinel, introduced in version 2.8, provides an automated solution for this pro...
Distributed Database Fundamentals Distributed databases address three critical requirements: Scalability: When data volume or read/write load exceeds a single machine's capacity, load must be distributed across multiple nodes. This horizontal scaling approach handles increased demand by adding more...