为了优化网站的访问速度,准备采用HttpCompressionModule 6对传输数据进行压缩,下载了HttpCompressionModule 6 , 并按照示例程序中的web.config配置了网站的web.config。

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
   <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
   <sectionGroup name="blowery.web">
         <section name="httpCompress" type="blowery.Web.HttpCompress.SectionHandler, blowery.Web.HttpCompress"/>
      </sectionGroup>
     </configSections>
  <appSettings>
    <add key="FCKeditor:UserFilesPath" value="/KeyuSoftShanyou/UserFiles" />
    <add key="SearchIndexDir" value="~/index" />
  </appSettings>
  
  
  <!-- config section for my http module -->
  <blowery.web>
    <!--
   Here's an example on how to change the algorithm or compression level
   
      <compressionModule preferredAlgorithm="deflate|gzip" compressionLevel="high|normal|low"/>
   
   so, to use deflate by default, and high compression, you would use the following line
   -->
    <httpCompress preferredAlgorithm="gzip" compressionLevel="high">
      <excludedMimeTypes>
        <add type="image/jpeg"/>
        <add type="image/png"/>
        <add type="image/gif"/>
      </excludedMimeTypes>
      <excludedPaths>
        <!--<add path="NoCompress.aspx"/>-->
      </excludedPaths>
    </httpCompress>
  </blowery.web>
  
  <system.web>   
     
     
     <httpModules>
 <!-- <add type="KeyuSoftShanyou.Util.NHSessionModule, KeyuSoftShanyou" name="NHSessionModule" />-->
         <add name="CompressionModule" type="blowery.Web.HttpCompress.HttpModule, blowery.web.HttpCompress"/>
     </httpModules>
 
   
    <authentication mode="Forms">
  <forms name="shanyouCookie" loginUrl="Admin/login.aspx" protection="All" timeout="90"/>
 </authentication>

<authorization>  <allow users="*" />   </authorization>

<compilation        defaultLanguage="c#"      debug="true"  />
    <customErrors   defaultRedirect="Error.aspx"  mode="RemoteOnly" />

<trace   enabled="false"    requestLimit="10"        pageOutput="false"
        traceMode="SortByTime"
  localOnly="true"
    />

<sessionState 
            mode="InProc"
            stateConnectionString="tcpip=127.0.0.1:42424"
            sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
            cookieless="false" 
            timeout="20" 
    />

<globalization  requestEncoding="utf-8" responseEncoding="utf-8" />
     <!-- 2003-12-03, Rob Eberhardt - http://slingfive.com/demos/browserCaps/  firefox 浏览器问题 -->

<browserCaps>
  <!-- GECKO Based Browsers (Netscape 6+, Mozilla/Firebird, ...) //-->
  <case match="^Mozilla/5\.0 \([^)]*\) (Gecko/[-\d]+)? (?'type'[^/\d]*)([\d]*)/(?'version'(?'major'\d+)(?'minor'\.\d+)(?'letters'\w*)).*">
    browser=Gecko
    type=${type}
    frames=true
    tables=true
    cookies=true
    javascript=true
    javaapplets=true
    ecmascriptversion=1.5
    w3cdomversion=1.0
    css1=true
    css2=true
    xml=true
    tagwriter=System.Web.UI.HtmlTextWriter
    <case match="rv:(?'version'(?'major'\d+)(?'minor'\.\d+)(?'letters'\w*))">
      version=${version}
      majorversion=${major}
      minorversion=${minor}
      <case match="^b" with="${letters}">
        beta=true
      </case>
    </case>
  </case>
  
  <!-- AppleWebKit Based Browsers (Safari...) //-->
  <case match="AppleWebKit/(?'version'(?'major'\d)(?'minor'\d+)(?'letters'\w*))">
    browser=AppleWebKit
    version=${version}
    majorversion=${major}
    minorversion=0.${minor}
    frames=true
    tables=true
    cookies=true
    javascript=true
    javaapplets=true
    ecmascriptversion=1.5
    w3cdomversion=1.0
    css1=true
    css2=true
    xml=true
    tagwriter=System.Web.UI.HtmlTextWriter
    <case match="AppleWebKit/(?'version'(?'major'\d)(?'minor'\d+)(?'letters'\w*))( \(KHTML, like Gecko\) )?(?'type'[^/\d]*)/.*$">
      type=${type}
    </case>
  </case>
  <!-- Konqueror //-->
  <case match = "Konqueror/(?'version'(?'major'\d+)(?'minor'\.\d+)(?'letters'));\w*(?'platform'[^\)]*)">
    browser=Konqueror
    version=${version}
    majorversion=${major}
    minorversion=${minor}
    platform=${platform}
    type=Konqueror
    frames=true
    tables=true
    cookies=true
    javascript=true
    javaapplets=true
    ecmascriptversion=1.5
    w3cdomversion=1.0
    css1=true
    css2=true
    xml=true
    tagwriter=System.Web.UI.HtmlTextWriter
  </case>
</browserCaps>

</system.web>
  <!-- This section contains the log4net configuration settings --> 
   <log4net>  <!-- Define some output appenders --> 
    <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
       <param name="File" value="log.txt" /> 
       <param name="AppendToFile" value="true" />  
       <param name="MaxSizeRollBackups" value="2" /> 
       <param name="MaximumFileSize" value="100KB" />  
       <param name="RollingStyle" value="Size" />   
       <param name="StaticLogFileName" value="true" /> 
       <layout type="log4net.Layout.PatternLayout">   
  <param name="Header" value="[Header]\r\n" /> 
  <param name="Footer" value="[Footer]\r\n" />   
  <param name="ConversionPattern" value="%d [%t] %-5p %c [%x] - %m%n" />  
       </layout> 
     </appender>  
    <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">   
  <layout type="log4net.Layout.PatternLayout">  
    <param name="ConversionPattern" value="%d [%t] %-5p %c [%x] &lt;%X{auth}&gt; - %m%n" />   
    </layout>  </appender>  <!-- Set root logger level to ERROR and its appenders -->  
    <root>
    <level value="ERROR" /> 
        <appender-ref ref="RollingLogFileAppender" />  
        <appender-ref ref="ConsoleAppender" /> 
    </root>  
        <!-- Print only messages of level DEBUG or above in the packages --> 
      <logger name="IBatisNet.DataMapper.Configuration.Cache.CacheModel"> 
          <level value="DEBUG" /> 
       </logger> 
              
        <logger name="IBatisNet.DataMapper.Configuration.Statements.PreparedStatementFactory">  
             <level value="DEBUG" /> 
         </logger>  
     <logger name="IBatisNet.DataMapper.LazyLoadList">  
     <level value="DEBUG" />
     </logger> 
 </log4net>
 
</configuration>

使用效果:
使用HttpCompressionModule自带的Fetch工具进行测试,测试结果如下:

测试结果说明:
第一行数据是未使用HttpCompressionModule的测试结果。
第二行数据是使用deflate压缩算法进行压缩后的测试结果。
第二列数据是Web服务器传递到浏览器的文件大小。很明显,压缩后传输数据大大减少,有效地节约了带宽。
TTFB—首字节平均响应时间(Gets the number of milliseconds that have passed before the first byte of the response was received.)
TTLB—末字节平均响应时间(Gets the number of milliseconds that passed before the last byte of the response was received. )
Transit—传输数据到浏览器的时间。
从测试结果可以看出, 采用HttpCompressionModule后访问速度有明显改善。

http://www.asp.net/ControlGallery/ControlDetail.aspx?Control=696&tabindex=2

http://www.blowery.org/code/HttpCompressionModule.html

网站速度优化模块HttpCompressionModule的更多相关文章

  1. (转)网站速度优化技巧:Nginx设置js、css过期时间

    网站速度优化技巧:Nginx设置js.css过期时间 原文:http://www.webkaka.com/blog/archives/Nginx-set-the-expiration-time-for ...

  2. netty系列之:一个价值上亿的网站速度优化方案

    目录 简介 本文的目标 支持多个图片服务 http2处理器 处理页面和图像 价值上亿的速度优化方案 总结 简介 其实软件界最赚钱的不是写代码的,写代码的只能叫马龙,高级点的叫做程序员,都是苦力活.那么 ...

  3. [转]Asp.net mvc 网站之速度优化 -- 页面缓存

    网站速度优化的一般方法 由于网站最重要的用户体验就是速度,特别是对于电子商务网站而言. 一般网站速度优化会涉及到几个方面: 1. 数据库优化 — 查询字段简历索引,使用数据库连接池和持久化,现在还有种 ...

  4. Asp.net mvc 网站之速度优化 -- 页面缓存

    网站速度优化的一般方法 由于网站最重要的用户体验就是速度,特别是对于电子商务网站而言. 一般网站速度优化会涉及到几个方面: 1. 数据库优化 — 查询字段简历索引,使用数据库连接池和持久化,现在还有种 ...

  5. web访问速度优化分析

    请求从发出到接收完成一共经历了DNS Lookup.Connecting.Blocking.Sending.Waiting和Receiving六个阶段,时间共计38ms.请求完成之后是DOM加载和页面 ...

  6. 这些优化 Drupal 网站速度的超简单办法,你忽略了多少?

    “怎么样能让我的 Drupal 网站更快一些?”是我们最常遇到的一个问题.站点速度确实非常重要,因为它会影响你的 SEO排名效果.访客是否停留以及你自己管理网站所需要的时间. 今天我们就来看看那些通过 ...

  7. php网站速度性能优化(转)

    一个网站的访问打开速度至关重要,特别是首页的打开加载过慢是致命性的,本文介绍关于php网站性能优化方面的实战案例:淘宝首页加载速度优化实践 .想必很多人都已经看到了新版的淘宝首页,它与以往不太一样,这 ...

  8. 网站性能优化(Yahoo 35条)

    Yahoo 网站性能优化 35条 一.内容部分 尽量减少 HTTP请求 减少 DNS查找 避免跳转 缓存 Ajxa 推迟加载 提前加载 减少 DOM元素数量 用域名划分页面内容 使 frame数量最少 ...

  9. 【转】Yahoo!团队:网站性能优化的35条黄金守则

    Yahoo!的 Exceptional Performance团队为改善 Web性能带来最佳实践.他们为此进行了一系列的实验.开发了各种工具.写了大量的文章和博客并在各种会议上参与探讨.最佳实践的核心 ...

随机推荐

  1. struts.xml 文件添加DTD文件

    在编辑struts.xml 文件时,“alt + /”无提示信息,需要在myeclipse 中添加消息头中的文件,步骤如下: 1. 选中该段复制 2. Preferences——>XML Cat ...

  2. SQL基本点—— 思维导图

  3. Struts2简介以及结果集转发

    一.分析之前的项目的不足,编写属于自己的框架二.Struts2简介(面试)三.搭建Struts2的开发环境 1.找到所需的jar包:发行包的lib目录中(不同版本需要的最小jar包是不同的,参见不同版 ...

  4. python --存储对象

    转自:http://www.cnblogs.com/vamei/archive/2012/09/15/2684781.html 在之前对Python对象的介绍中 (面向对象的基本概念,面向对象的进一步 ...

  5. PHPExcel 对xls表格的文件读取

    //先去http://phpexcel.codeplex.com/releases/view/119187 下载文件包最后解压Classes到当前目录header("Content-type ...

  6. Linux 连续运行多条命令

    每条命令使用";"隔开.则不管前边的命令运行成功与否都会继续运行下一条命令 这里,有益将第二条命令中的echo多写了一个o.命令运行出错,但并不影响兴许命令的运行 能够这么想,假设 ...

  7. Atitit.遍历图像像素点rgb java attilax总结

    Atitit.遍历图像像素点rgb java attilax总结 1. 遍历像素点 1 2. 提取一行 1 3. Rgb分量提取 2 4. 其他读取像素 3 5. --code 5 6. 参考 6 1 ...

  8. WebView中input file的解决方法

    public class MyWb extends Activity { /** Called when the activity is first created. */ WebView web; ...

  9. Python unittest 参数化

    准备工作: pip install  nose_parameterized 典型场景:用户名.密码参数化 实例 1,新建一个ftl.py 文件 ,用来将存在于.txt .xlsx 文件中的参数化数据转 ...

  10. 谈一谈APP版本号问题

    如题:谈一谈APP版本号问题 为什么要谈这个问题,周五晚上11~12点,被微信点名,说APP有错,无效的版本号,商城无法下单.我正在准备收拾东西,周末回老家,结果看到这样问题,菊花一紧.我擦,我刚加的 ...