2009年3月22日

基于反向代理的Web缓存加速——可缓存的CMS系统设计收藏

内容摘要:

对于一个日访问量达到百万级的网站来说,速度很快就成为一个瓶颈。除了优化内容发布系统的应用本身外,如果能把不需要实时更新的动态页面的输出结果转化成静态网页来发布,速度上的提升效果将是显著的,因为一个动态页面的速度往往会比静态页面慢2-10倍,而静态网页的内容如果能被缓存在内存里,访问速度甚至会比原有动态网页有2-3个数量级的提高

后台的内容管理系统的页面输出遵守可缓存的设计,这样就可以把性能问题交给前台的缓存服务器来解决了,从而大大简化CMS系统本身的复杂程度。

Vignette内容管理系统都有这样的页面名称:0,22342566,300458.html。其实这里的0,22342566,300458就是用逗号分割开的多个参数:

第一次访问找不到页面后,相当于会在服务器端产生一个doc_type= 0&doc_id=22342566&doc_template=300458的查询,

而查询结果会生成的缓存的静态页面: 0,22342566,300458.html

    静态缓存的缺点:

    • 复杂的触发更新机制:这两种机制在内容管理系统比较简单的时候都是非常适用的。但对于一个关系比较复杂的网站来说,页面之间的逻辑引用关系就成为一个非常非常复杂的问题。最典型的例子就是一条新闻要同时出现在新闻首页和相关的3个新闻专题中,在静态缓存模式中,每发一篇新文章,除了这篇新闻内容本身的页面外,还需要系统通过触发器生成多个新的相关静态页面,这些相关逻辑的触发也往往就会成为内容管理系统中最复杂的部分之一。
    • 旧内容的批量更新: 通过静态缓存发布的内容,对于以前生成的静态页面的内容很难修改,这样用户访问旧页面时,新的模板根本无法生效。

    在动态缓存模式中,每个动态页面只需要关心,而相关的其他页面能自动更新,从而大大减少了设计相关页面更新触发器的需要。

    以前做小型应用的时候也用过类似方式:应用首次访问以后将数据库的查询结果在本地存成一个文件,下次请求时先检查本地缓存目录中是否有缓存文件,从而减少对后台数据库的访问。虽然这样做也能承载比较大的负载,但这样的内容管理和缓存管理一体的系统是很难分离的,而且数据完整性也不是很好保存,内容更新时,应用需要把相应内容的的缓存文件删除。但是这样的设计在缓存文件很多的时候往往还需要将缓存目录做一定的分布,否则一个目录下的文件节点超过3000,rm *都会出错。

    这时候,系统需要再次分工,把复杂的内容管理系统分解成:内容输入和缓存这2个相对简单的系统实现。

    • 后台:内容管理系统,专心的将内容发布做好,比如:复杂的工作流管理,复杂的模板规则等……
    • 前台:页面的缓存管理则可以使用缓存系统实现

    ______________________ ___________________

    |Squid Software cache| |F5 Hardware cache|

    ---------------------- -------------------

    \ /

    \ ________________ /

    |ASP |JSP |PHP |

    Content Manage System

    ----------------

    所以分工后:内容管理和缓存管理2者,无论哪一方面可选的余地都是非常大的:软件(比如前台80端口使用SQUID对后台8080的内容发布管理系统进行缓存),缓存硬件,甚至交给akamai这样的专业服务商。

    http://www.squid-cache.org/mail-archive/squid-dev/200301/0164.html

    squid的编译:

    ./configure --enable-useragent-log  --enable-referer-log --enable-default-err-language=Simplify_Chinese \ --enable-err-languages="Simplify_Chinese English" --disable-internal-dns 

    make

    #make install

    #cd /usr/local/squid

    make dir cache

    chown squid.squid *

    vi /usr/local/squid/etc/squid.conf

    在/etc/hosts中:加入内部的DNS解析,比如:

    192.168.0.4 www.chedong.com

    192.168.0.4 news.chedong.com

    192.168.0.3 bbs.chedong.com

    ---------------------cut here----------------------------------

    # visible name

    visible_hostname cache.example.com

    # cache config: space use 1G and memory use 256M

    cache_dir ufs /usr/local/squid/cache 1024 16 256

    cache_mem 256 MB

    cache_effective_user squid

    cache_effective_group squid

    http_port 80

    httpd_accel_host virtual

    httpd_accel_single_host off

    httpd_accel_port 80

    httpd_accel_uses_host_header on

    httpd_accel_with_proxy on

    # accelerater my domain only

    acl acceleratedHostA dstdomain .example1.com

    acl acceleratedHostB dstdomain .example2.com

    acl acceleratedHostC dstdomain .example3.com

    # accelerater http protocol on port 80

    acl acceleratedProtocol protocol HTTP

    acl acceleratedPort port 80

    # access arc

    acl all src 0.0.0.0/0.0.0.0

    # Allow requests when they are to the accelerated machine AND to the

    # right port with right protocol

    http_access allow acceleratedProtocol acceleratedPort acceleratedHostA

    http_access allow acceleratedProtocol acceleratedPort acceleratedHostB

    http_access allow acceleratedProtocol acceleratedPort acceleratedHostC

    # logging

    emulate_httpd_log on

    cache_store_log none

    # manager

    acl manager proto cache_object

    http_access allow manager all

    cachemgr_passwd pass all

    ----------------------cut here---------------------------------

    创建缓存目录:

    /usr/local/squid/sbin/squid -z

    启动squid

    /usr/local/squid/sbin/squid

    停止squid:

    /usr/local/squid/sbin/squid -k shutdown

    启用新配置:

    /usr/local/squid/sbin/squid -k reconfig

    通过crontab每天0点截断/轮循日志:

    0 0 * * * (/usr/local/squid/sbin/squid -k rotate)

    速度甚至会比原有动态网页有2-3个数量级的提高

    后台的内容管理系统的页面输出遵守可缓存的设计,这样就可以把性能问题交给前台的缓存服务器来解决了,从而大大简化CMS系统本身的复杂程度。

    Vignette内容管理系统都有这样的页面名称:0,22342566,300458.html。其实这里的0,22342566,300458就是用逗号分割开的多个参数:

    第一次访问找不到页面后,相当于会在服务器端产生一个doc_type= 0&doc_id=22342566&doc_template=300458的查询,

    而查询结果会生成的缓存的静态页面: 0,22342566,300458.html

      静态缓存的缺点:

      • 复杂的触发更新机制:这两种机制在内容管理系统比较简单的时候都是非常适用的。但对于一个关系比较复杂的网站来说,页面之间的逻辑引用关系就成为一个非常非常复杂的问题。最典型的例子就是一条新闻要同时出现在新闻首页和相关的3个新闻专题中,在静态缓存模式中,每发一篇新文章,除了这篇新闻内容本身的页面外,还需要系统通过触发器生成多个新的相关静态页面,这些相关逻辑的触发也往往就会成为内容管理系统中最复杂的部分之一。
      • 旧内容的批量更新: 通过静态缓存发布的内容,对于以前生成的静态页面的内容很难修改,这样用户访问旧页面时,新的模板根本无法生效。

      在动态缓存模式中,每个动态页面只需要关心,而相关的其他页面能自动更新,从而大大减少了设计相关页面更新触发器的需要。

      以前做小型应用的时候也用过类似方式:应用首次访问以后将数据库的查询结果在本地存成一个文件,下次请求时先检查本地缓存目录中是否有缓存文件,从而减少对后台数据库的访问。虽然这样做也能承载比较大的负载,但这样的内容管理和缓存管理一体的系统是很难分离的,而且数据完整性也不是很好保存,内容更新时,应用需要把相应内容的的缓存文件删除。但是这样的设计在缓存文件很多的时候往往还需要将缓存目录做一定的分布,否则一个目录下的文件节点超过3000,rm *都会出错。

      这时候,系统需要再次分工,把复杂的内容管理系统分解成:内容输入和缓存这2个相对简单的系统实现。

      • 后台:内容管理系统,专心的将内容发布做好,比如:复杂的工作流管理,复杂的模板规则等……
      • 前台:页面的缓存管理则可以使用缓存系统实现

      ______________________ ___________________

      |Squid Software cache| |F5 Hardware cache|

      ---------------------- -------------------

      \ /

      \ ________________ /

      |ASP |JSP |PHP |

      Content Manage System

      ----------------

      所以分工后:内容管理和缓存管理2者,无论哪一方面可选的余地都是非常大的:软件(比如前台80端口使用SQUID对后台8080的内容发布管理系统进行缓存),缓存硬件,甚至交给akamai这样的专业服务商。

      http://www.squid-cache.org/mail-archive/squid-dev/200301/0164.html

      squid的编译:

      ./configure --enable-useragent-log  --enable-referer-log --enable-default-err-language=Simplify_Chinese \ --enable-err-languages="Simplify_Chinese English" --disable-internal-dns 

      make

      #make install

      #cd /usr/local/squid

      make dir cache

      chown squid.squid *

      vi /usr/local/squid/etc/squid.conf

      在/etc/hosts中:加入内部的DNS解析,比如:

      192.168.0.4 www.chedong.com

      192.168.0.4 news.chedong.com

      192.168.0.3 bbs.chedong.com

      ---------------------cut here----------------------------------

      # visible name

      visible_hostname cache.example.com

      # cache config: space use 1G and memory use 256M

      cache_dir ufs /usr/local/squid/cache 1024 16 256

      cache_mem 256 MB

      cache_effective_user squid

      cache_effective_group squid

      http_port 80

      httpd_accel_host virtual

      httpd_accel_single_host off

      httpd_accel_port 80

      httpd_accel_uses_host_header on

      httpd_accel_with_proxy on

      # accelerater my domain only

      acl acceleratedHostA dstdomain .example1.com

      acl acceleratedHostB dstdomain .example2.com

      acl acceleratedHostC dstdomain .example3.com

      # accelerater http protocol on port 80

      acl acceleratedProtocol protocol HTTP

      acl acceleratedPort port 80

      # access arc

      acl all src 0.0.0.0/0.0.0.0

      # Allow requests when they are to the accelerated machine AND to the

      # right port with right protocol

      http_access allow acceleratedProtocol acceleratedPort acceleratedHostA

      http_access allow acceleratedProtocol acceleratedPort acceleratedHostB

      http_access allow acceleratedProtocol acceleratedPort acceleratedHostC

      # logging

      emulate_httpd_log on

      cache_store_log none

      # manager

      acl manager proto cache_object

      http_access allow manager all

      cachemgr_passwd pass all

      ----------------------cut here---------------------------------

      创建缓存目录:

      /usr/local/squid/sbin/squid -z

      启动squid

      /usr/local/squid/sbin/squid

      停止squid:

      /usr/local/squid/sbin/squid -k shutdown

      启用新配置:

      /usr/local/squid/sbin/squid -k reconfig

      通过crontab每天0点截断/轮循日志:

      0 0 * * * (/usr/local/squid/sbin/squid -k rotate)

      http://www.ircache.net/cgi-bin/cacheability.py

      http://www.squid-cache.org/mail-archive/squid-dev/200301/0164.html

        参考资料:

        HTTP代理缓存

        http://vancouver-webpages.com/proxy.html

         

        可缓存的页面设计

        http://linux.oreillynet.com/pub/a/linux/2002/02/28/cachefriendly.html

        运用ASP.NET的输出缓冲来存储动态页面 -  开发者 - ZDNet China

        http://www.zdnet.com.cn/developer/tech/story/0,2000081602,39110239-2,00.htm

        相关RFC文档:

        • RFC

          2616:

          • section

            13 (Caching)

          • section

            14.9 (Cache-Control header)

          • section

            14.21 (Expires header)

          • section

            14.32 (Pragma: no-cache) is important if you are interacting with

            HTTP/1.0 caches

          • section

            14.29 (Last-Modified) is the most common validation method

          • section

            3.11 (Entity Tags) covers the extra validation method

        可缓存性检查

        http://www.web-caching.com/cacheability.html

        缓存设计要素

        http://vancouver-webpages.com/CacheNow/detail.html

        ZOPE上的几篇使用APACHE MOD_PROXY MOD_GZIP加速的文档

        http://www.zope.org/Members/anser/apache_zserver/

        http://www.zope.org/Members/softsign/ZServer_and_Apache_mod_gzip

        http://www.zope.org/Members/rbeer/caching

        原文出处:<a

        href="http://www.chedong.com/tech/cache.html">http://www.chedong.com/tech/cache.html</a>

        <<返回SERVER["REMOTE_ADDR"];

        if (

        内容摘要:

        对于一个日访问量达到百万级的网站来说,速度很快就成为一个瓶颈。除了优化内容发布系统的应用本身外,如果能把不需要实时更新的动态页面的输出结果转化成静态网页来发布,速度上的提升效果将是显著的,因为一个动态页面的速度往往会比静态页面慢2-10倍,而静态网页的内容如果能被缓存在内存里,访问速度甚至会比原有动态网页有2-3个数量级的提高

        后台的内容管理系统的页面输出遵守可缓存的设计,这样就可以把性能问题交给前台的缓存服务器来解决了,从而大大简化CMS系统本身的复杂程度。

        Vignette内容管理系统都有这样的页面名称:0,22342566,300458.html。其实这里的0,22342566,300458就是用逗号分割开的多个参数:

        第一次访问找不到页面后,相当于会在服务器端产生一个doc_type= 0&doc_id=22342566&doc_template=300458的查询,

        而查询结果会生成的缓存的静态页面: 0,22342566,300458.html

          静态缓存的缺点:

          • 复杂的触发更新机制:这两种机制在内容管理系统比较简单的时候都是非常适用的。但对于一个关系比较复杂的网站来说,页面之间的逻辑引用关系就成为一个非常非常复杂的问题。最典型的例子就是一条新闻要同时出现在新闻首页和相关的3个新闻专题中,在静态缓存模式中,每发一篇新文章,除了这篇新闻内容本身的页面外,还需要系统通过触发器生成多个新的相关静态页面,这些相关逻辑的触发也往往就会成为内容管理系统中最复杂的部分之一。
          • 旧内容的批量更新: 通过静态缓存发布的内容,对于以前生成的静态页面的内容很难修改,这样用户访问旧页面时,新的模板根本无法生效。

          在动态缓存模式中,每个动态页面只需要关心,而相关的其他页面能自动更新,从而大大减少了设计相关页面更新触发器的需要。

          以前做小型应用的时候也用过类似方式:应用首次访问以后将数据库的查询结果在本地存成一个文件,下次请求时先检查本地缓存目录中是否有缓存文件,从而减少对后台数据库的访问。虽然这样做也能承载比较大的负载,但这样的内容管理和缓存管理一体的系统是很难分离的,而且数据完整性也不是很好保存,内容更新时,应用需要把相应内容的的缓存文件删除。但是这样的设计在缓存文件很多的时候往往还需要将缓存目录做一定的分布,否则一个目录下的文件节点超过3000,rm *都会出错。

          这时候,系统需要再次分工,把复杂的内容管理系统分解成:内容输入和缓存这2个相对简单的系统实现。

          • 后台:内容管理系统,专心的将内容发布做好,比如:复杂的工作流管理,复杂的模板规则等……
          • 前台:页面的缓存管理则可以使用缓存系统实现

          ______________________ ___________________

          |Squid Software cache| |F5 Hardware cache|

          ---------------------- -------------------

          \ /

          \ ________________ /

          |ASP |JSP |PHP |

          Content Manage System

          ----------------

          所以分工后:内容管理和缓存管理2者,无论哪一方面可选的余地都是非常大的:软件(比如前台80端口使用SQUID对后台8080的内容发布管理系统进行缓存),缓存硬件,甚至交给akamai这样的专业服务商。

          http://www.squid-cache.org/mail-archive/squid-dev/200301/0164.html

          squid的编译:

          ./configure --enable-useragent-log  --enable-referer-log --enable-default-err-language=Simplify_Chinese \ --enable-err-languages="Simplify_Chinese English" --disable-internal-dns 

          make

          #make install

          #cd /usr/local/squid

          make dir cache

          chown squid.squid *

          vi /usr/local/squid/etc/squid.conf

          在/etc/hosts中:加入内部的DNS解析,比如:

          192.168.0.4 www.chedong.com

          192.168.0.4 news.chedong.com

          192.168.0.3 bbs.chedong.com

          ---------------------cut here----------------------------------

          # visible name

          visible_hostname cache.example.com

          # cache config: space use 1G and memory use 256M

          cache_dir ufs /usr/local/squid/cache 1024 16 256

          cache_mem 256 MB

          cache_effective_user squid

          cache_effective_group squid

          http_port 80

          httpd_accel_host virtual

          httpd_accel_single_host off

          httpd_accel_port 80

          httpd_accel_uses_host_header on

          httpd_accel_with_proxy on

          # accelerater my domain only

          acl acceleratedHostA dstdomain .example1.com

          acl acceleratedHostB dstdomain .example2.com

          acl acceleratedHostC dstdomain .example3.com

          # accelerater http protocol on port 80

          acl acceleratedProtocol protocol HTTP

          acl acceleratedPort port 80

          # access arc

          acl all src 0.0.0.0/0.0.0.0

          # Allow requests when they are to the accelerated machine AND to the

          # right port with right protocol

          http_access allow acceleratedProtocol acceleratedPort acceleratedHostA

          http_access allow acceleratedProtocol acceleratedPort acceleratedHostB

          http_access allow acceleratedProtocol acceleratedPort acceleratedHostC

          # logging

          emulate_httpd_log on

          cache_store_log none

          # manager

          acl manager proto cache_object

          http_access allow manager all

          cachemgr_passwd pass all

          ----------------------cut here---------------------------------

          创建缓存目录:

          /usr/local/squid/sbin/squid -z

          启动squid

          /usr/local/squid/sbin/squid

          停止squid:

          /usr/local/squid/sbin/squid -k shutdown

          启用新配置:

          /usr/local/squid/sbin/squid -k reconfig

          通过crontab每天0点截断/轮循日志:

          0 0 * * * (/usr/local/squid/sbin/squid -k rotate)

          http://www.ircache.net/cgi-bin/cacheability.py

          http://www.squid-cache.org/mail-archive/squid-dev/200301/0164.html

            参考资料:

            HTTP代理缓存

            http://vancouver-webpages.com/proxy.html

             

            可缓存的页面设计

            http://linux.oreillynet.com/pub/a/linux/2002/02/28/cachefriendly.html

            运用ASP.NET的输出缓冲来存储动态页面 -  开发者 - ZDNet China

            http://www.zdnet.com.cn/developer/tech/story/0,2000081602,39110239-2,00.htm

            相关RFC文档:

            • RFC

              2616:

              • section

                13 (Caching)

              • section

                14.9 (Cache-Control header)

              • section

                14.21 (Expires header)

              • section

                14.32 (Pragma: no-cache) is important if you are interacting with

                HTTP/1.0 caches

              • section

                14.29 (Last-Modified) is the most common validation method

              • section

                3.11 (Entity Tags) covers the extra validation method

            可缓存性检查

            http://www.web-caching.com/cacheability.html

            缓存设计要素

            http://vancouver-webpages.com/CacheNow/detail.html

            ZOPE上的几篇使用APACHE MOD_PROXY MOD_GZIP加速的文档

            http://www.zope.org/Members/anser/apache_zserver/

            http://www.zope.org/Members/softsign/ZServer_and_Apache_mod_gzip

            http://www.zope.org/Members/rbeer/caching

            原文出处:<a

            href="http://www.chedong.com/tech/cache.html">http://www.chedong.com/tech/cache.html</a>

            <<返回SERVER["HTTP_X_FORWARDED_FOR"]) {

            $user_ip =

            内容摘要:

            对于一个日访问量达到百万级的网站来说,速度很快就成为一个瓶颈。除了优化内容发布系统的应用本身外,如果能把不需要实时更新的动态页面的输出结果转化成静态网页来发布,速度上的提升效果将是显著的,因为一个动态页面的速度往往会比静态页面慢2-10倍,而静态网页的内容如果能被缓存在内存里,访问速度甚至会比原有动态网页有2-3个数量级的提高

            后台的内容管理系统的页面输出遵守可缓存的设计,这样就可以把性能问题交给前台的缓存服务器来解决了,从而大大简化CMS系统本身的复杂程度。

            Vignette内容管理系统都有这样的页面名称:0,22342566,300458.html。其实这里的0,22342566,300458就是用逗号分割开的多个参数:

            第一次访问找不到页面后,相当于会在服务器端产生一个doc_type= 0&doc_id=22342566&doc_template=300458的查询,

            而查询结果会生成的缓存的静态页面: 0,22342566,300458.html

              静态缓存的缺点:

              • 复杂的触发更新机制:这两种机制在内容管理系统比较简单的时候都是非常适用的。但对于一个关系比较复杂的网站来说,页面之间的逻辑引用关系就成为一个非常非常复杂的问题。最典型的例子就是一条新闻要同时出现在新闻首页和相关的3个新闻专题中,在静态缓存模式中,每发一篇新文章,除了这篇新闻内容本身的页面外,还需要系统通过触发器生成多个新的相关静态页面,这些相关逻辑的触发也往往就会成为内容管理系统中最复杂的部分之一。
              • 旧内容的批量更新: 通过静态缓存发布的内容,对于以前生成的静态页面的内容很难修改,这样用户访问旧页面时,新的模板根本无法生效。

              在动态缓存模式中,每个动态页面只需要关心,而相关的其他页面能自动更新,从而大大减少了设计相关页面更新触发器的需要。

              以前做小型应用的时候也用过类似方式:应用首次访问以后将数据库的查询结果在本地存成一个文件,下次请求时先检查本地缓存目录中是否有缓存文件,从而减少对后台数据库的访问。虽然这样做也能承载比较大的负载,但这样的内容管理和缓存管理一体的系统是很难分离的,而且数据完整性也不是很好保存,内容更新时,应用需要把相应内容的的缓存文件删除。但是这样的设计在缓存文件很多的时候往往还需要将缓存目录做一定的分布,否则一个目录下的文件节点超过3000,rm *都会出错。

              这时候,系统需要再次分工,把复杂的内容管理系统分解成:内容输入和缓存这2个相对简单的系统实现。

              • 后台:内容管理系统,专心的将内容发布做好,比如:复杂的工作流管理,复杂的模板规则等……
              • 前台:页面的缓存管理则可以使用缓存系统实现

              ______________________ ___________________

              |Squid Software cache| |F5 Hardware cache|

              ---------------------- -------------------

              \ /

              \ ________________ /

              |ASP |JSP |PHP |

              Content Manage System

              ----------------

              所以分工后:内容管理和缓存管理2者,无论哪一方面可选的余地都是非常大的:软件(比如前台80端口使用SQUID对后台8080的内容发布管理系统进行缓存),缓存硬件,甚至交给akamai这样的专业服务商。

              http://www.squid-cache.org/mail-archive/squid-dev/200301/0164.html

              squid的编译:

              ./configure --enable-useragent-log  --enable-referer-log --enable-default-err-language=Simplify_Chinese \ --enable-err-languages="Simplify_Chinese English" --disable-internal-dns 

              make

              #make install

              #cd /usr/local/squid

              make dir cache

              chown squid.squid *

              vi /usr/local/squid/etc/squid.conf

              在/etc/hosts中:加入内部的DNS解析,比如:

              192.168.0.4 www.chedong.com

              192.168.0.4 news.chedong.com

              192.168.0.3 bbs.chedong.com

              ---------------------cut here----------------------------------

              # visible name

              visible_hostname cache.example.com

              # cache config: space use 1G and memory use 256M

              cache_dir ufs /usr/local/squid/cache 1024 16 256

              cache_mem 256 MB

              cache_effective_user squid

              cache_effective_group squid

              http_port 80

              httpd_accel_host virtual

              httpd_accel_single_host off

              httpd_accel_port 80

              httpd_accel_uses_host_header on

              httpd_accel_with_proxy on

              # accelerater my domain only

              acl acceleratedHostA dstdomain .example1.com

              acl acceleratedHostB dstdomain .example2.com

              acl acceleratedHostC dstdomain .example3.com

              # accelerater http protocol on port 80

              acl acceleratedProtocol protocol HTTP

              acl acceleratedPort port 80

              # access arc

              acl all src 0.0.0.0/0.0.0.0

              # Allow requests when they are to the accelerated machine AND to the

              # right port with right protocol

              http_access allow acceleratedProtocol acceleratedPort acceleratedHostA

              http_access allow acceleratedProtocol acceleratedPort acceleratedHostB

              http_access allow acceleratedProtocol acceleratedPort acceleratedHostC

              # logging

              emulate_httpd_log on

              cache_store_log none

              # manager

              acl manager proto cache_object

              http_access allow manager all

              cachemgr_passwd pass all

              ----------------------cut here---------------------------------

              创建缓存目录:

              /usr/local/squid/sbin/squid -z

              启动squid

              /usr/local/squid/sbin/squid

              停止squid:

              /usr/local/squid/sbin/squid -k shutdown

              启用新配置:

              /usr/local/squid/sbin/squid -k reconfig

              通过crontab每天0点截断/轮循日志:

              0 0 * * * (/usr/local/squid/sbin/squid -k rotate)

              http://www.ircache.net/cgi-bin/cacheability.py

              http://www.squid-cache.org/mail-archive/squid-dev/200301/0164.html

                参考资料:

                HTTP代理缓存

                http://vancouver-webpages.com/proxy.html

                 

                可缓存的页面设计

                http://linux.oreillynet.com/pub/a/linux/2002/02/28/cachefriendly.html

                运用ASP.NET的输出缓冲来存储动态页面 -  开发者 - ZDNet China

                http://www.zdnet.com.cn/developer/tech/story/0,2000081602,39110239-2,00.htm

                相关RFC文档:

                • RFC

                  2616:

                  • section

                    13 (Caching)

                  • section

                    14.9 (Cache-Control header)

                  • section

                    14.21 (Expires header)

                  • section

                    14.32 (Pragma: no-cache) is important if you are interacting with

                    HTTP/1.0 caches

                  • section

                    14.29 (Last-Modified) is the most common validation method

                  • section

                    3.11 (Entity Tags) covers the extra validation method

                可缓存性检查

                http://www.web-caching.com/cacheability.html

                缓存设计要素

                http://vancouver-webpages.com/CacheNow/detail.html

                ZOPE上的几篇使用APACHE MOD_PROXY MOD_GZIP加速的文档

                http://www.zope.org/Members/anser/apache_zserver/

                http://www.zope.org/Members/softsign/ZServer_and_Apache_mod_gzip

                http://www.zope.org/Members/rbeer/caching

                原文出处:<a

                href="http://www.chedong.com/tech/cache.html">http://www.chedong.com/tech/cache.html</a>

                <<返回SERVER["HTTP_X_FORWARDED_FOR"];

                }

                }

                注意:HTTP_X_FORWARDED_FOR如果经过了多个中间代理服务器,有何能是逗号分割的多个地址,

                比如:200.28.7.155,200.10.225.77 unknown,219.101.137.3

                因此在很多旧的数据库设计中(比如BBS)往往用来记录客户端地址的字段被设置成20个字节就显得过小了。

                经常见到类似以下的错误信息:

                Microsoft JET Database Engine 错误 '80040e57'

                字段太小而不能接受所要添加的数据的数量。试着插入或粘贴较少的数据。

                /inc/char.asp,行236 原因就是在设计客户端访问地址时,相关用户IP字段大小最好要设计到50个字节以上,当然经过3层以上代理的几率也非常小。

                如何检查目前站点页面的可缓存性(Cacheablility)呢?可以参考以下2个站点上的工具:

                http://www.ircache.net/cgi-bin/cacheability.py

                http://www.squid-cache.org/mail-archive/squid-dev/200301/0164.html

                  参考资料:

                  HTTP代理缓存

                  http://vancouver-webpages.com/proxy.html

                   

                  可缓存的页面设计

                  http://linux.oreillynet.com/pub/a/linux/2002/02/28/cachefriendly.html

                  运用ASP.NET的输出缓冲来存储动态页面 -  开发者 - ZDNet China

                  http://www.zdnet.com.cn/developer/tech/story/0,2000081602,39110239-2,00.htm

                  相关RFC文档:

                  • RFC

                    2616:

                    • section

                      13 (Caching)

                    • section

                      14.9 (Cache-Control header)

                    • section

                      14.21 (Expires header)

                    • section

                      14.32 (Pragma: no-cache) is important if you are interacting with

                      HTTP/1.0 caches

                    • section

                      14.29 (Last-Modified) is the most common validation method

                    • section

                      3.11 (Entity Tags) covers the extra validation method

                  可缓存性检查

                  http://www.web-caching.com/cacheability.html

                  缓存设计要素

                  http://vancouver-webpages.com/CacheNow/detail.html

                  ZOPE上的几篇使用APACHE MOD_PROXY MOD_GZIP加速的文档

                  http://www.zope.org/Members/anser/apache_zserver/

                  http://www.zope.org/Members/softsign/ZServer_and_Apache_mod_gzip

                  http://www.zope.org/Members/rbeer/caching

                  原文出处:<a

                  href="http://www.chedong.com/tech/cache.html">http://www.chedong.com/tech/cache.html</a>

                  • 0
                    点赞
                  • 0
                    收藏
                    觉得还不错? 一键收藏
                  • 0
                    评论
                  评论
                  添加红包

                  请填写红包祝福语或标题

                  红包个数最小为10个

                  红包金额最低5元

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

                  抵扣说明:

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

                  余额充值