免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1835 | 回复: 1
打印 上一主题 下一主题

[FreeBSD] freeBSD下squid代理其慢无比 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-12-22 00:01 |只看该作者 |倒序浏览
我的配置文件 里面不少东西网上都有介绍,你可以搜一下,其实还有一个地方可以优化,不过我太懒了,懒得重新编译,所以就算了,你看前面部分就好了,规则那里不用看了,不过最后一条最好加上,否则上hotmail不好用,不知道是不是我走2级代理的问题,直接走可能不需要吧

http_port 172.16.6.8:1201
visible_hostname MXMGY
cache_mgr mxmgy
error_directory /usr/local/etc/squid/errors/Simplify_Chinese/
dns_nameservers 202.118.224.101

cache_swap_low 80
cache_swap_high 95
half_closed_clients off
cache_mem 64 MB
maximum_object_size 5120 KB
maximum_object_size_in_memory 256 KB
memory_replacement_policy heap LRU
cache_replacement_policy heap LFUDA
cache_dir ufs /usr/local/squid/cache 1024 16 256
refresh_pattern -i .html 1440 90% 129600 reload-into-ims
refresh_pattern -i .shtml 1440 90% 129600 reload-into-ims
refresh_pattern -i .hml 1440 90% 129600 reload-into-ims
refresh_pattern -i .gif 1440 90% 129600 reload-into-ims
refresh_pattern -i .swf 1440 90% 129600 reload-into-ims
refresh_pattern -i .jpg 1440 90% 129600 reload-into-ims
refresh_pattern -i .png 1440 90% 129600 reload-into-ims
refresh_pattern -i .bmp 1440 90% 129600 reload-into-ims
refresh_pattern -i .js 1440 90% 129600 reload-into-ims
#cache_dir null /tmp

connect_timeout 60 seconds
read_timeout 3 minutes
request_timeout 30 seconds
client_lifetime 10 minutes

cache_access_log /usr/local/squid/logs/access.log
cache_store_log none
logfile_rotate 1
pid_filename /usr/local/squid/logs/squid.pid

acl all src 0.0.0.0
acl freeip dst "/etc/freeip"
acl HIT dstdomain .hit.edu.cn
acl Safe_ports port 80 # http
acl Safe_ports port 443 563 # https, snews
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
cache_peer 210.46.69.10 parent 8080 0 no-query
acl conncount maxconn 100
http_access deny conncount all
http_access deny HIT
http_access deny !Safe_ports
http_access allow all
always_direct allow freeip
nonhierarchical_direct off

另外你最好重新编译下内核,加入下面这几行 关于polling你可以查一下相关说明,貌似在大负载下效果比较明显,我这里没有那环境,不过带200多个ip,cpu很少超过20%,pII 400 的u
options         AUTO_EOI_1
makeoptions CONF_CFLAGS=-fno-builtin
options         ZERO_COPY_SOCKETS
options         DEVICE_POLLING
options         HZ=1000
options MAXDSIZ=(512UL*1024*1024)   这一部分根据你的内存调整一下
options MAXSSIZ=(512UL*1024*1024)
options DFLDSIZ=(512UL*1024*1024)
options MSGMNB=16384     # max # of bytes in a queue
options MSGMNI=41       # number of message queue identifiers
options MSGSEG=2049      # number of message segments per queue
options MSGSSZ=64       # size of a message segment
options MSGTQL=2048     # max messages in system
options SHMSEG=32       # max shared mem id's per process
options SHMMNI=64       # max shared mem id's per system
options SHMMAX=4194304  # max shared memory segment size (bytes)
options SHMALL=8192     # max amount of shared memory (pages)

论坛徽章:
0
2 [报告]
发表于 2011-12-22 20:54 |只看该作者
正在做squid,参考一下
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP