SlideShare a Scribd company logo
1 of 11
Download to read offline
HTTP-缓存

most of the content come from the book
    《HTTP: The Definitive Guide》




                               by lyuehh
                               2012-09-29
为什么需要缓存?
◆ 冗余的数据传输
◆ 带宽瓶颈
◆ 瞬间拥塞
缓存的一些概念
◆ 再验证
◆ 命中率
◆ 字节命中率
缓存的结构
◆ 私有缓存 (浏览器缓存)
◆ 公有代理缓存
◆ 层次化
◆ 网状缓存、内容路由
◆ 对等缓存
缓存的处理步骤
◆ 接收
◆ 解析
◆ 查询
◆ 新鲜度检测
◆ 创建响应
◆ 发送
◆ 日志
请求到达




 是否已   否
 缓存?


   是


 是否足   否                         否
 够新                      再验证
           与服务器进行再验证                 从服务器获取
 鲜?                      过了?


   是                    是

                       对已缓存文档的
                                     存入缓存
                       新鲜度进行更新




                                     提供给客户端
保持副本的新鲜
◆ 文档过期
  Expires首部
  Cache-Control首部
◆ 用条件方法进行再验证
   If-Modified-Since: Date再验证
   If-None-Match: 实体标签再验证
◆ 强弱校验器
控制缓存的能力
◆ no-Store与no-Cache响应首部
◆ max-age响应首部
◆ Expires响应首部
◆ must-revalidate响应首部
◆ 试探性过期
◆ 客户端的新鲜度限制
设置缓存控制
◆ 控制Apache的HTTP首部
  mod_headers
  mod_expires
  mod_cern_meta
◆ 通过HTTP-EQUIV控制HTML缓存
  <META HTTP-EQUIV="Cache-control"
    CONTENT="no-cache">
缓存和广告
◆ 发布广告者的两难处境
◆ 发布者的响应
◆ 日志迁移
◆ 命中计数和使用限制
thanks

More Related Content

What's hot

阿里CDN技术揭秘
阿里CDN技术揭秘阿里CDN技术揭秘
阿里CDN技术揭秘Joshua Zhu
 
一个 Mongodb command 的前世今生
一个 Mongodb command 的前世今生一个 Mongodb command 的前世今生
一个 Mongodb command 的前世今生dennis zhuang
 
高性能队列Fqueue的设计和使用实践
高性能队列Fqueue的设计和使用实践高性能队列Fqueue的设计和使用实践
高性能队列Fqueue的设计和使用实践孙立
 
腾讯大讲堂08 可扩展web架构探讨
腾讯大讲堂08 可扩展web架构探讨腾讯大讲堂08 可扩展web架构探讨
腾讯大讲堂08 可扩展web架构探讨areyouok
 
1号店数据库架构
1号店数据库架构1号店数据库架构
1号店数据库架构Louis liu
 
阿里云CDN技术演进之路
阿里云CDN技术演进之路阿里云CDN技术演进之路
阿里云CDN技术演进之路Joshua Zhu
 
Building the Production Ready EB level Storage Product from Ceph - Dongmao Zhang
Building the Production Ready EB level Storage Product from Ceph - Dongmao ZhangBuilding the Production Ready EB level Storage Product from Ceph - Dongmao Zhang
Building the Production Ready EB level Storage Product from Ceph - Dongmao ZhangCeph Community
 
新浪微博Feed服务架构
新浪微博Feed服务架构新浪微博Feed服务架构
新浪微博Feed服务架构XiaoJun Hong
 
大规模数据库存储方案
大规模数据库存储方案大规模数据库存储方案
大规模数据库存储方案XiaoJun Hong
 
反向代理工作原理及Squid简介
反向代理工作原理及Squid简介反向代理工作原理及Squid简介
反向代理工作原理及Squid简介diruser
 
Ceph Day Beijing - Leverage Ceph for SDS in China Mobile
Ceph Day Beijing - Leverage Ceph for SDS in China MobileCeph Day Beijing - Leverage Ceph for SDS in China Mobile
Ceph Day Beijing - Leverage Ceph for SDS in China MobileDanielle Womboldt
 
Kubernetes use-ceph
Kubernetes use-cephKubernetes use-ceph
Kubernetes use-cephYang Guanjun
 
分布式缓存与队列
分布式缓存与队列分布式缓存与队列
分布式缓存与队列XiaoJun Hong
 
前端静态文件部署
前端静态文件部署前端静态文件部署
前端静态文件部署Charles Wu
 
前端性能测试
前端性能测试前端性能测试
前端性能测试tbmallf2e
 
Caching in HTTP
Caching in HTTPCaching in HTTP
Caching in HTTP家弘 周
 
构建基于Lamp的中型网站架构
构建基于Lamp的中型网站架构构建基于Lamp的中型网站架构
构建基于Lamp的中型网站架构HonestQiao
 
Traffic server overview
Traffic server overviewTraffic server overview
Traffic server overviewqianshi
 

What's hot (19)

阿里CDN技术揭秘
阿里CDN技术揭秘阿里CDN技术揭秘
阿里CDN技术揭秘
 
一个 Mongodb command 的前世今生
一个 Mongodb command 的前世今生一个 Mongodb command 的前世今生
一个 Mongodb command 的前世今生
 
高性能队列Fqueue的设计和使用实践
高性能队列Fqueue的设计和使用实践高性能队列Fqueue的设计和使用实践
高性能队列Fqueue的设计和使用实践
 
腾讯大讲堂08 可扩展web架构探讨
腾讯大讲堂08 可扩展web架构探讨腾讯大讲堂08 可扩展web架构探讨
腾讯大讲堂08 可扩展web架构探讨
 
1号店数据库架构
1号店数据库架构1号店数据库架构
1号店数据库架构
 
阿里云CDN技术演进之路
阿里云CDN技术演进之路阿里云CDN技术演进之路
阿里云CDN技术演进之路
 
Building the Production Ready EB level Storage Product from Ceph - Dongmao Zhang
Building the Production Ready EB level Storage Product from Ceph - Dongmao ZhangBuilding the Production Ready EB level Storage Product from Ceph - Dongmao Zhang
Building the Production Ready EB level Storage Product from Ceph - Dongmao Zhang
 
新浪微博Feed服务架构
新浪微博Feed服务架构新浪微博Feed服务架构
新浪微博Feed服务架构
 
大规模数据库存储方案
大规模数据库存储方案大规模数据库存储方案
大规模数据库存储方案
 
反向代理工作原理及Squid简介
反向代理工作原理及Squid简介反向代理工作原理及Squid简介
反向代理工作原理及Squid简介
 
Ceph Day Beijing - Leverage Ceph for SDS in China Mobile
Ceph Day Beijing - Leverage Ceph for SDS in China MobileCeph Day Beijing - Leverage Ceph for SDS in China Mobile
Ceph Day Beijing - Leverage Ceph for SDS in China Mobile
 
Kubernetes use-ceph
Kubernetes use-cephKubernetes use-ceph
Kubernetes use-ceph
 
分布式缓存与队列
分布式缓存与队列分布式缓存与队列
分布式缓存与队列
 
前端静态文件部署
前端静态文件部署前端静态文件部署
前端静态文件部署
 
前端性能测试
前端性能测试前端性能测试
前端性能测试
 
Caching in HTTP
Caching in HTTPCaching in HTTP
Caching in HTTP
 
Oracle dgha
Oracle dghaOracle dgha
Oracle dgha
 
构建基于Lamp的中型网站架构
构建基于Lamp的中型网站架构构建基于Lamp的中型网站架构
构建基于Lamp的中型网站架构
 
Traffic server overview
Traffic server overviewTraffic server overview
Traffic server overview
 

Viewers also liked

Java EE 8 - An instant snapshot
Java EE 8 - An instant snapshotJava EE 8 - An instant snapshot
Java EE 8 - An instant snapshotDavid Delabassee
 
Sosyal Medya Stratejisi
Sosyal Medya StratejisiSosyal Medya Stratejisi
Sosyal Medya StratejisiMedya Derneği
 
Media Association - Annual Activities (March 2010 - March 2011)
Media Association - Annual Activities (March 2010 - March 2011)Media Association - Annual Activities (March 2010 - March 2011)
Media Association - Annual Activities (March 2010 - March 2011)Medya Derneği
 
Nick pearce youtube in classroom
Nick pearce youtube in classroomNick pearce youtube in classroom
Nick pearce youtube in classroomCSAPSubjectCentre
 
55 new things in Java 7 - Devoxx France
55 new things in Java 7 - Devoxx France55 new things in Java 7 - Devoxx France
55 new things in Java 7 - Devoxx FranceDavid Delabassee
 
Draft final report for cascade project
Draft final report for cascade projectDraft final report for cascade project
Draft final report for cascade projectCSAPSubjectCentre
 
Pushing Java EE outside of the Enterprise - Home Automation
Pushing Java EE outside of the Enterprise - Home AutomationPushing Java EE outside of the Enterprise - Home Automation
Pushing Java EE outside of the Enterprise - Home AutomationDavid Delabassee
 
Yeni Medya Yeni Fırsatlar - 16 Ocak 2011
Yeni Medya Yeni Fırsatlar - 16 Ocak 2011Yeni Medya Yeni Fırsatlar - 16 Ocak 2011
Yeni Medya Yeni Fırsatlar - 16 Ocak 2011Medya Derneği
 
C-SAP cascade project final report
C-SAP cascade project final reportC-SAP cascade project final report
C-SAP cascade project final reportCSAPSubjectCentre
 

Viewers also liked (9)

Java EE 8 - An instant snapshot
Java EE 8 - An instant snapshotJava EE 8 - An instant snapshot
Java EE 8 - An instant snapshot
 
Sosyal Medya Stratejisi
Sosyal Medya StratejisiSosyal Medya Stratejisi
Sosyal Medya Stratejisi
 
Media Association - Annual Activities (March 2010 - March 2011)
Media Association - Annual Activities (March 2010 - March 2011)Media Association - Annual Activities (March 2010 - March 2011)
Media Association - Annual Activities (March 2010 - March 2011)
 
Nick pearce youtube in classroom
Nick pearce youtube in classroomNick pearce youtube in classroom
Nick pearce youtube in classroom
 
55 new things in Java 7 - Devoxx France
55 new things in Java 7 - Devoxx France55 new things in Java 7 - Devoxx France
55 new things in Java 7 - Devoxx France
 
Draft final report for cascade project
Draft final report for cascade projectDraft final report for cascade project
Draft final report for cascade project
 
Pushing Java EE outside of the Enterprise - Home Automation
Pushing Java EE outside of the Enterprise - Home AutomationPushing Java EE outside of the Enterprise - Home Automation
Pushing Java EE outside of the Enterprise - Home Automation
 
Yeni Medya Yeni Fırsatlar - 16 Ocak 2011
Yeni Medya Yeni Fırsatlar - 16 Ocak 2011Yeni Medya Yeni Fırsatlar - 16 Ocak 2011
Yeni Medya Yeni Fırsatlar - 16 Ocak 2011
 
C-SAP cascade project final report
C-SAP cascade project final reportC-SAP cascade project final report
C-SAP cascade project final report
 

Similar to Http 缓存

腾讯大讲堂08 可扩展web架构探讨
腾讯大讲堂08 可扩展web架构探讨腾讯大讲堂08 可扩展web架构探讨
腾讯大讲堂08 可扩展web架构探讨George Ang
 
优酷 Web网站架构案例分析
优酷   Web网站架构案例分析优酷   Web网站架构案例分析
优酷 Web网站架构案例分析George Ang
 
Youku arch qcon2009_beijing
Youku arch qcon2009_beijingYouku arch qcon2009_beijing
Youku arch qcon2009_beijingdrewz lin
 
Key value store
Key value storeKey value store
Key value storexuanhan863
 
PHP Optimization for Millions Visits Level
PHP Optimization for Millions Visits LevelPHP Optimization for Millions Visits Level
PHP Optimization for Millions Visits LevelHo Kim
 
Golang 高性能实战
Golang 高性能实战Golang 高性能实战
Golang 高性能实战rfyiamcool
 
Linux内存管理
Linux内存管理Linux内存管理
Linux内存管理zijia
 
Linux内存管理
Linux内存管理Linux内存管理
Linux内存管理zijia
 
腾讯大讲堂08 可扩展web架构探讨
腾讯大讲堂08 可扩展web架构探讨腾讯大讲堂08 可扩展web架构探讨
腾讯大讲堂08 可扩展web架构探讨topgeek
 
Lamp优化实践
Lamp优化实践Lamp优化实践
Lamp优化实践zhliji2
 
Http cache 的優化
Http cache 的優化Http cache 的優化
Http cache 的優化振揚 陳
 
淘宝前台系统性能分析与优化
淘宝前台系统性能分析与优化淘宝前台系统性能分析与优化
淘宝前台系统性能分析与优化丁 宇
 
淘宝网前台应用性能优化实践
淘宝网前台应用性能优化实践淘宝网前台应用性能优化实践
淘宝网前台应用性能优化实践丁 宇
 
20111018 zhouchen share
20111018 zhouchen share20111018 zhouchen share
20111018 zhouchen sharezcbug
 
大规模网站架构
大规模网站架构大规模网站架构
大规模网站架构drewz lin
 
高性能的Java代码编写及常见问题排查
高性能的Java代码编写及常见问题排查高性能的Java代码编写及常见问题排查
高性能的Java代码编写及常见问题排查bluedavy lin
 
Pegasus: Designing a Distributed Key Value System (Arch summit beijing-2016)
Pegasus: Designing a Distributed Key Value System (Arch summit beijing-2016)Pegasus: Designing a Distributed Key Value System (Arch summit beijing-2016)
Pegasus: Designing a Distributed Key Value System (Arch summit beijing-2016)涛 吴
 
高性能Web服务器Nginx及相关新技术的应用实践
高性能Web服务器Nginx及相关新技术的应用实践高性能Web服务器Nginx及相关新技术的应用实践
高性能Web服务器Nginx及相关新技术的应用实践self study
 
高性能Web服务器Nginx及相关新技术的应用实践
高性能Web服务器Nginx及相关新技术的应用实践高性能Web服务器Nginx及相关新技术的应用实践
高性能Web服务器Nginx及相关新技术的应用实践rewinx
 
高性能Web服务器Nginx及相关新技术的应用实践
高性能Web服务器Nginx及相关新技术的应用实践高性能Web服务器Nginx及相关新技术的应用实践
高性能Web服务器Nginx及相关新技术的应用实践Frank Cai
 

Similar to Http 缓存 (20)

腾讯大讲堂08 可扩展web架构探讨
腾讯大讲堂08 可扩展web架构探讨腾讯大讲堂08 可扩展web架构探讨
腾讯大讲堂08 可扩展web架构探讨
 
优酷 Web网站架构案例分析
优酷   Web网站架构案例分析优酷   Web网站架构案例分析
优酷 Web网站架构案例分析
 
Youku arch qcon2009_beijing
Youku arch qcon2009_beijingYouku arch qcon2009_beijing
Youku arch qcon2009_beijing
 
Key value store
Key value storeKey value store
Key value store
 
PHP Optimization for Millions Visits Level
PHP Optimization for Millions Visits LevelPHP Optimization for Millions Visits Level
PHP Optimization for Millions Visits Level
 
Golang 高性能实战
Golang 高性能实战Golang 高性能实战
Golang 高性能实战
 
Linux内存管理
Linux内存管理Linux内存管理
Linux内存管理
 
Linux内存管理
Linux内存管理Linux内存管理
Linux内存管理
 
腾讯大讲堂08 可扩展web架构探讨
腾讯大讲堂08 可扩展web架构探讨腾讯大讲堂08 可扩展web架构探讨
腾讯大讲堂08 可扩展web架构探讨
 
Lamp优化实践
Lamp优化实践Lamp优化实践
Lamp优化实践
 
Http cache 的優化
Http cache 的優化Http cache 的優化
Http cache 的優化
 
淘宝前台系统性能分析与优化
淘宝前台系统性能分析与优化淘宝前台系统性能分析与优化
淘宝前台系统性能分析与优化
 
淘宝网前台应用性能优化实践
淘宝网前台应用性能优化实践淘宝网前台应用性能优化实践
淘宝网前台应用性能优化实践
 
20111018 zhouchen share
20111018 zhouchen share20111018 zhouchen share
20111018 zhouchen share
 
大规模网站架构
大规模网站架构大规模网站架构
大规模网站架构
 
高性能的Java代码编写及常见问题排查
高性能的Java代码编写及常见问题排查高性能的Java代码编写及常见问题排查
高性能的Java代码编写及常见问题排查
 
Pegasus: Designing a Distributed Key Value System (Arch summit beijing-2016)
Pegasus: Designing a Distributed Key Value System (Arch summit beijing-2016)Pegasus: Designing a Distributed Key Value System (Arch summit beijing-2016)
Pegasus: Designing a Distributed Key Value System (Arch summit beijing-2016)
 
高性能Web服务器Nginx及相关新技术的应用实践
高性能Web服务器Nginx及相关新技术的应用实践高性能Web服务器Nginx及相关新技术的应用实践
高性能Web服务器Nginx及相关新技术的应用实践
 
高性能Web服务器Nginx及相关新技术的应用实践
高性能Web服务器Nginx及相关新技术的应用实践高性能Web服务器Nginx及相关新技术的应用实践
高性能Web服务器Nginx及相关新技术的应用实践
 
高性能Web服务器Nginx及相关新技术的应用实践
高性能Web服务器Nginx及相关新技术的应用实践高性能Web服务器Nginx及相关新技术的应用实践
高性能Web服务器Nginx及相关新技术的应用实践
 

Http 缓存