<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ubuntu,debian,redhat -linuxany.com &#187; Cache</title>
	<atom:link href="http://www.linuxany.com/archives/tag/cache/feed" rel="self" type="application/rss+xml" />
	<link>http://www.linuxany.com</link>
	<description>ubuntu,debian,redhat,fedora,centos</description>
	<lastBuildDate>Thu, 29 Jul 2010 13:01:19 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>手工释放linux内存——/proc/sys/vm/drop_caches</title>
		<link>http://www.linuxany.com/archives/814.html</link>
		<comments>http://www.linuxany.com/archives/814.html#comments</comments>
		<pubDate>Tue, 18 Aug 2009 16:09:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[buffer]]></category>
		<category><![CDATA[Cache]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[memory]]></category>

		<guid isPermaLink="false">http://www.linuxany.com/?p=814</guid>
		<description><![CDATA[    当在Linux下频繁存取文件后，物理内存会很快被用光，当程序结束后，内存不会被正常释放，而是一直作为caching。这个问题，貌似有不少人在问，不过都没有看到有什么很好解决的办法。那么我来谈谈这个问题。
一、通常情况
先来说说free命令：

引用
[root@server ~]# free -m
total used free shared buffers cached
Mem: 249 163 86 0 10 94
-/+ buffers/cache: 58 191
Swap: 511 0 511
其中：
引用
total 内存总数
used 已经使用的内存数
free 空闲的内存数
shared 多个进程共享的内存总额
buffers Buffer Cache和cached Page Cache 磁盘缓存的大小
-buffers/cache 的内存数:used &#8211; buffers &#8211; cached
+buffers/cache 的内存数:free + buffers + cached
可用的memory=free memory+buffers+cached。
有了这个基础后，可以得知，我现在used为163MB，free为86MB，buffer和cached分别为10MB，94MB。
那么我们来看看,如果我执行复制文件,内存会发生什么变化.
引用
[root@server ~]# cp -r /etc ~/test/
[root@server ~]# free -m
total used free shared buffers cached
Mem: 249 [...]]]></description>
		<wfw:commentRss>http://www.linuxany.com/archives/814.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Squid查看缓存命中率</title>
		<link>http://www.linuxany.com/archives/733.html</link>
		<comments>http://www.linuxany.com/archives/733.html#comments</comments>
		<pubDate>Mon, 12 Jan 2009 06:57:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Squid]]></category>
		<category><![CDATA[Cache]]></category>

		<guid isPermaLink="false">http://www.linuxlaptop.cn/?p=733</guid>
		<description><![CDATA[server:/usr/local/squid/bin# ./squidclient -h www.linuxlaptop.cn -p 80 mgr:info
Cache information for squid:&#160;&#160; &#160; &#160; &#160;Hits as % of all requests:&#160; &#160; &#160; 5min: 0.0%, 60min: 0.0%&#160;&#160; &#160; &#160; &#160;Hits as % of bytes sent:&#160; &#160; &#160; &#160; 5min: -0.0%, 60min: -0.0%&#160;&#160; &#160; &#160; &#160;Memory hits as % of hit requests:&#160; &#160; &#160; &#160;5min: 0.0%, 60min: 0.0%&#160;&#160; &#160; [...]]]></description>
		<wfw:commentRss>http://www.linuxany.com/archives/733.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>使用Varnish代替Squid做网站缓存加速器的详细解决方案</title>
		<link>http://www.linuxany.com/archives/269.html</link>
		<comments>http://www.linuxany.com/archives/269.html#comments</comments>
		<pubDate>Tue, 25 Mar 2008 13:10:12 +0000</pubDate>
		<dc:creator>x72</dc:creator>
				<category><![CDATA[1.Application]]></category>
		<category><![CDATA[Cache]]></category>
		<category><![CDATA[Squid]]></category>
		<category><![CDATA[Varnish]]></category>

		<guid isPermaLink="false">http://www.linuxlaptop.cn/index.php/archives/276</guid>
		<description><![CDATA[我看来，使用Varnish代替Squid的理由有三点：
　　1、Varnish采用了“Visual Page Cache”技术，在内存的利用上，Varnish比Squid具有优势，它避免了Squid频繁在内存、磁盘中交换文件，性能要比Squid高。
　　2、Varnish的稳定性还不错，我管理的一台图片服务器运行Varnish已经有一个月，没有发生过故障，而进行相同工作的Squid服务器就倒过几次。
　　3、通过Varnish管理端口，可以使用正则表达式快速、批量地清除部分缓存，这一点是Squid不能具备的。

　　

　　下面来安装Varnish网站缓存加速器（Linux系统）：
　　1、创建www用户和组，以及Varnish缓存文件存放目录（/var/vcache）：
 
/usr/sbin/groupadd www -g 48
/usr/sbin/useradd -u 48 -g www www
mkdir -p /var/vcache
chmod +w /var/vcache
chown -R www:www /var/vcache
　　2、创建Varnish日志目录（/var/logs/）：
mkdir -p /var/logs
chmod +w /var/logs
chown -R www:www /var/logs
　　3、编译安装varnish：
wget http://blog.s135.com/soft/linux/varnish/varnish-1.1.2.tar.gz
tar zxvf varnish-1.1.2.tar.gz
cd varnish-1.1.2
./configure &#8211;prefix=/usr/local/varnish
make &#38;&#38; make install
　　4、创建Varnish配置文件：
vi /usr/local/varnish/vcl.conf
　　输入以下内容：

引用
backend myblogserver {
       set backend.host = &#8220;192.168.0.5&#8243;;
       set backend.port = &#8220;80&#8243;;
}
acl purge {
       &#8221;localhost&#8221;;
      [...]]]></description>
		<wfw:commentRss>http://www.linuxany.com/archives/269.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Varnish Cache网站加速器</title>
		<link>http://www.linuxany.com/archives/268.html</link>
		<comments>http://www.linuxany.com/archives/268.html#comments</comments>
		<pubDate>Tue, 25 Mar 2008 13:06:13 +0000</pubDate>
		<dc:creator>x72</dc:creator>
				<category><![CDATA[1.Application]]></category>
		<category><![CDATA[Cache]]></category>
		<category><![CDATA[Squid]]></category>
		<category><![CDATA[Varnish]]></category>

		<guid isPermaLink="false">http://www.linuxlaptop.cn/index.php/archives/275</guid>
		<description><![CDATA[Varnish是一款高性能的开源HTTP加速器，挪威最大的在线报纸 Verdens Gang (vg.no) 使用3台Varnish代替了原来的12台squid，性能比以前更好。
　　Varnish的作者Poul-Henning Kamp是FreeBSD的内核开发者之一，他认为现在的计算机比起1975年已经复杂许多。在1975年时，储存媒介只有两种：内存与硬盘。但现在计算机系统的内存除了主存外，还包括了cpu内的L1、L2，甚至有L3快取。硬盘上也有自己的快取装置，因此squid cache自行处理物件替换的架构不可能得知这些情况而做到最佳化，但操作系统可以得知这些情况，所以这部份的工作应该交给操作系统处理，这就是Varnish cache设计架构。

　　Varnish可以在FreeBSD 6.0和Linux 2.6内核上运行。
　　1、编译安装varnish HTTP加速器：

引用
wget http://blog.s135.com/soft/linux/varnish/varnish-1.1.1.tar.gz
tar zxvf varnish-1.1.1.tar.gz
cd varnish-1.1.1
./configure &#8211;prefix=/usr/local/varnish
make &#38;&#38; make install

　　2、简单启动varnish守护进程，用本机80端口去反向代理加速127.0.0.1:81上的Apache服务器：

引用
/usr/local/varnish/sbin/varnishd -a :8080 -b 127.0.0.1:81 -p thread_pool_max=1500 -p thread_pools=5 -p listen_depth=512 -p client_http11=on -w 1,10000,120

　　Varnish官方网站：http://www.varnish-cache.org/
　　另有一份PDF文档，说明Varnish原理的：http://ishare.iask.sina.com.cn/cgi-bin/fileid.cgi?fileid=2163384
　　我测试了一下，在同等配置环境下，Varnish的性能确实要超过Squid，稳定性也不错，值得继续去深入研究。
您还可能感兴趣的内容使用Varnish代替Squid做网站缓存加速器的详细解决方案Squid查看缓存命中率squid3安装与反向代理配置手工释放linux内存——/proc/sys/vm/drop_cachesLinux下DNS轮询与Squid反向代理结合]]></description>
		<wfw:commentRss>http://www.linuxany.com/archives/268.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
