博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

background_fill_completed_threshold

Posted on 2017-08-14 15:07  bw_0927  阅读(276)  评论(0)    收藏  举报

 

http://bbs.chinaunix.net/forum.php?mod=viewthread&action=printable&tid=4054287

如果有10个用户访问同一个URL,我观察log,都是会回源取的
有哪个参数可以设置,如果同时有N个用户请求同一个URl,只回一次源。
另外,如果第一个用户回源网络有问题,它会如何处理。

 

有人叫这个是回源合并功能,在TS里,叫read_while_writer,启用方法参考:
http://www.ogre.com/node/386
这个功能需要最新的git master版本才能work的比较好,我们的代码刚刚提交到社区里。

严格说来,回源合并发生在第一个用户已经取得了服务器的返回头,并且判断这个内容是可以cache的,可以写入storage的,这之后新的请求才会被合并到这个正在往磁盘写入的请求里。以减少回源。

理论上,如果第一个用户回源连接连不上,那他根本不可能取得服务的返回头。也就无法成为这里的所谓writer啦。

如果传输中,第一个writer正在传输的过程中退出,文档里的
CONFIG proxy.config.http.background_fill_completed_threshold FLOAT 0
参数会控制TS,继续保持服务器端连接而完成所有内容的下载。这个参数很有意义

 

https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.config.en.html

 


background_fill_completed_threshold

The proportion of total document size already transferred when a client aborts at which the proxy continues fetching the document from the origin server to get it into the cache (a background fill).

 

https://docs.trafficserver.apache.org/en/latest/admin-guide/configuration/cache-basics.en.html#admin-config-read-while-writer

The background fill feature (both proxy.config.http.background_fill_active_timeout andproxy.config.http.background_fill_completed_threshold) should be allowed to kick in for every possible request.

This is necessary in the event the writer (the first client session to request the object, which triggered ATS to contact the origin server) goes away. Another client session needs to take over the writer.

As such, you should set the background fill timeouts and threshold to zero; this assures they never time out and are always allowed to kick in.

 

Once these are enabled, you have something that is very close, but not quite the same, to Squid’s Collapsed Forwarding.