当前位置:网站首页>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
边栏推荐
- Using JS to realize a thousandth bit
- Kettle experiment conversion case
- Kettle experiment
- Pre parsing of JS
- 小女孩行走
- STM32 and FreeRTOS stack parsing
- #yyds干货盘点#ubuntu18.0.4安装mysql并解决ERROR 1698: Access denied for user ''root''@''localhost''
- Installation of data cleaning ETL tool kettle
- npm ERR! network
- DMP engine work summary (2021, lightsaber)
猜你喜欢
![[reading notes] Chapter 5 conditional statements, circular statements and block statements of Verilog digital system design tutorial (with answers to thinking questions)](/img/a2/b50fadad859a050eecfa15a436e126.png)
[reading notes] Chapter 5 conditional statements, circular statements and block statements of Verilog digital system design tutorial (with answers to thinking questions)

AI上推荐 之 MMOE(多任务yyds)

Leetcode0587. Install fence

Canary publishing using ingress

Machine learning (VI) -- Bayesian classifier

Redis 异常 read error on connection 解决方案

阿里云架构师解读四大主流游戏架构

Kernel PWN learning (3) -- ret2user & kernel ROP & qwb2018 core

A must see wechat applet development guide 1 - basic knowledge

What is monitoring intelligent playback and how to use intelligent playback to query video recording
随机推荐
Leetcode0587. Install fence
Kettle实验 (三)
Cloud computing competition -- basic part of 2020 competition [task 3]
653. Sum of two IV - input BST
Emuelec compilation summary
JS case to find the maximum value, reverse the array, bubble sort
Learn FPGA (from Verilog to HLS)
小女孩行走
Kettle experiment
NLLLoss+log_ SoftMax=CE_ Loss
[SQL Server fast track] view and cursor of database
Leetcode question bank 78 Subset (recursive C implementation)
AI上推荐 之 MMOE(多任务yyds)
Flink 流批一体在小米的实践
Get trustedinstaller permission
SAP 101K 411K 库存变化
501. Mode in binary search tree
MySQL - Chapter 1 (data type 2)
npm ERR! network
MySQL of database -- overview and installation