为了优化网站的访问速度,准备采用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. php处理行业分类数据

    实现步骤: 1.将excel表格存储为后缀名为 .csv格式的文件: 2.将.csv格式文件导入到mysql数据库中: 3.通过条件查询将所需要的数据查出并导入另一个数据表中: 下面是一些php片段: ...

  2. unity3d常用控件

    直接上代码,就能看懂了. private string txt1; private string pwd1; private int tool1; private bool isMuted; priv ...

  3. 关闭MongoDB

    以下方法干净地关闭MongoDB: 完成所有挂起的操作.刷新数据到数据文件.关闭所有的数据文件 1. > use admin switched to db admin > db.shutd ...

  4. MVC :“已添加了具有相同键的项”

    最近将一个项目从ASP.NET MVC 3升级至刚刚发布的ASP.NET MVC 5.1,升级后发现一个ajax请求出现了500错误,日志中记录的详细异常信息如下: System.ArgumentEx ...

  5. JanusGraph中的事务

    翻译整理:纪玉奇   几乎所有与JanusGraph的交互都是通过Transaction,JansuGraph的Transaction支持并发.使用Transaction时,不需要显式进行生命,gra ...

  6. 什么是SQL注入式攻击?

    什么是SQL注入式攻击? 所谓SQL注入式攻击,就是攻击者把SQL命令插入到Web表单的输入域或页面请求的查询字符串,欺骗服务器执行恶意的SQL命令.在某些表单中,用户输入的内容直接用来构造(或者影响 ...

  7. git 简单使用规范

    分支管理办法 创建一个主仓库dev 每个成员fork一份dev分支 在自己fork出来的代码里做开发 开发完成后发出一个合并请求 pull request,等待被其他有合并权限的同事合并代码,合并代码 ...

  8. Springboot读取配置文件的两种方法

    第一种: application.yml配置中的参数: zip: Hello Springboot 方法读取: @RestController public class ControllerTest ...

  9. 【转载】使用Exp和Expdp导出数据的性能对比与优化

    转自:http://blog.itpub.net/117319/viewspace-1410931/ 序:这方面的文章虽然很多人写过,但是结合实际进行详细的对比分析的不多,这里,结合所在公司的行业,进 ...

  10. CentOS7:gdb出现没有调试信息:Missing Separate debuginfos

    现在刚刚开始学习用gdb调试程序,结果:在centos下,出现这样的错误: gdb在调试程序时候提示 Missing separate debuginfos, use: debuginfo-insta ...