今天对我的varnish进行了下小小的压力测试,40s里的8000并发,没有失败一个,估计还可以承受更大的并发,先不说varnish了,我最近找到个命中率很高的squid的配置文件,当然是squid3.0的配置文件,有需要的可以copy回去自己改。

系统:centos 5.x
需要的软件:squid-3.0.STABLE25.tar.gz

1.下载squid

复制代码 代码如下:
wget http://www.squid-cache.org/Versions/v3/3.0/squid-3.0.STABLE25.tar.gz
tar zxf squid-3.0.STABLE25.tar.gz && cd squid-3.0.STABLE25

2.编译squid


复制代码 代码如下:
./configure --prefix=/usr/local/squid \
--enable-async-io=100 \
--with-pthreads \
--enable-storeio="aufs,diskd,ufs" \
--enable-removal-policies="heap,lru" \
--enable-icmp \
--enable-delay-pools \
--enable-useragent-log \
--enable-referer-log \
--enable-kill-parent-hack \
--enable-arp-acl \
--enable-default-err-language=Simplify_Chinese \
--enable-err-languages="Simplify_Chinese English" \
--disable-poll \
--disable-wccp \
--disable-wccpv2 \
--disable-ident-lookups \
--disable-internal-dns \
--enable-basic-auth-helpers="NCSA" \
--enable-stacktrace \
--with-large-files \
--disable-mempools \
--with-filedescriptors=65536 \
--enable-ssl \
--enable-x-accelerator-var

make
make install
make install-pinger

3.配置squid

复制代码 代码如下:
cp /usr/local/squid/etc/squid.conf /usr/local/squid/etc/squid.conf.old
>/usr/local/squid/etc/squid.conf
ln -s /usr/local/squid/etc/squid.conf /etc/squid.conf

squid.conf里的内容:


复制代码 代码如下:
#accel listen port
http_port 80 accel vhost vport
#accel domain
cache_peer xx.xx.xx.xx parent 80 0 no-query originserver no-digest name=a
cache_peer_domain a blog.slogra.com
 
#acl
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl SSL_ports port 443 563
acl Safe_ports port 80       # http
acl Safe_ports port 8080
acl LanSrc src all
acl LanDst dst all
acl LanDstDM dstdomain blog.slogra.com
 
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 LanSrc
http_access allow LanDst
http_access allow LanDstDM
http_access deny   all
 
#base
visible_hostname blog.slogra.com
cache_mgr rocdk890@gmail.com
cache_effective_user squid
cache_effective_group squid
 
error_directory /usr/local/squid/share/errors/Simplify_Chinese
icon_directory /usr/local/squid/share/icons
mime_table /usr/local/squid/etc/mime.conf
 
cache_replacement_policy lru
#cache_dir
cache_dir aufs /var/cache1 32768 64 64
cache_dir aufs /var/cache2 32768 64 64
cache_mem 2048 MB
max_open_disk_fds 0
#maximum_object_size 512 KB
#maximum_object_size_in_memory 256 KB
maximum_object_size 20 MB
maximum_object_size_in_memory 8 MB
 
#keepalived
client_persistent_connections off
server_persistent_connections on
#persistent_request_timeout 60 seconds
 
#memory_pools on
#memory_pools_limit 64 MB
 
forwarded_for on
log_icp_queries off
 
via off
httpd_suppress_version_string off
 
ie_refresh off
tcp_recv_bufsize 32 KB
 
#acl webservices rep_header Server -i ^linuxtoneWS ^Apache ^nginx
#broken_vary_encoding allow webservices
 
#hidden the squid header
#reply_header_access Server deny all
#reply_header_access X-Cache deny all
#reply_header_access Warning deny all
#reply_header_access Expires deny all
#reply_header_access Cache-Control deny all
#reply_header_access age deny all
#reply_header_access All deny all
 
ipcache_size 1024
ipcache_low 90
ipcache_high 95
 
memory_replacement_policy lru
 
hosts_file /etc/hosts
request_header_max_size 128 KB
 
#deny cache
hierarchy_stoplist cgi-bin "codetitle">复制代码 代码如下:
/usr/sbin/groupadd squid
/usr/sbin/useradd -g squid squid
mkdir -p /var/log/squid
chown -R squid:squid /var/log/squid
mkdir -p /var/{cache1,cache2}
chown -R squid:squid /var/{cache1,cache2}

初始化squid的cache目录
复制代码 代码如下:
/usr/local/squid/sbin/squid -z

启动squid
复制代码 代码如下:
/usr/local/squid/sbin/squid -D

如果大家不喜欢这样的启动方式,可以自己去找个squid的启动脚本,这里就不放出了.当squid运行起来了之后,大家可以使用下面这个命令来查看命中率:
复制代码 代码如下:
/usr/local/squid/bin/squidclient -p 80 mgr:info

好了,具体其他squid的使用命令就只能你们自己去搜了,就到这里了.

标签:
squid3,缓存服务器,编译安装,高命中率配置

免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com

RTX 5090要首发 性能要翻倍!三星展示GDDR7显存

三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。

首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。

据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。