Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1379461
  • 博文数量: 77
  • 博客积分: 2104
  • 博客等级: 大尉
  • 技术积分: 2322
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-19 13:21
个人简介

关注于系统高可用、网站架构

文章分类

全部博文(77)

文章存档

2018年(1)

2017年(1)

2015年(4)

2014年(8)

2013年(4)

2012年(12)

2011年(17)

2010年(30)

分类: LINUX

2011-12-27 17:21:27

配置文件
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl to_localhost dst 127.0.0.0/8
acl PURGE method PURGE
acl SSL_ports port 443
acl Safe_ports port 80          # http
acl Safe_ports port 21          # ftp
acl Safe_ports port 443         # https
acl Safe_ports port 70          # gopher
acl Safe_ports port 210         # wais
acl Safe_ports port 1025-65535  # unregistered ports
acl Safe_ports port 280         # http-mgmt
acl Safe_ports port 488         # gss-http
acl Safe_ports port 591         # filemaker
acl Safe_ports port 777         # multiling http
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost
http_access allow all
icp_access allow all
http_access allow PURGE localhost
http_access deny PURGE
http_port 3128 accel vhost vport
hierarchy_stoplist cgi-bin ?
access_log /var/log/squid/access.log squid
acl QUERY urlpath_regex cgi-bin \?
cache deny QUERY
refresh_pattern -i \.gif$   1440    50%     2880  
refresh_pattern -i \.jpg$   1440    50%     2880
refresh_pattern -i \.png$   1440    50%     2880
refresh_pattern -i \.mp3$   1440    50%     2880   
refresh_pattern -i \.wmv$   1440    50%     2880
refresh_pattern -i \.rm$   1440    50%     2880   
refresh_pattern -i \.swf$   1440    50%     2880
refresh_pattern -i \.mpeg$   1440    50%     2880
refresh_pattern -i \.wma$   1440    50%     2880
refresh_pattern -i \.css$ 10 50% 60 reload-into-ims
refresh_pattern -i \.js$ 10 50% 60 reload-into-ims
refresh_pattern -i \.xml$ 10 50% 30 reload-into-ims
refresh_pattern .               0       20%     1440
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
coredump_dir /var/spool/squid
cache_peer 192.168.10.46 parent 80 0 no-query originserver
cache_mem 2048 MB
cache_dir ufs /dev/shm/squid_cache 10240 16 256
maximum_object_size 4096 KB
maximum_object_size_in_memory 4096 KB
max_filedesc 4096
 
maximum_object_size_in_memory 可以不用设置过大,有效控制squid过度占用内存,设置参考
 Mean Object Size:       16.89 KB 项
 
一般cache容量和被加速内容的比值在1:10到1:20比较合适。
cache_dir aufs /var/spool/squid 10240 64 64
这是一个典型网站web caching server的cache_dir配置,加速100GB到200GB的内容

 
 response age =当前时间-对象进入cache的时间
 实际上,一个页面进入cache后,他的存活时间就确定了,即 (resource age) * 百分比,一直到被重新确认。
理解了百分比后,min max就好理解了
squid收到一个页面请求时:
1、计算出response age,
2、如果response agemax 则 stale
3、如果response age在之间,如果response时间<存活时间,fresh,否则stale
 
如果需要awstat分析,需要修改日志格式
logformat combined %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %h" "%{User-Agent}>h" %Ss:%Sh %{host}>h
access_log /var/log/squid/access.log combined
 
阅读(3230) | 评论(0) | 转发(0) |
0

上一篇:squid常用命令

下一篇:oracle坏块扫描

给主人留下些什么吧!~~