免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 7874 | 回复: 1
打印 上一主题 下一主题

[proxy] traffic server freshness_limit试用 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-04-02 22:29 |只看该作者 |倒序浏览
ats的官方文档说,当没有Expires或max-age头的情况下,ats会根据date, last_modified以及heuristic_lm_factor计算过期时间。

ats中相关配置如下:
CONFIG proxy.config.http.cache.heuristic_min_lifetime INT 3600
CONFIG proxy.config.http.cache.heuristic_max_lifetime INT 86400
CONFIG proxy.config.http.cache.heuristic_lm_factor FLOAT 0.100000

然后在源站创建文件pnow.jpg, 发起请求:
# wget -S --header "Host:test.ats.com" http://127.0.0.1/pnow.jpg?t1 -P /tmp/
--2013-04-02 22:17:09--  http://127.0.0.1/pnow.jpg?t1
Connecting to 127.0.0.1:80... connected.
HTTP request sent, awaiting response...
  HTTP/1.0 200 OK
  Server: ATS/3.2.4
  Date: Tue, 02 Apr 2013 14:17:09 GMT
  Content-Type: image/jpeg
  Content-Length: 483632
  Last-Modified: Tue, 02 Apr 2013 14:00:00 GMT
  Accept-Ranges: bytes
  Age: 0
  Connection: keep-alive
Length: 483632 (472K) [image/jpeg]
Saving to: `/tmp/pnow.jpg?t1.6'

100%[===================================================================================>] 483,632     --.-K/s   in 0.002s  

然而无论多少次请求,Age始终是0,源站有回源记录。
本次测试中,Last-Modified时间是 Tue, 02 Apr 2013 14:00:00 GMT, 请求date在这之后10~15分钟期间,根据freshness_limit = ( date - last_modified ) * 0.10的公式,在1~1.5分钟期间应该是fresh的,为什么实测看到的是没有缓存而回源了呢?

ats初学者,求解答。

论坛徽章:
0
2 [报告]
发表于 2013-04-02 22:52 |只看该作者
找到原因了,修改proxy.config.http.cache.required_headers值为0, 原先为2, 只缓存带expires和max-age头的对象。

# wget -S --header "Host:test.ats.com" http://127.0.0.1/pnow.jpg?t14 -P /tmp/
--2013-04-02 22:48:38--  http://127.0.0.1/pnow.jpg?t14
Connecting to 127.0.0.1:80... connected.
HTTP request sent, awaiting response...
  HTTP/1.0 200 OK
  Server: ATS/3.2.4
  Date: Tue, 02 Apr 2013 14:41:37 GMT
  Content-Type: image/jpeg
  Content-Length: 483632
  Last-Modified: Tue, 02 Apr 2013 14:30:00 GMT
  Accept-Ranges: bytes
  Age: 421
  Connection: keep-alive
Length: 483632 (472K) [image/jpeg]
Saving to: `/tmp/pnow.jpg?t14.175'

100%[===================================================================================>] 483,632     --.-K/s   in 0.002s  

2013-04-02 22:48:38 (288 MB/s) - `/tmp/pnow.jpg?t14.175' saved [483632/483632]

但依照上述Date, Last-modified, 我计算出的缓存时间是(14:41:37 - 14:30:30) * 0.1 = 1 分钟, 为什么现在已经421s了还是fresh的?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP