-
版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明
http://iyubo.blogbus.com/logs/37616762.html
图片缓存换成squid以后仍然会出现子进程因为out of memory问题重启的现象,严重的是squid子进程重启以后会重建缓存,虽然这段时间只有不到1分钟,但是重建的时候还是会影响线上服务。在查询了官方文档后决定将squid升级到2.7再观察观察。
有了2.6的经验,这次安装配置的时候详细了许多,2.7跟2.6的主要不同可以参考2.7的Release Notes
具体的安装配置方法(只说跟2.6不同的地方,之前的安装过程请参考这里)
#./configure --prefix=/usr/local/squid2.7 --enable-dlmalloc --enable-xmalloc-statistics --enable-useragent-log --enable-referer-log --enable-epoll --enable-large-cache-files --disable-internal-dns --enable-linux-netfilter --enable-truncate --enable-x-accelerator-vary --enable-follow-x-forwarded-for --with-large-files
#make && make install
配置文件(squid.conf),只把新增的配置文件用红色标注出来了,2.7的配置可以参考官方的cfgman
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 SSL_ports port 443
acl Safe_ports port 80
acl safeprotocol protocol HTTP
acl allowmethod method GET POST HEAD
acl CONNECT method CONNECT
acl mtime dstdomain .test.com
acl has_referer referer_regex .
acl allow_referer referer_regex -i 10\.10\.10\.*
acl allow_referer referer_regex -i baidu\.com
acl allow_referer referer_regex -i google\.com
acl allow_referer referer_regex -i google\.cn
http_access allow !has_referer
http_access deny !allow_referer
deny_info http://img1.test.com/images/default/noposter.jpg allow_referer
http_access allow manager localhost
http_access deny manager
http_access allow safeprotocol Safe_ports allowmethod mtime
http_access deny !allowmethod
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
#http_access deny to_localhost
http_access deny all
icp_access allow all
http_port 10.10.10.25:80 accel defaultsite=59.151.32.58 vhost act-as-origin http11
always_direct allow all
cache_peer 10.10.10.8 parent 3080 0 no-query originserver name=imgserver http11
cache_peer_domain imgserver img.test.com img3.test.com
hierarchy_stoplist cgi-bin ?
cache_mem 1845 MB
maximum_object_size_in_memory 2 KB
memory_replacement_policy lru
cache_replacement_policy lru
cache_dir ufs /srv/scache_new 40000 16 256
minimum_object_size 0 KB
maximum_object_size 2048 KB
cache_swap_low 90
cache_swap_high 95
via off
logformat combined %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %<st "%{Referer}>h" "%{User-Agent}>h" %Ss:%Sh
access_log /var/log/squid/access.log squid
cache_log /var/log/squid/cache.log
cache_store_log /var/log/squid/store.log
logfile_rotate 24
emulate_httpd_log on
#acl QUERY urlpath_regex cgi-bin \?
#cache deny QUERY
refresh_pattern -i \.jpg 60 90% 1440
refresh_pattern -i \.png 60 90% 1440
refresh_pattern -i \.gif 60 90% 1440
quick_abort_min 16 KB
quick_abort_max 16 KB
quick_abort_pct 95
request_header_max_size 10 KB
reply_header_max_size 10 KB#去掉Response Header中的X-Origin-Date字段
header_access X-Origin-Date deny all#支持HTTP1.1
server_http11 on#相当于设定ulimit
max_filedescriptors 65535#此值越小squid越频繁的接受新的连接请求
incoming_rate 30
forward_timeout 4 minutes
connect_timeout 3 minutes
peer_connect_timeout 30 seconds
read_timeout 15 minutes
request_timeout 1 minute
persistent_request_timeout 3 minutes
half_closed_clients off
pconn_timeout 1 minute
cache_mgr flyincat@gmail.com
cache_effective_user squid
cache_effective_group squid
visible_hostname img-squid-server
coredump_dir /var/log/squid/cache参考文档
http://www.squid-cache.org/Versions/v2/2.7/squid-2.7.STABLE6-RELEASENOTES.html
http://www.squid-cache.org/Versions/v2/2.7/cfgman/
随机文章:
用Squid搭建Cache服务器 2009-03-30Squid3.0与2.7的配置差异 2009-04-14lighttpd+modcache实现对小图片的Cache 2009-07-16Varnish自动重启子进程问题更新 2009-04-16Varnish更新到2.0.4 2009-04-13
收藏到:Del.icio.us









评论
我在测试2.7的新特性
现在生产环境中使用的是2.6
想请教下2.7比2.6有多少性能的提升
谢谢
能联系我么
谢谢
而且你联系方式都没有
能联系我么
谢谢