Squid中refresh_pattern选项的理解
来源:互联网 发布:java xml文件解析 编辑:程序博客网 时间:2024/05/16 06:09
转自:http://cache.qihoo.com/wenda.php?do=snap&m=e6d3376e96ba116144532d19c8fefd8f&surl=http%3A%2F%2Fwww.yeqiangwei.com%2Fclub%2Ff10b0l0fp1t350397p1.html&act=fetchHtmlsnap&kw=
想研究squid的话推荐《squid中文权威指南》,感觉很不错的一本书
refresh_pattern的作用:
用于确定一个页面进入cache后,它在cache中停留的时间。
语法:
refresh_pattern [-i] regexp min percent max [options]
几个概念:
resource age =对象进入cache的时间-对象的last_modified
response age =当前时间-对象进入cache的时间
LM-factor=(response age)/(resource age)
举个例子,这里只考虑percent, 不考虑min 和 max
例如:refresh_pattern 20%
假设源服务器上www.aaa.com/index.htm -----lastmodified 是 2007-04-10 02:00:00
squid上 proxy.aaa.com/index.htm index.htm进入cache的时间 2007-04-10 03:00:00
1)如果当前时间 2007-04-10 03:00:00
resource age =3点-2点=60分钟
response age =0分钟
index.htm还可以在cache停留的时间(resource age)*20%=12分钟
也就是说,index.htm进入cache后,可以停留12分钟,才被重新确认。
2)如果当前时间 2007-04-10 03:05:00
resource age =3点-2点=60分钟
response age =5分钟
index.htm还可以在cache停留的时间(resource age)*20%=12分钟-5=7
LM-factor=5/60=8.3%<20%
一直到2007-04-10 03:12:00 LM-factor=12/60=20% 之后,cache中的页面index.htm终于stale。
如果这时没有index.htm的请求,index.htm会一直在缓存中,如果有index.htm请求,squid收到该请求后,由于已经过期,
squid会向源服务器发一个index.htm是否有改变的请求,源服务器收到后,如果index.htm没有更新,squid就不用更新缓存,直接把
缓存的内容放回给客户端,同时,重置对象进入cache的时间为与源服务器确认的时间,比如2007-04-10
03:13:00,如果正好在这个后重新确认了页面。重置后,resource age变长,相应在cache中存活的时间也变长。
如果有改变则把最新的index.htm返回给squid,squid收到会更新缓存,然后把新的index.htm返回给客户端,同时根据新页面中的Last_Modified和取页面的时间,重新计算resource age,进一步计算出存活时间。
实际上,一个页面进入cache后,他的存活时间就确定了,即 (resource age) * 百分比,一直到被重新确认。
理解了百分比后,min max就好理解了
squid收到一个页面请求时:
1、计算出response age,
2、如果response age<min 则 fresh 如果response age>max 则 stale
3、如果response age在之间,如果response时间<存活时间,fresh,否则stale
想研究squid的话推荐《squid中文权威指南》,感觉很不错的一本书
refresh_pattern的作用:
用于确定一个页面进入cache后,它在cache中停留的时间。
语法:
refresh_pattern [-i] regexp min percent max [options]
几个概念:
resource age =对象进入cache的时间-对象的last_modified
response age =当前时间-对象进入cache的时间
LM-factor=(response age)/(resource age)
举个例子,这里只考虑percent, 不考虑min 和 max
例如:refresh_pattern 20%
假设源服务器上www.aaa.com/index.htm -----lastmodified 是 2007-04-10 02:00:00
squid上 proxy.aaa.com/index.htm index.htm进入cache的时间 2007-04-10 03:00:00
1)如果当前时间 2007-04-10 03:00:00
resource age =3点-2点=60分钟
response age =0分钟
index.htm还可以在cache停留的时间(resource age)*20%=12分钟
也就是说,index.htm进入cache后,可以停留12分钟,才被重新确认。
2)如果当前时间 2007-04-10 03:05:00
resource age =3点-2点=60分钟
response age =5分钟
index.htm还可以在cache停留的时间(resource age)*20%=12分钟-5=7
LM-factor=5/60=8.3%<20%
一直到2007-04-10 03:12:00 LM-factor=12/60=20% 之后,cache中的页面index.htm终于stale。
如果这时没有index.htm的请求,index.htm会一直在缓存中,如果有index.htm请求,squid收到该请求后,由于已经过期,
squid会向源服务器发一个index.htm是否有改变的请求,源服务器收到后,如果index.htm没有更新,squid就不用更新缓存,直接把
缓存的内容放回给客户端,同时,重置对象进入cache的时间为与源服务器确认的时间,比如2007-04-10
03:13:00,如果正好在这个后重新确认了页面。重置后,resource age变长,相应在cache中存活的时间也变长。
如果有改变则把最新的index.htm返回给squid,squid收到会更新缓存,然后把新的index.htm返回给客户端,同时根据新页面中的Last_Modified和取页面的时间,重新计算resource age,进一步计算出存活时间。
实际上,一个页面进入cache后,他的存活时间就确定了,即 (resource age) * 百分比,一直到被重新确认。
理解了百分比后,min max就好理解了
squid收到一个页面请求时:
1、计算出response age,
2、如果response age<min 则 fresh 如果response age>max 则 stale
3、如果response age在之间,如果response时间<存活时间,fresh,否则stale
- Squid中refresh_pattern选项的理解
- 如何理解Squid refresh_pattern
- Squid的refresh_pattern配置
- Squid的refresh_pattern配置
- refresh_pattern参数对squid的影响
- squid refresh_pattern命令
- SQUID refresh_pattern详解
- Squid refresh_pattern详解
- squid缓存:refresh_pattern指令
- squid缓存:refresh_pattern指令
- Squid refresh_pattern详解
- squid之refresh_pattern详解
- refresh_pattern 的一些理解和建议
- squid 高级的选项
- squid的配置文件的配置选项
- 如何让Squid Refresh_pattern 实现动态缓存时间
- squid源码分析2—refresh_pattern机制分析
- squid透明相关选项的说明
- 软件工程师不可不知的10个概念 来自:ReadWriteWeb
- 微软放弃 Vista 用 Windows 7 取而代之
- Windows调试符号配置
- mysqladmin命令简介
- 由AFX_IDW_PANE_FIRST宏的含义分析界面库XTP的一个bug
- Squid中refresh_pattern选项的理解
- asp:DropDownList 控件 设置AutoPostBack=true 但是OnSelectedIndexChanged仍不触发的问题。
- Tomcat6.x的Console(如何查看部署的webapp的输出)
- Zmanda实现图形化管理MySQL备份
- Itext 生成 pdf文件使用方法:
- MYSQL索引实例
- 访问IIS的aspx网页 出现如下提示: 用于运行 ASP.NET 的进程帐户必须具有对 IIS 元数据库(如 IIS://servername/W3SVC)的读访问权
- 在OpenSuse10.2中配置电信互联星空帐号实现dsl上网,终于成功。
- 同事开发的高效的开源分布式文件系统: FastDFS