网站性能优化实践-cms性能优化之动态页面静态化、减少http请求和js压缩
来源:互联网 发布:计算机算法流程图 编辑:程序博客网 时间:2024/05/01 09:52
<!-- /* Font Definitions */ @font-face{font-family:宋体;panose-1:2 1 6 0 3 1 1 1 1 1;mso-font-alt:SimSun;mso-font-charset:134;mso-generic-font-family:auto;mso-font-pitch:variable;mso-font-signature:3 135135232 16 0 262145 0;}@font-face{font-family:"/@宋体";panose-1:2 1 6 0 3 1 1 1 1 1;mso-font-charset:134;mso-generic-font-family:auto;mso-font-pitch:variable;mso-font-signature:3 135135232 16 0 262145 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal{mso-style-parent:"";margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:inter-ideograph;mso-pagination:none;font-size:10.5pt;mso-bidi-font-size:12.0pt;font-family:"Times New Roman";mso-fareast-font-family:宋体;mso-font-kerning:1.0pt;}h3{mso-margin-top-alt:auto;margin-right:0cm;mso-margin-bottom-alt:auto;margin-left:0cm;mso-pagination:widow-orphan;mso-outline-level:3;font-size:13.5pt;font-family:宋体;mso-bidi-font-family:宋体;font-weight:bold;}a:link, span.MsoHyperlink{color:blue;text-decoration:underline;text-underline:single;}a:visited, span.MsoHyperlinkFollowed{color:purple;text-decoration:underline;text-underline:single;}p{mso-margin-top-alt:auto;margin-right:0cm;mso-margin-bottom-alt:auto;margin-left:0cm;mso-pagination:widow-orphan;font-size:12.0pt;font-family:宋体;mso-bidi-font-family:宋体;} /* Page Definitions */ @page{mso-page-border-surround-header:no;mso-page-border-surround-footer:no;}@page Section1{size:612.0pt 792.0pt;margin:72.0pt 90.0pt 72.0pt 90.0pt;mso-header-margin:36.0pt;mso-footer-margin:36.0pt;mso-paper-source:0;}div.Section1{page:Section1;}-->
从核桃博客转载,http://www.hetaoblog.com/?p=72
网站性能优化实践-数据库分页和轻量级Session
之前在网站性能优化实践-for循环中的数据库操作和网站性能优化实践-数据库分页和轻量级Session中分别介绍了2个网站性能优化的实践,这里,再介绍另外3个性能优化实践:
动态页面静态化
减少http请求
js压缩
这里首先介绍第一条:
动态页面静态化
a.问题:
一个java做的cms,放在虚拟主机上,某周末早上测试12s,下午测试150s;
b.分析:
初步判断虚拟主机机器太不稳定了,调试了下发现,访问首页hibernate一共生成100多条sql,显然,首页访问造成了太多的数据库操作,关于数据库操作的影响,可以参考网站性能优化实践-for循环中的数据库操作。
用一个静态文件测试发现3-5s就可以加载完,看来是虚拟主机的数据库瓶颈,
c.解决方法:于是后台写了个将首页发布成静态页面的功能,在早上-下午-晚上都是3-5s完成加载。
另外举个例子,今天在水木上看到一位网友做的一个网站,http://policy.sme.gov.cn/longcon/sites/zhengcefagui/index.jsp,也是一个的cms,刚才(2010-1-8晚上21:10)在杭州网通1M查看,发现完全加载39.93秒。 初步分析有3个建议:
1. 动态页面静态化
但是,通过Firebug可以查看到,index.jsp总共大小只有96kb,但是加载时间是6.36秒。另外,48kb的common.js只需要0.951秒就可以,这可以说明index.jsp主要时间花在了后台,同时,根据.jsp后缀名,基本可以认为该页面也是动态页面,从数据库中加载各个新闻栏目的内容。所以,今天的这条的建议可以适用在该网站上,大约可以提高5秒左右。
2. 减少http请求和对js进行压缩。
该页面总计有102个http请求,大量js文件单独使用而没有打包到一起,另外一些js文件(比如http://policy.sme.gov.cn/longcon/portlet/form/component/file/selector/script.js.jsp)并没有压缩,在stevesounders的前端性能优化经典图书-<<高性能网站建设指南>>中提到,减少http请求和压缩js可以很好的提高前端性能,根据firebug的加载时间图,目测大约可以提高5秒左右时间,有兴趣者可以看看这本书中的各项有用的建议。
3. 图片优化
另外,下面4个图片的加载时间分别是7.05秒,4.86秒,4.72秒,10.7秒,如果可以找美工处理下相关图片将图片变的更小,对性能的改进是很大的。
http://policy.sme.gov.cn/longcon/sites/zhengcefagui/images/banner.jpg
http://policy.sme.gov.cn/longcon/resources/1000000000000/zx4.jpg
http://policy.sme.gov.cn/longcon/resources/1000000000000/20090224115527398.gif
http://policy.sme.gov.cn/longcon/resources/1000000000000/zhaopin.gif
- 网站性能优化实践-cms性能优化之动态页面静态化、减少http请求和js压缩
- 前端性能优化--合并压缩js,减少http请求次数
- Web项目性能优化之减少HTTP请求次数优化
- Web项目性能优化之减少HTTP请求次数优化
- 网站性能优化之HTTP请求过程
- 网站性能优化之HTTP请求过程
- 网站性能优化之_页面静态化
- ASP.NET性能优化之减少请求
- ASP.NET性能优化之减少请求
- 网站优化之减少HTTP请求
- Web前端性能优化(一)减少Http请求
- web应用性能优化--采用gzip静态压缩+动态压缩方式压缩js、css文件
- Web性能优化-合并js与css,减少请求
- 前端性能优化的方法和工具,减少http请求的次数和速度
- 网站性能优化之Gzip压缩
- 性能优化之YUICompressor压缩JS、CSS
- 网站性能优化:压缩图片
- 如何优化网站性能实践
- 基于java技术的搜索引擎的实现-2
- [zz]单片机入门的几点建议
- Pascal实现Byte型转BIN字符串格式
- 网站性能优化实践-for循环中的数据库操作
- ASP.NET页面间值传递的几种方法
- 网站性能优化实践-cms性能优化之动态页面静态化、减少http请求和js压缩
- OutputDebugString的用法
- 如何写综述
- mysql在ubuntu下的使用
- 转:研究人员发现:手机辐射或可治疗老年痴呆症
- 最近一直困扰我的问题
- 使用性能监控工具-Perfmon监控windows服务器性能
- 使用性能测试工具JMeter来测试网站性能1
- steam.pl