当前位置:网站首页>Redis cache hit rate
Redis cache hit rate
2022-04-22 16:03:00 【a10534126】
What are the factors that affect the cache hit rate
Update strategy
The smaller the granularity of the cache , Low update frequency , The higher the percentage of hits .
Give a practical example to illustrate : When caching a single object ( For example, single user information ), Only when the data corresponding to the object changes , You need to update or remove the cache .
And when you cache a collection ( For example, all user data ), When the data corresponding to any of these objects changes , Need to update or remove the cache .
Clear strategy
For a continuously running server , The server needs to check and organize its resources and status regularly , Clean up useless cache , The proportion of garbage is also a factor affecting the hit rate of cache .
The three removal strategies are as follows :
(1) Clean up immediately . When setting the expiration time of the key , Create a callback event , When the expiration time reaches , Key deletion is performed automatically by the time processor .
(2) Inert cleaning . The key is out of date , No matter . When reading / Write an expired key when , Will trigger lazy delete policy , Delete this expiration directly key
(3) Regular clearance . Every once in a while , Yes expires Dictionary check , Delete the expiration key inside .
Business scenario
Cache fit “ Read more and write less ” Business scenario of , On the contrary, using cache makes little sense , The hit rate will be very low .
The longer the cache time is , The lower the timeliness requirement , The more suitable for caching .
Cache capacity
The capacity of the cache is limited , It is easy to cause cache invalidation and elimination .
Cache failure
Cache node failure , It will also cause cache invalidation , A typical practice in the industry is through consistency Hash Algorithm , Or use node redundancy .
redis How is the cache hit rate calculated
/home/pubsrv/redis-2.8.12/src/redis-cli -p 6379 -h 192.168.11.13 -a ZTZmZDc4ODAwMjMx
192.168.11.14:6379> info

cache hit rate =keyspace_hits / (keyspace_hits + keyspace_misses)
版权声明
本文为[a10534126]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204221556281717.html
边栏推荐
猜你喜欢
随机推荐
牛客SQL刷题记录
Is the account of digging money safe? How to handle it?
Send custom fields using Tencent cloud custom alarm SMS interface
引入文件路径问题-$_SERVER[‘DOCUMENT_ROOT‘]代表网站根目录
4.21 summary
关键字精确匹配的优缺点
Frequently asked questions about recent BSN development
citespace安装和使用教程
This API hub is powerful. It contains open APIs such as nailing enterprise wechat, and can be debugged directly!
Shiro自定义缓存,扩展Shiro缓存模块,只需要配置缓存即可实现Session共享
Redis operation tool class based on jedis
selenium之预期条件判断方法
selenium之键盘操作
Eltable style modification. Parent child components pass values. Fuzzy query
Use js to complete the text and move it on the screen according to the numbers in the input box
Radio button selected
Altium designer 生成PCB制作文件及打样流程(以嘉立创商城为例)
华为交换机配置
如何使用网页在线打开.Xmind文件(思维导图文件)和建模文件(.SLDPRT文件和.SLDASM文件)
JSP echo



![[binary number] same tree](/img/5d/48bf7a987eeb45d0a1cbf836e3b1e7.png)



