Squid 配置手札 [1] Posted on August 16th

本文详细介绍了Squid代理服务器的配置方法,包括硬件选择、系统推荐、缓存请求计算公式及具体配置参数示例等内容。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

原贴:http://enissue.com/archive/48

Squid 配置手札 [1] Posted on August 16th

khan.chan {at} enissue.com

原文地址: http://enissue.com/archive/48

硬件需求:

  • SCSI 寻道时间|转速
  • RAM 最重要
  • 建议 不用RAID

系统要求:

  • 推荐FreeBSD
  • RHEL 4
  • 疑问: Squid 2.X能够使用线程来完成AIO,性能表现也要优于以前的方式,不过大部分人都是推荐FreeBSD, 原因我还是不很清晰. KqueueEpoll好吗?

Cache per request:

A cache with one disk has to seek at least once per request (ignoring RAM caching of the disk and inode update times). 
If you have only one disk, the formula for working out seeks per second (and hence requests per second) is quite simple:
  • requests per second = 1000/seek time
  • requests per second = 1000/seek time/(number of disks)
  • 寻道时间和硬盘数影响requests per second !

Resource:

A cache with one disk has to seek at least once per request (ignoring RAM caching of the disk and inode update times). 
If you have only one disk, the formula for working out seeks per second (and hence requests per second) is quite simple:

 

Version: 2.6 _反向代理_RHEL 4

Config.sh

–enable-large-cache-files –with-large-files

–enable-kill-parent-hack –disable-arp-acl

–disable-deplay-pools –disable-ident-lookups

–disable-mem-gen-trace –disable-useragent-log

–enable-epoll –enable-snmp

–enable-async-io=100

–enable-useragent-log –enable-referer-log

–enable-dlmalloc

–with-pthreas –enable-epoll –enable-storeio=”aufs,coss,diskd,ufs”

–enable-stacktrace –enable-removal-policies=”heap,lru”

–enable-deplay-pools –disable-internal-dns

–enable-default-err-language=Simplify_Chinese

–enable-err-languages=”Simplify_Chinese English”

Ps: ChinaCache squid V 2.5

–prefix=/usr/local/squid –enable-epoll –disable-ident-lookups –enable-async-io=160 –enable-storeio=ufs,aufs,diskd –enable-snmp –enable-cache-digests –enable-useragent-log –enable-referer-log –enable-kill-parent-hack –enable–internal-dns

总结: –enable-dlmalloc

–enable-async-io=160 等同于下面三个参数

–with-aufs-threads=N_THREADS –with-pthreads –enable-storeio=afs,aufs

–enable-removal-policies=”heap,lru”

cache_dir aufs /data/cache1 28000 16 256

cache_dir aufs /data/cache2 28000 16 256

cache_mem 1768 MB

cache_swap_low 70

cache_swap_high 80

maximum_object_size 204800 KB
minimum_object_size 0 KB
maximum_object_size_in_memory 102400 KB

cache_replacement_policy lru

memory_replacement_policy lru

#设定snmp端口

snmp_port 3401

emulate_httpd_log on

logformat combined %>a %ui %un [%tl] “%rm %ru HTTP/%rv” %Hs %h” “%{User-Agent}>h” %Ss:%Sh

cache_log /patch/logs/cache.log

cache_store_log none

acl QUERY urlpath_regex cgi-bin /?

cache deny QUERY

# Vary: Accept-Encoding apache mod_deflate

cache_vary on

#设定icp规则,icp用于实现squidcache共享

icp_port 3030

udp_incoming_address IP(other cache server)

log_icp_queries on

#设定squid sibling(同级协作squid)

cache_peer IP(other cache server) sibling 80 3030 proxy-only

Trackback URL
Leave your own comments about this post:
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值