免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: aaaaaa

[proxy] 使用Apache Traffic Server代理服务器缓存视频文件 [复制链接]

论坛徽章:
0
发表于 2012-07-10 11:01 |显示全部楼层
SPDY的插件,苹果公司的James已经在跟进啦.具体进度不详.但是James是我在社区里见到的出活最快+最好的同学啦.我相信他

ESI是雅虎开源的,他们已经在内部大规模部署,很多关键服务使用了.不过社区里的代码可能仍有些问题,我已经做过几次编译问题修复啥的,貌似还有几个patch没加上去.

欢迎跟进这2个方向,这2个方向都是真正体现TS的平台价值的点.很有意义!

论坛徽章:
0
发表于 2012-07-23 10:03 |显示全部楼层
本帖最后由 pliang75 于 2012-07-23 10:27 编辑

想用TS缓存优酷的视频文件不成功. 求教!

TS版本:3.2.0
系统版本:ubuntu 10.04 x64
插件: cacheurl

在ubuntu系统上安装TS,安装插件cacheurl并仿照楼主的设置做了相应配置.

修改了默认的record.conf里面的配置
//设置为正向代理
proxy.config.reverse_proxy.enabled INT 0
proxy.config.url_remap.remap_required INT 0

proxy.config.cache.permit.pinning INT 1

修改 storage.config
var/trafficserver 10240M

用命令trafficserver start 正常启动后
访问优酷网站,点击视频后可以在 cacheurl.log里面找到
Rewriting cache URL for http://118.228.16.40/youku/XXXXX ... 87-33427E380B07.flv to http://www.youku.com/03000204014 ... 87-33427E380B07.flv
类似的字样, 确定cacheurl插件已经起作用了.

但是使用traffic_line -r proxy.process.cache.bytes_used却没有看到相应大小的cache增长,  使用另一台电脑看相同的优酷视频文件也没有感受到加速效果.  
record.conf里面没有找到http_ui_enabled的选项,所以不知道如何使用 httpui

请问,是不是TS是不是还要经过其他的设置才能缓存flv之类的视频文件?

可以设置TS只缓存视频文件吗?



论坛徽章:
0
发表于 2012-07-23 10:35 |显示全部楼层
日志目录里的traffic.out可以贴一下吗?

论坛徽章:
0
发表于 2012-07-23 11:10 |显示全部楼层
本帖最后由 pliang75 于 2012-07-23 12:11 编辑

我把日志清空了, 然后trafficserver stop && trafficserver start

下面是日志:

[TrafficManager] ==> Cleaning up and reissuing signal #3
[Jul 23 12:08:20.665] Manager {0x7f965afcd720} ERROR: [TrafficManager] ==> Cleaning up and reissuing signal #3
[Jul 23 12:08:20.665] Manager {0x7f965afcd720} ERROR:  (last system error 2: No such file or directory)
FATAL ==> [ProcessManager::pollLMConnection] Lost Manager EOF![E. Mgmt] : Interrupted system call
[E. Mgmt] log ==> [TrafficManager] using root directory '/usr/local'
[Jul 23 12:08:26.966] {0x7fa20af83720} STATUS: opened /usr/local/var/log/trafficserver/manager.log
[Jul 23 12:08:26.966] {0x7fa20af83720} NOTE: updated diags config
[Jul 23 12:08:26.967] Manager {0x7fa20af83720} NOTE: [appendDefaultDomain] Unable to determine default domain name. Nodes will be know by their unqualified host name
[Jul 23 12:08:26.987] Manager {0x7fa20af83720} NOTE: [ClusterCom::ClusterCom] Node running on OS: 'Linux' Release: '2.6.32-38-server'
[Jul 23 12:08:26.987] Manager {0x7fa20af83720} NOTE: [LocalManager::listenForProxy] Listening on port: 8080
[Jul 23 12:08:26.987] Manager {0x7fa20af83720} NOTE: [TrafficManager] Setup complete
[Jul 23 12:08:28.042] Manager {0x7fa20af83720} NOTE: [LocalManager::startProxy] Launching ts process
[TrafficServer] using root directory '/usr/local'
[Jul 23 12:08:28.089] Manager {0x7fa20af83720} NOTE: [LocalManager::pollMgmtProcessServer] New process connecting fd '11'
[Jul 23 12:08:28.090] Manager {0x7fa20af83720} NOTE: [Alarms::signalAlarm] Server Process born
[Jul 23 12:08:29.120] {0x2b7668c0ea00} STATUS: opened /usr/local/var/log/trafficserver/diags.log
[Jul 23 12:08:29.121] {0x2b7668c0ea00} NOTE: updated diags config
[Jul 23 12:08:29.133] Server {0x2b7668c0ea00} NOTE: cache clustering disabled
[Jul 23 12:08:29.179] Server {0x2b7668c0ea00} NOTE: cache clustering disabled
[Jul 23 12:08:29.316] Server {0x2b7668c0ea00} NOTE: logging initialized[15], logging_mode = 3
[Jul 23 12:08:29.350] Server {0x2b7668c0ea00} NOTE: loading plugin '/usr/local/libexec/trafficserver/cacheurl.so'
[Jul 23 12:08:29.370] Server {0x2b7668c0ea00} NOTE: traffic server running
[Jul 23 12:08:29.686] Server {0x2b7668c0ea00} NOTE: cache enabled

论坛徽章:
0
发表于 2012-07-23 12:09 |显示全部楼层
本帖最后由 pliang75 于 2012-07-23 12:20 编辑

TS从官网下的源码,  ./configure 没有加其他参数, 默认安装在 /usr/local目录下.

系统安装在虚拟机上,这个会有问题吗?

论坛徽章:
0
发表于 2012-07-24 11:57 |显示全部楼层
hello?....

论坛徽章:
0
发表于 2012-07-24 12:51 |显示全部楼层
你的配置的cache是启用的啊, 按照道理应该没问题, 如果要查这个问题,你可以在records.config里enable debug选项,或者用http_ui + via_header来看看为啥.

http://people.apache.org/~zym/trafficserver/FAQ.html 上可以看到大多数的方法

论坛徽章:
0
发表于 2012-07-24 13:54 |显示全部楼层
顺便贴一个我做的关键配置, 以脚本的形式:

#!/bin/sh

traffic_line -s proxy.config.cache.ram_cache.size -v 51539607552
traffic_line -s proxy.config.cache.min_average_object_size -v 64000

traffic_line -s proxy.config.http.send_http11_requests -v 3
traffic_line -s proxy.config.http.cache.enable_default_vary_headers -v 1

traffic_line -s proxy.config.hostdb.ttl_mode -v 2
traffic_line -s proxy.config.hostdb.timeout -v 90

traffic_line -s proxy.config.http.transaction_active_timeout_in -v 0
traffic_line -s proxy.config.http.transaction_active_timeout_out -v 0

# we'd like to use remap.config even in forarding mode.
traffic_line -s proxy.config.reverse_proxy.enabled -v 1
traffic_line -s proxy.config.url_remap.pristine_host_hdr -v 0
traffic_line -s proxy.config.url_remap.remap_required -v 0

traffic_line -s proxy.config.http.connect_attempts_max_retries -v 10
traffic_line -s proxy.config.http.connect_attempts_max_retries_dead_server -v 6
traffic_line -s proxy.config.http.connect_attempts_rr_retries -v 6
traffic_line -s proxy.config.http.down_server.cache_time -v 10
traffic_line -s proxy.config.hostdb.size -v 1000000
traffic_line -s proxy.config.hostdb.storage_size -v 335544320
traffic_line -s proxy.config.http.cache.required_headers -v 0
traffic_line -s proxy.config.http.cache.heuristic_min_lifetime -v 10800
traffic_line -s proxy.config.http.cache.heuristic_max_lifetime -v 5184000
traffic_line -s proxy.config.http.cache.cache_responses_to_cookies -v 3
traffic_line -s proxy.config.http.background_fill_active_timeout -v 1200
traffic_line -s proxy.config.http.background_fill_completed_threshold -v 0
traffic_line -s proxy.config.log.max_space_mb_for_logs -v 400000

traffic_line -s proxy.config.stack_dump_enabled -v 1
traffic_line -s proxy.config.mem_alloc_type.iobuf -v 1
traffic_line -s proxy.config.mem_alloc_type.cachebuf -v 1
traffic_line -s proxy.config.cache.enable_empty_http_doc -v 1
traffic_line -s proxy.config.http.cache.ignore_accept_mismatch -v 1

# record mem hit ratio
traffic_line -s proxy.config.http.record_tcp_mem_hit -v 1

# we need cache video file by default
traffic_line -s proxy.config.http.cache.required_headers -v 0

# enable read_while_writer, the connection collapsing
traffic_line -s proxy.config.cache.enable_read_while_writer -v 1
traffic_line -s proxy.config.http.background_fill_completed_threshold -v 0


traffic_line -x

论坛徽章:
0
发表于 2012-07-24 16:32 |显示全部楼层
本帖最后由 pliang75 于 2012-10-09 17:03 编辑

O(∩_∩)O O(∩_∩)O

论坛徽章:
0
发表于 2012-07-25 12:49 |显示全部楼层
哈, 我给你参考的, 你可不能全用啊, 那个内存的配置你就不一定合适啊
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP