squid代理上网性能调优参数

2012年9月23日 | 分类: 代理工具 | 标签: , ,

squid默认安装就可以代理上网了。但是上网的速度并不是很快,我们需要对一些配置参数进行调整,让squid发挥最大的威力。

我们的服务器是debian 6.x系统,在系统默认的配置上面,我们做了如下修改:

diff --git a/squid.conf b/squid_new.conf
index 216bfa7..e7ea678 100644
--- a/squid.conf
+++ b/squid_new.conf
@@ -601,6 +601,7 @@
 acl all src all
 acl manager proto cache_object
 acl localhost src 127.0.0.1/32
+#acl localnet src 192.168.0.0/24
 acl to_localhost dst 127.0.0.0/8 0.0.0.0/32
 #
 # Example rule allowing access from your local networks.
@@ -1736,6 +1737,7 @@ hierarchy_stoplist cgi-bin ?
 #
 #Default:
 # cache_mem 8 MB
+cache_mem 16 MB

 #  TAG: maximum_object_size_in_memory	(bytes)
 #	Objects greater than this size will not be attempted to kept in
@@ -1745,6 +1747,7 @@ hierarchy_stoplist cgi-bin ?
 #
 #Default:
 # maximum_object_size_in_memory 8 KB
+maximum_object_size_in_memory 1 MB

 #  TAG: memory_replacement_policy
 #	The memory replacement policy parameter determines which
@@ -1754,6 +1757,8 @@ hierarchy_stoplist cgi-bin ?
 #
 #Default:
 # memory_replacement_policy lru
+memory_replacement_policy lru
+

 # DISK CACHE OPTIONS
@@ -1796,6 +1801,7 @@ hierarchy_stoplist cgi-bin ?
 #
 #Default:
 # cache_replacement_policy lru
+cache_replacement_policy heap LFUDA

 #  TAG: cache_dir
 #	Usage:
@@ -1943,6 +1949,7 @@ hierarchy_stoplist cgi-bin ?
 #
 #Default:
 # cache_dir ufs /var/spool/squid 100 16 256
+cache_dir diskd /var/spool/squid 512 16 256

 #  TAG: store_dir_select_algorithm
 #	Set this to 'round-robin' as an alternative.
@@ -2400,12 +2407,16 @@ access_log /var/log/squid/access.log squid
 #
 #Default:
 # diskd_program /usr/lib/squid/diskd-daemon
+diskd_program /usr/lib/squid/diskd-daemon
+

 #  TAG: unlinkd_program
 #	Specify the location of the executable for file deletion process.
 #
 #Default:
 # unlinkd_program /usr/lib/squid/unlinkd
+unlinkd_program /usr/lib/squid/unlinkd
+

 #  TAG: pinger_program
 # Note: This option is only available if Squid is rebuilt with the
@@ -4884,6 +4895,7 @@ coredump_dir /var/spool/squid
 #
 #Default:
 # pipeline_prefetch off
+pipeline_prefetch on

 #  TAG: high_response_time_warning	(msec)
 #	If the one-minute median response time exceeds this value,

来源http://www.netroby.com/view.php?id=3486

目前还没有任何评论.