YSlow的性能测试提示
Add an Expires or a Cache-Control Header
tag: server
There are two aspects to this rule:
- For static components: implement "Never expire" policy by setting far future
Expires
header - For dynamic components: use an appropriate
Cache-Control
header to help the browser with conditional requests
Web page designs are getting richer and richer, which means more
scripts, stylesheets, images, and Flash in the page. A first-time
visitor to your page may have to make several HTTP requests, but by
using the Expires header you make those components cacheable. This
avoids unnecessary HTTP requests on subsequent page views. Expires
headers are most often used with images, but they should be used on all components including scripts, stylesheets, and Flash components.
Browsers (and proxies) use a cache to reduce the number and size of
HTTP requests, making web pages load faster. A web server uses the
Expires header in the HTTP response to tell the client how long a
component can be cached. This is a far future Expires header, telling
the browser that this response won't be stale until April 15, 2010.
Expires: Thu, 15 Apr 2010 20:00:00 GMT
If your server is Apache, use the ExpiresDefault directive to set an
expiration date relative to the current date. This example of the
ExpiresDefault directive sets the Expires date 10 years out from the
time of the request.
ExpiresDefault "access plus 10 years"
Keep in mind, if you use a far future Expires header you have to
change the component's filename whenever the component changes. At
Yahoo! we often make this step part of the build process: a version
number is embedded in the component's filename, for example,
yahoo_2.0.6.js.
Using a far future Expires header affects page views only after a
user has already visited your site. It has no effect on the number of
HTTP requests when a user visits your site for the first time and the
browser's cache is empty. Therefore the impact of this performance
improvement depends on how often users hit your pages with a primed
cache. (A "primed cache" already contains all of the components in the
page.) We measured this at Yahoo!
and found the number of page views with a primed cache is 75-85%. By
using a far future Expires header, you increase the number of components
that are cached by the browser and re-used on subsequent page views
without sending a single byte over the user's Internet connection.
YSlow的性能测试提示的更多相关文章
- Yslow网站性能优化工具
Yslow是一款网站性能优化的插件:
- LR接口性能测试提示Code - 60990 Error: Two Way Communication Error: Function two_way_comm_post_message / two_ (转载)
一.在做JAVA接口性能测试时,场景在运行中出现:Code - 60990 Error: Two Way Communication Error: Function two_way_comm_post ...
- [Python爬虫] 在Windows下安装PhantomJS和CasperJS及入门介绍(上)
最近在使用Python爬取网页内容时,总是遇到JS临时加载.动态获取网页信息的困难.例如爬取CSDN下载资源评论.搜狐图片中的“原图”等,此时尝试学习Phantomjs和CasperJS来解决这个问题 ...
- 前端资料QQ群交流
转:https://github.com/jsfront/src/blob/master/qq.md 这本来是我QQ群内部的一份公共约定的日常交流规则,后来得到大伙的一致认可,并用实际行动来捍卫它,使 ...
- 转载 loadrunner的一些问题解决
sckOutOfMemory 7 内存不足 sckInvalidPropertyValue 380 属性值不效 sckGetNotSupported 394 属性不可读 sckGetNotSup ...
- php结合phantomjs实现网页截屏、抓取js渲染的页面
首先PhantomJS快速入门 PhantomJS是一个基于 WebKit 的服务器端 JavaScript API.它全面支持web而不需浏览器支持,其快速,原生支持各种Web标准: DOM 处理, ...
- Linux/Centos下安装部署phantomjs 及使用
PhantomJS 是一个基于 WebKit 的服务器端 JavaScript API.它全面支持web而不需浏览器支持,其快速,原生支持各种Web标准: DOM 处理, CSS 选择器, JSON, ...
- JavaScript资源分享
一. 资源教程: 综合类 前端知识体系 前端知识结构 Web前端开发大系概览 Web前端开发大系概览-中文版 Web Front-end Stack v2.2 En类资源汇总 免费的编程中文书籍索引 ...
- google官方建议使用的网站性能测试工具
转自:http://www.laokboke.net/2013/05/12/google-official-recommended-site-performance-testing-tools/ 最近 ...
随机推荐
- oracle_常用命令(表空间查询)
---查询表空间 对应的物理文件,名称 ,大小 ,已用的,利用率 SELECT B.FILE_NAME "FILE_NAME", B.TABLESPACE_NAME "T ...
- javascript中用来定义引用类型的一种"默认"模式
// 终极版:组合使用构造函数模式和原型模式:***************************** // 评价:集构造函数模式和原型模式之大成: 用来定义引用类型的一种默认模式 function ...
- 手工制作的年份Java老A发售量
Java老A这本书是写了很长的时间,昨天终于开始china-pub.京东.活动当天发售的猫,现在,简称买卖,他当然还没有到. 有兴趣的人能够去看看哈(兴许其它站点地址也会在这里公开): china-p ...
- oracle 非数字型转数字型
原文:oracle 非数字型转数字型 oracle中如果一个字段内容不全是数字型 可以通过以下方式过滤 to_number(substr(translate(a.vital_signs_cvalues ...
- Linux的错误码
在使用时需要包含头文件 #include <errno.h> merlin@tfAnalysis:~/projects/tfradius$ cat /usr/include/asm-gen ...
- iSwifting社区【www.iSwifting.com】招聘版主
iSwifting社区[www.iSwifting.com]昨天找来几个主持人.我已经被任命为他们的任务领域. 他们有百度的project噢,还有cocoaChina问答区的活跃人物! 欢迎大家一起学 ...
- android App Widgets
http://developer.android.com/guide/practices/ui_guidelines/widget_design.html#design http://develope ...
- JJG 623-2005 电阻应变仪计量检定规程
JJG 623-2005 电阻应变仪计量检定规程 点击下载 JJG533-2007标准模拟应变量校准器检定规程 点击下载 JJG 533-1988标准(里面含有一些更具体的电路图供参考)
- AJAX入门——工作原理
同步和异步交互,了解互动 对于一个样本:一般B/S模式(同步) AJAX技术(异步) * 同步: 提交请求->等待server处理->处理完成返回 ...
- INNO SETUP卸载程序中加入自定义窗体
原文:INNO SETUP卸载程序中加入自定义窗体 [Setup] AppName=My Program AppVerName=My Program v.1.2 DefaultDirName={pf} ...