当前位置:网站首页>Redis expired key cleaning and deletion policy summary
Redis expired key cleaning and deletion policy summary
2022-04-23 09:32:00 【Notes of Pan Guangyu de Xiaobai】
Redis The bottom layer uses three strategies to clean up expired key
One 、 Passive cleaning
The trigger condition : read / Write an expired key
When reading and writing a key when ,Redis First check key Whether there is , If it exists and has expired , Delete key Back at the same time nil To the client
Two 、 Regular clearance
The trigger condition :Redis Regular inspection
redis Cleaning up expired items will be performed regularly key The task of , The operating frequency is determined by redis.conf Medium hz Parameter determination , Value range 1~500, The default is 10, Run per second 10 Time .
The cleaning process is as follows :
1) Traverse all db
2) from db With the expiration time set in key Random check in the set of 20 individual key
3) Delete all expired items found in the check key
4) If the inspection result is 25% The above key Has expired , Then continue to repeat step 2-3, Otherwise, continue to traverse the next db
turn up hz Will improve redis The frequency with which periodic tasks are performed , If redis Contains many expired key Words , Consider increasing this value , But note that it will also increase CPU The pressure of the ,redis The author suggests that this value should not exceed 100.
3、 ... and 、 Mandatory deletion
The trigger condition :Redis Use memory to maxmemory Configuration of , And then according to maxmemory-policy To clean up expired key
Concrete maxmemory-policy Please refer to my previous articles :Redis LRU Cache recovery mechanism _ Pan Guangyu de Xiaobai's blog -CSDN Blog
The cleaning process is blocked , It won't stop until enough memory space is cleared
Reference resources :
版权声明
本文为[Notes of Pan Guangyu de Xiaobai]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230929494074.html
边栏推荐
- 108. Convert an ordered array into a binary search tree
- Secrets in buffctf file 1
- 3、 6 [Verilog HDL] gate level modeling of basic knowledge
- [Luke V0] verification environment 2 - Verification Environment components
- LeetCode 1611. The minimum number of operations to make an integer 0
- Number theory to find the sum of factors of a ^ B (A and B are 1e12 levels)
- Cloud computing competition -- basic part of 2020 competition [task 3]
- ASUS laptop can't read USB and surf the Internet after reinstalling the system
- 1 + X cloud computing intermediate -- script construction, read-write separation
- 高薪程序员&面试题精讲系列91之Limit 20000加载很慢怎么解决?如何定位慢SQL?
猜你喜欢
Kettle experiment conversion case
Redis 内存占满导致的 Setnx 命令执行失败
Canary publishing using ingress
SAP CR transmission request sequence and dependency check
Go language learning notes - exception handling | go language from scratch
Kernel PWN learning (3) -- ret2user & kernel ROP & qwb2018 core
Emuelec compilation summary
Go language learning notes - slice, map | go language from scratch
High paid programmer & interview question series 91 limit 20000 loading is very slow. How to solve it? How to locate slow SQL?
To remember the composition ~ the pre order traversal of binary tree
随机推荐
Employee probation application (Luzhou Laojiao)
Three ways to create objects in JS
MySQL of database -- Fundamentals
Kernel PWN learning (4) -- double fetch & 0ctf2018 baby
[SQL Server fast track] view and cursor of database
Enter "net start MySQL" and "system error 5. Access denied" appears. Detailed explanation of the problem
Three challenges that a successful Devops leader should be aware of
Cloud computing competition -- basic part of 2020 competition [task 3]
web页面如何渲染
数据清洗 ETL 工具Kettle的安装
[reading notes] Chapter 5 conditional statements, circular statements and block statements of Verilog digital system design tutorial (with answers to thinking questions)
Alibaba cloud architects interpret the four mainstream game architectures
Summary of common concepts and problems of linear algebra in postgraduate entrance examination
To remember the composition ~ the pre order traversal of binary tree
Creation of raid0 and RAID5 and Simulation of how RAID5 works
JS case to find the maximum value, reverse the array, bubble sort
Two declaration methods of functions of JS
ALV树(LL LR RL RR)插入删除
Program, process, thread; Memory structure diagram; Thread creation and startup; Common methods of thread
员工试用期转正申请书(泸州老窖)