当前位置: 首页 > news >正文

商业网站设计方案模板app拉新推广平台有哪些

商业网站设计方案模板,app拉新推广平台有哪些,庆阳网站设计公司,wordpress界面英文版这里要讨论的为过期的数据是如何被清除的,也就是网上常常讨论的过期清除策略。 需要注意的是,redis除了会对过期的数据进行淘汰,也可以通过对内存大小进行限制,并对超出内存限制后进行数据淘汰。此时淘汰的数据未必是过期的&…

这里要讨论的为过期的数据是如何被清除的,也就是网上常常讨论的过期清除策略。

需要注意的是,redis除了会对过期的数据进行淘汰,也可以通过对内存大小进行限制,并对超出内存限制后进行数据淘汰。此时淘汰的数据未必是过期的,只是因为内存达到限制而被淘汰。需要注意一下两者的区别,数据淘汰算法包括LRU、LFU等。

好,回归过期数据清除策略这里。redis的数据清除策略包括2种。惰性清除和定期清除。

惰性清除很简单,redis会在用户访问数据时,如果发现数据是过期的,那么就删除这个数据,并且给用户返回相应的结果。那么redis是如何发现这个数据是过期的呢?我们知道redis默认有16个库,0~15号库,每一个库对应源码中的一个db结构体,db中有一个dict类型成员变量expire,dict,即字典,也就是哈希表,是redis底层数据结构中的一种,expire哈希表中存储的键值对,key为键,value为其对应的过期时间,expire中存储了该库中所有键的过期时间。

那么定期清除呢?我们先贴上一段redis配置文件中的文字。

# Redis reclaims expired keys in two ways: upon access when those keys are
# found to be expired, and also in background, in what is called the
# "active expire key". The key space is slowly and interactively scanned
# looking for expired keys to reclaim, so that it is possible to free memory
# of keys that are expired and will never be accessed again in a short time.
#
(redis通过2种方法清除过期键:在操作时发现这些key是过期的,还有也是通过后台清除的,被称作'定期清除key'。key空间被缓慢的、交互式的清除过期键,所以它可能会清除过期的key来释放内存,并且短时间不会被再次访问)# The default effort of the expire cycle will try to avoid having more than
# ten percent of expired keys still in memory, and will try to avoid consuming
# more than 25% of total memory and to add latency to the system. However
# it is possible to increase the expire "effort" that is normally set to
# "1", to a greater value, up to the value "10". At its maximum value the
# system will use more CPU, longer cycles (and technically may introduce
# more latency), and will tolerate less already expired keys still present
# in the system. It's a tradeoff between memory, CPU and latency.
#
(清除循环作为一种默认的尝试,会尝试避免在内存中存在超过10%的过期Key,并且避免(过期key占用的内存)超过总内存的25%,最终将内存归还系统。它可以增加这种清除的尝试,通常它会被设置为1,到一个更大的值,最大可以达到10。它的最大值意味着系统会使用更的的cpu资源,更久的循环时间(理论上可能会导致延迟),并且容忍更少的现在存在于系统中的过期的key。它是一种在内存、CPU、延迟之间的一种平衡和折衷)
# active-expire-effort 1

也就是说redis定期清除会主动的进行清除。active-expire-effort控制了每次循环的时间有多长。清除达标的条件为避免在内存中存在超过10%的过期Key,并且避免(过期key占用的内存)超过总内存的25%。不达标的话会继续循环清除,直到达标为止。

另外一个参数hz控制了诸如清除循环、关闭超时客户端等后台任务的频率。综合控制了定期清除的行为。
hz相关注释如下:

# Redis calls an internal function to perform many background tasks, like
# closing connections of clients in timeout, purging expired keys that are
# never requested, and so forth.
#
# Not all tasks are performed with the same frequency, but Redis checks for
# tasks to perform according to the specified "hz" value.
#
# By default "hz" is set to 10. Raising the value will use more CPU when
# Redis is idle, but at the same time will make Redis more responsive when
# there are many keys expiring at the same time, and timeouts may be
# handled with more precision.
#
# The range is between 1 and 500, however a value over 100 is usually not
# a good idea. Most users should use the default of 10 and raise this up to
# 100 only in environments where very low latency is required.
hz 10

参考文章:
[1],Redis(6)删除策略(定时删除、惰性删除、定期删除)和数据逐出策略

http://www.yidumall.com/news/22437.html

相关文章:

  • 住房及城乡建设部网站九大员湖北网络推广
  • 做个素材网网站难做吗想做网络推广如何去做
  • 网站上传视频怎么做百度收录批量查询
  • 网站备案信息查询网络营销策划推广方案
  • 制作网页难吗seo官网优化怎么做
  • 汽车便宜网站建设外链吧怎么使用
  • 个人能建什么样的网站竞价推广托管
  • joomla 网站建设教程重庆关键词自动排名
  • 室内设计素材网站推荐it培训机构推荐
  • 上海中学初中部网站优化策略
  • 无锡做网站哪家好企业软文
  • 南通网站建设制作北京网站建设专业公司
  • 如何找网站曹操论坛seo
  • 西安做商铺的网站青岛seo关键字排名
  • 企业网站的优化方案百度搜索
  • 网站英文联系我们国内搜索引擎
  • 自己公司做公益网站怎么弄百度推广投诉电话
  • 怎么用挂靠的公司做网站seo专员工资一般多少
  • wordpress 评论接口佛山旺道seo
  • 大型电子商务网站建设方案小吃培训机构排名前十
  • 建设银行网站认证app广告联盟
  • iis7网站建设短视频精准获客
  • 巩义专业网站建设价格最受欢迎的十大培训课程
  • 广州微信网站建设费用怎么给网站做优化
  • 用axure怎么做h5网站新东方烹饪培训学校
  • dw网站指向邮箱超链接怎么做网络推广外包流程
  • 仿制网站建设宁波网络推广
  • 山东网络公司排名宁波关键词优化平台
  • 自己用电脑做虚拟机怎么建网站百度指数查询平台
  • 外贸网站建设公司流程图互联网推广渠道有哪些