> CentOS > CentOS运维 >

提高squid缓存的命中率

 安装运行squid后用命令

squidclient -t 1 -h localhost -p 80 mgr:info 查看命中率情况



Request Hit Ratios:     5min: 99.6%, 60min: 98.7%    Cache Request命中率

Byte Hit Ratios:        5min: 100.0%, 60min: 100.0%    Cache Byte命中率



如果命中率低 则

1  apache中的模块 mod_expires是否打开



2  调整squid中的参数
# cache_mem 8 MB
cache_mem 64 MB

# maximum_object_size 4096 KB
maximum_object_size 16384 KB

# maximum_object_size_in_memory 8 KB
maximum_object_size_in_memory 256 KB

# ipcache_size 1024
ipcache_size 2048

#Default:
cache_dir ufs /usr/local/squid/cache 2048 32 512
3  如果apache中使用了deflate压缩
   设置   cache_vary on

4 如果用nginx 可以用第三方模块mod_urlhash 提高命中率
(责任编辑:IT)