一月 03

请仔细看看下面这张图,看出什么门道没有??
张斌事件的传播

关键看点:

  • 时间
  • 图片上红色区域越大,说明有越多的人同时访问一个相同的相当大的文件

Continue reading »

九月 18

调整了range_offset_limit参数之后,会对squid的行为有什么影响呢?

在squid.conf.default里面,range_offset_limit参数下面的注释是这样的:
Sets a upper limit on how far into the the file a Range request may be to cause Squid to prefetch the whole file. If beyond this limit Squid forwards the Range request as it is and the result is NOT cached.

This is to stop a far ahead range request (lets say start at 17MB)from making Squid fetch the whole object up to that point before sending anything to the client.

A value of -1 causes Squid to always fetch the object from the beginning so it may cache the result. (2.0 style)

A value of 0 causes Squid to never fetch more than the client requested. (default)
基本上看懂了是不?不就是控制多线程下载的http请求目标是否会进入squid的cache嘛。上次不是为了用squid缓冲windows update ,折腾了半天,在以为搞明白了range_offset_limit的意义之后,我将手头上的squid服务器的range_offset_limit调整为20480 KB。可是这样的调整,是会带来很大的麻烦的......
Continue reading »

九月 13

如果你想让squid缓冲microsoft update的patch的话,请把以下语句添加到squid的设置文件:

  1. refresh_pattern -i windowsupdate.com/.*\.(cab|exe) 4320 100% 43200 reload-into-ims
  2. refresh_pattern -i download.microsoft.com/.*\.(cab|exe) 4320 100% 43200 reload-into-ims
  3. refresh_pattern -i au.download.windowsupdate.com/.*\.(cab|exe) 4320 100% 43200 reload-into-ims

range_offset_limit 20480 KB
range_offset_limit -1 KB

以下是我的摸索过程:
Continue reading »

八月 09

squid自己就可以输出snmp信息,于是用caci来监视squid的服务状态性能就是理所当然的了。

在cacti的论坛上有个SquidStats v0.1的模板就是用来作这个。

为了同时查询squid服务器上其他的相应信息,决定还是用net-snmp把squid的snmp信息转发过来就好。

开启squid的snmp,这个很简单,不多说。

转发squid的snmp信息到net-snmp,这个也很简单,在snmpd.conf里面加入这么一句:

  1. proxy -v 2c -c public 127.0.0.1:3401 .1.3.6.1.4.1.3495.1

郁闷的事情就来了,通过net-snmp查询squid服务器上的.1.3.6.1.4.1.3495.1这个OID节点,居然会把squid服务器上的net-snmp服务直接搞到挂掉;而直接查询squid的snmp服务端口3401就一点问题都没有。google了一把,在freebsd的邮件列表上查到这么一条:ports/99885: Net-snmp dies when using proxy token,看了半天,反正就是得升级net-snmp就是了,于是花了半天时间编了个net-snmp 5.3.1的rpm,把原来的net-snmp 5.3.0.1给升级了,问题就这么给解决了。

最后要严重感谢一下cacti,让服务性能监测变得如此的方便;然后还要严重感叹一下,net-snmp编译的时间真是太........长了

八月 09

这两天调试了一下squid 2.6的wccp透明代理,颇走了些弯路,先把调试的几个关键点纪录下来,至于详细的笔记,希望最近我不会再那么懒了,争取这两个礼拜能写出来吧。

推荐的软硬件环境:

  • cisco 6509交换机的IOS版本高于12.2(18)SXD4
  • 采用2.6.10以上的linux kernel+squid 2.6的最新STABLE发行

Continue reading »