免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: aaaaaa
打印 上一主题 下一主题

[proxy] Apache Traffic Server 3.2.0 正式版,附srpm包 [复制链接]

论坛徽章:
0
241 [报告]
发表于 2012-03-27 15:30 |只看该作者
ATS能够对 url,referer, agent 进行匹配过滤吗?

论坛徽章:
0
242 [报告]
发表于 2012-03-27 21:59 |只看该作者
有基于referer的ACL机制,参考remap.config的说明。
有基于url的正则表达式的cache控制,参考cache.config的说明

其他个性需求,就需要你自己写几个插件啥的啦。你可以参考源代码里的example/ 和 plugins目录下的一些插件,配合参考线上SDK文档(很老啦,最近的变化有点大,仅供参考)作一个你需要的插件是很简单的,Apache Traffic Server强大的插件开发扩展性,很有Apache的风格。

FYI

论坛徽章:
0
243 [报告]
发表于 2012-04-09 23:28 |只看该作者
Traffic Server 3.0.4

做一个简单的Cache测试。后台服务器返回头

Cache-Control        public, max-age=60
Content-Length        73
Content-Type        text/html;charset=UTF-8
Server        Jetty(7.4.1.v20110513)

原意是想让AST缓存60秒

AST返回
HTTP/1.1 200 OK
Content-Type: text/html;charset=UTF-8
Cache-Control: public, max-age=60
Content-Length: 73
Server: ATS/3.0.4
Date: Mon, 09 Apr 2012 15:05:17 GMT
Age: 2

然后用一个线程循环不停地访问该URL,结果发现没有到60秒AST就会开始访问后台服务器。

猜测并作了一下测试,大概每访问300次就认为缓存失效而重新访问后台服务器。(只是猜测,300次也不是特别准确)

希望高手解惑

论坛徽章:
0
244 [报告]
发表于 2012-04-09 23:48 |只看该作者
补充一下,应该不是300次。我把访问次数和时间在后台服务器打印出来,结果如下:
(说明:c1--cn是测试HTTP访问次数,n代表第n次http测试访问)

c1 Mon Apr 09 23:40:33 CST 2012
c219 Mon Apr 09 23:40:38 CST 2012
c426 Mon Apr 09 23:40:42 CST 2012
c528 Mon Apr 09 23:40:44 CST 2012
c969 Mon Apr 09 23:40:54 CST 2012
c1251 Mon Apr 09 23:41:00 CST 2012
c1288 Mon Apr 09 23:41:01 CST 2012
c1380 Mon Apr 09 23:41:03 CST 2012
c1769 Mon Apr 09 23:41:10 CST 2012
c2116 Mon Apr 09 23:41:17 CST 2012
c2546 Mon Apr 09 23:41:26 CST 2012
c3074 Mon Apr 09 23:41:38 CST 2012
c3210 Mon Apr 09 23:41:40 CST 2012
c3304 Mon Apr 09 23:41:42 CST 2012
c3472 Mon Apr 09 23:41:46 CST 2012
c3530 Mon Apr 09 23:41:48 CST 2012
c3594 Mon Apr 09 23:41:49 CST 2012
c3967 Mon Apr 09 23:41:57 CST 2012
c4060 Mon Apr 09 23:41:59 CST 2012
c4517 Mon Apr 09 23:42:16 CST 2012
c4801 Mon Apr 09 23:42:22 CST 2012
c4891 Mon Apr 09 23:42:24 CST 2012
c5104 Mon Apr 09 23:42:28 CST 2012
c5379 Mon Apr 09 23:42:33 CST 2012
c5717 Mon Apr 09 23:42:40 CST 2012
c6053 Mon Apr 09 23:42:47 CST 2012
c6484 Mon Apr 09 23:42:56 CST 2012
c6637 Mon Apr 09 23:42:58 CST 2012
c6716 Mon Apr 09 23:43:00 CST 2012
c7134 Mon Apr 09 23:43:06 CST 2012
c7743 Mon Apr 09 23:43:16 CST 2012
c7770 Mon Apr 09 23:43:16 CST 2012
c7843 Mon Apr 09 23:43:17 CST 2012
c8083 Mon Apr 09 23:43:21 CST 2012
c8361 Mon Apr 09 23:43:27 CST 2012
c8651 Mon Apr 09 23:43:31 CST 2012
c8826 Mon Apr 09 23:43:34 CST 2012
c9047 Mon Apr 09 23:43:38 CST 2012
c9431 Mon Apr 09 23:43:43 CST 2012
c9610 Mon Apr 09 23:43:46 CST 2012
c10101 Mon Apr 09 23:43:54 CST 2012
c10326 Mon Apr 09 23:43:57 CST 2012
c10642 Mon Apr 09 23:44:03 CST 2012
c10647 Mon Apr 09 23:44:04 CST 2012
c10757 Mon Apr 09 23:44:22 CST 2012
c10981 Mon Apr 09 23:44:44 CST 2012
c11028 Mon Apr 09 23:44:44 CST 2012
c11597 Mon Apr 09 23:44:53 CST 2012
c11693 Mon Apr 09 23:44:55 CST 2012
c11885 Mon Apr 09 23:44:58 CST 2012
c12059 Mon Apr 09 23:45:01 CST 2012
c12236 Mon Apr 09 23:45:05 CST 2012
c12756 Mon Apr 09 23:45:15 CST 2012
c12882 Mon Apr 09 23:45:17 CST 2012
c13197 Mon Apr 09 23:45:24 CST 2012
c13459 Mon Apr 09 23:45:29 CST 2012
c13984 Mon Apr 09 23:45:40 CST 2012
c14057 Mon Apr 09 23:45:42 CST 2012
c14309 Mon Apr 09 23:45:47 CST 2012

论坛徽章:
0
245 [报告]
发表于 2012-04-10 00:05 |只看该作者
我觉得你说的很诡异。TS时间不敢保证精确到ms一下,但是也不至于差多少s的。你能不能打印出每个response的Age值,把跳变的2个数值贴出来我们看看?

最好测试长一下。每次跳变的前后值作成一行数据,如果可以,也记录Date,我们看看多次测量后的一些差值情况。


thanks

论坛徽章:
0
246 [报告]
发表于 2012-04-10 00:43 |只看该作者
本帖最后由 henhaoqi 于 2012-04-10 00:57 编辑

回复 246# aaaaaa

我用jmeter压的,刚刚发现如果设置max-age为600,基本是对的,到了10分钟有时超一点,最多的超20秒(10分钟后20秒)后访问服务器

设置为120、180。。。360都非常不准,360的时候是这样的

c274 Tue Apr 10 00:19:03 CST 2012
c6233 Tue Apr 10 00:21:09 CST 2012
c12524 Tue Apr 10 00:23:10 CST 2012
c19459 Tue Apr 10 00:25:13 CST 2012

是不是还有个什么算法和访问次数有关啊?或者有个什么阀值配置有问题?

如果设置max-age为60,直接使用浏览器访问时是好的,但是压测时就有问题。

按照您的要求,我把取样器的结果打出来了,先给您看看max-age=60时后台服务器的访问间隔
c1 Tue Apr 10 00:35:12 CST 2012
c46 Tue Apr 10 00:35:13 CST 2012
c487 Tue Apr 10 00:35:22 CST 2012
c511 Tue Apr 10 00:35:23 CST 2012
c565 Tue Apr 10 00:35:24 CST 2012
c655 Tue Apr 10 00:35:26 CST 2012

然后看看测试日志中c45(c46重新访问服务器了)的响应:
<httpSample lt="6" ts="1333989313050" lb="HTTP Request HTTPClient" rc="200" dt="text" by="146">
  <responseHeader class="java.lang.String">HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=60
Server: ATS/3.0.4
Date: Mon, 09 Apr 2012 16:33:42 GMT
json2jsonp: true
Content-Length: 146
Age: 1
Connection: keep-alive
</responseHeader>
  <java.net.URL>http://json.proxy.ast.com:8080/json?cb=c45</java.net.URL>
</httpSample>


再看c46的响应
<httpSample lt="31" ts="1333989313057" lb="HTTP Request HTTPClient" rc="200" dt="text" by="146">
  <responseHeader class="java.lang.String">HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=60
Server: ATS/3.0.4
Date: Mon, 09 Apr 2012 16:33:43 GMT
json2jsonp: true
Content-Length: 146
Age: 0
Connection: keep-alive
</responseHeader>
  <java.net.URL>http://json.proxy.ast.com:8080/json?cb=c46</java.net.URL>
</httpSample>

Age已经是0了

再看看c486(c487重新访问了)
<httpSample lt="27" ts="1333989322409" lb="HTTP Request HTTPClient" rc="200" dt="text" by="147">
  <responseHeader class="java.lang.String">HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=60
Server: ATS/3.0.4
Date: Mon, 09 Apr 2012 16:33:43 GMT
json2jsonp: true
Content-Length: 147
Age: 9
Connection: keep-alive
</responseHeader>
  <java.net.URL>http://json.proxy.ast.com:8080/json?cb=c486</java.net.URL>
</httpSample>

c487的age就是0了
<httpSample lt="12" ts="1333989322437" lb="HTTP Request HTTPClient" rc="200" dt="text" by="147">
  <responseHeader class="java.lang.String">HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=60
Server: ATS/3.0.4
Date: Mon, 09 Apr 2012 16:33:52 GMT
json2jsonp: true
Content-Length: 147
Age: 0
Connection: keep-alive
</responseHeader>
  <java.net.URL>http://json.proxy.ast.com:8080/json?cb=c487</java.net.URL>
</httpSample>


c510(c511后重新访问)
<httpSample lt="6" ts="1333989322876" lb="HTTP Request HTTPClient" rc="200" dt="text" by="147">
  <responseHeader class="java.lang.String">HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=60
Server: ATS/3.0.4
Date: Mon, 09 Apr 2012 16:33:52 GMT
json2jsonp: true
Content-Length: 147
Age: 1
Connection: keep-alive
</responseHeader>
  <java.net.URL>http://json.proxy.ast.com:8080/json?cb=c510</java.net.URL>
</httpSample>

c511的:
<httpSample lt="23" ts="1333989322883" lb="HTTP Request HTTPClient" rc="200" dt="text" by="147">
  <responseHeader class="java.lang.String">HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=60
Server: ATS/3.0.4
Date: Mon, 09 Apr 2012 16:33:53 GMT
json2jsonp: true
Content-Length: 147
Age: 0
Connection: keep-alive
</responseHeader>
  <java.net.URL>http://json.proxy.ast.com:8080/json?cb=c511</java.net.URL>
</httpSample>


c564(c565重新访问),age是1:
<httpSample lt="27" ts="1333989324115" lb="HTTP Request HTTPClient" rc="200" dt="text" by="147">
  <responseHeader class="java.lang.String">HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=60
Server: ATS/3.0.4
Date: Mon, 09 Apr 2012 16:33:53 GMT
json2jsonp: true
Content-Length: 147
Age: 1
Connection: keep-alive
</responseHeader>
  <java.net.URL>http://json.proxy.ast.com:8080/json?cb=c564</java.net.URL>
</httpSample>

c565的:
<httpSample lt="12" ts="1333989324142" lb="HTTP Request HTTPClient" rc="200" dt="text" by="147">
  <responseHeader class="java.lang.String">HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=60
Server: ATS/3.0.4
Date: Mon, 09 Apr 2012 16:33:54 GMT
json2jsonp: true
Content-Length: 147
Age: 0
Connection: keep-alive
</responseHeader>
  <java.net.URL>http://json.proxy.ast.com:8080/json?cb=c565</java.net.URL>
</httpSample>

c654(c655重新访问):
<httpSample lt="21" ts="1333989325969" lb="HTTP Request HTTPClient" rc="200" dt="text" by="147">
  <responseHeader class="java.lang.String">HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=60
Server: ATS/3.0.4
Date: Mon, 09 Apr 2012 16:33:54 GMT
json2jsonp: true
Content-Length: 147
Age: 2
Connection: keep-alive
</responseHeader>
  <java.net.URL>http://json.proxy.ast.com:8080/json?cb=c654</java.net.URL>
</httpSample>

c655的:

<httpSample lt="25" ts="1333989325990" lb="HTTP Request HTTPClient" rc="200" dt="text" by="147">
  <responseHeader class="java.lang.String">HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=60
Server: ATS/3.0.4
Date: Mon, 09 Apr 2012 16:33:56 GMT
json2jsonp: true
Content-Length: 147
Age: 0
Connection: keep-alive
</responseHeader>
  <java.net.URL>http://json.proxy.ast.com:8080/json?cb=c655</java.net.URL>
</httpSample>

ts就是timestamp(毫秒)。

哦,对了,我是使用了regex_remap把querystring去掉了的,所以所有的URL最后到后台服务器都转成了http://json.proxy.ast.com:8080/json。即使是不用regex_remap,我也测试过,一样的结果。

是很诡异啊

论坛徽章:
0
247 [报告]
发表于 2012-04-10 01:33 |只看该作者
设置max-age=480时,基本缓存时间为一半,4分钟

c1 Tue Apr 10 01:00:45 CST 2012
c22326 Tue Apr 10 01:04:51 CST 2012
c45338 Tue Apr 10 01:08:59 CST 2012
c65989 Tue Apr 10 01:13:00 CST 2012

是不是哪个参数将其除以2了然后再加上了个随机数(可能为负数)的调整?

前面说错了,重新测试了一下设置max-age=600时,大约是360秒:

c1 Tue Apr 10 01:14:37 CST 2012
c35717 Tue Apr 10 01:20:38 CST 2012
c67308 Tue Apr 10 01:26:54 CST 2012
c103029 Tue Apr 10 01:32:55 CST 2012

论坛徽章:
0
248 [报告]
发表于 2012-04-11 00:28 |只看该作者
hmm,我需要找个时间写测试用例来复现你的问题。这两天有点忙

论坛徽章:
0
249 [报告]
发表于 2012-04-11 01:28 |只看该作者
回复 249# aaaaaa


好的,等您消息,多谢。

论坛徽章:
0
250 [报告]
发表于 2012-04-11 09:58 |只看该作者
顺便说一下:
Apache Traffic Server 3.0.4稳定版已经进了FC15 FC16以及EPEL6的repo,使用Fedora和RHEL的用户都可以直接yum install啦,希望能够给大家以便利!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP