www.devoxx.com
Caching web contents in the browser Nacho Coloma Java Architect Extrema Sistemas de Información
Overall Presentation Goal Learn to think like the browser
Speaker’s qualifications Nacho Coloma is a Java Architect at Extrema Sistemas de Información Since 1999 Nacho has designed air traffic systems, e-banking platforms, Document Management Systems and a full load of enterprise applications … during which he has dealt with browsers more than he would like to :)
Ye olde cache We tend to avoid what we do not understand. Source: http://www.sawse.com/
304  (Not Modified) responses Expires  headers Strong  and  weak  cache indicators Three things to know
Means “the browser already has the latest version of this file” Will happen with every click unless Expires is used 304
If the server includes  Last-Modified  the browser will include  If-Modified-Since  with each further request Example: any static file with tomcat  304 with Last-Modified Browser Server <No header> Last-Modified: Fri, 02 Nov 2007 00:36:01 GMT If-Modified-Since: Fri, 02 Nov 2007 00:36:01 GMT 200 OK / 304 Not Modified First request Subsequent  requests
If server includes  ETag  the browser will include  If-None-Match  with each further request Example: <inode>-<file-size>-<last-modified> with apache  304 with ETag Browser Server <No header> ETag:  2e88051-8c-43f0b6dd972c0 If-None-Match: 2e88051-8c-43f0b6dd972c0 200 OK / 304 Not Modified First request Subsequent  requests
Indicates for how long the file should not be retrieved again. Cache-control (max-age)   http 1.1 seconds to expire used by the browser Expires header Browser Server <No header> Expires: Mon, 15 Dec 2008 19:11:50 GMT Cache-Control: max-age=1209600 (No more requests until the resource expires) First request Subsequent  requests EExpires   http 1.0 Date used by proxies installed by The Roman Empire.
Refresh : a new request will be sent for each file, ignoring the Expires header.  Any  If-Modified-Since  or  If-None-Match  headers  will  be sent. The server  may  return a 304 response. Shift + Refresh : a new request will be sent for each file, ignoring the Expires header. Any  If-Modified-Since  or  If-None-Match  headers  will not be sent . The server  cannot  return a 304 response. The  Refresh  button
Weak : Last-Modified, default ETag implementations. Strong : MD5, version numbers Strong indicators can be inserted in the URL or used as ETag headers Weak and strong indicators
Version numbers http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js http://yui.yahooapis.com/2.6.0/build/reset/reset-min.css Revision numbers http://localhost/myentity?id=5&revision=20 MD5 http://localhost/images/photo.gif?checksum=9e0bee8ace86b2230140642adcf57c4c Strong indicators
Using strong indicators, you can set your Expires header to cache forever: HTTP spec : 1 year Yahoo!  recommendation: 10 years Use only with immutable resources Expires & strong indicators
DEMO You can try this yourself: Go to  http://loom.extrema-sistemas.com/loomdemo/ Look the javascript file names that are retrieved; recognize the MD5 hash. Look the files downloaded for the first and further requests (use LiveHttpHeaders or Firebug) Click Refresh and see what happens
Summary The browser will ask for every resource unless you specify an  Expires  header You may return  304 responses You can use  strong  and  weak  cache indicators, in the URL or as HTTP headers With strong cache indicators, you can  cache immutable resources  forever.
Improve your performance! Set your goal to < 1 sec per request
Q&A
Thanks for your attention Nacho Coloma [email_address] http://icoloma.blogspot.com Source: http://www.sawse.com/ http://www.extrema-sistemas.com/

More Related Content

DOCX
Linux questions
PDF
Aws amazon ec2
PDF
2010 za con_jameel_haffejee
PPT
Presentation (PPT)
PPTX
Fixing 403 Forbidden Nginx Errors
TXT
Powershell direct
PDF
Jones_Lamp_Tutorial
PPT
Spider Course Day 1
Linux questions
Aws amazon ec2
2010 za con_jameel_haffejee
Presentation (PPT)
Fixing 403 Forbidden Nginx Errors
Powershell direct
Jones_Lamp_Tutorial
Spider Course Day 1

What's hot (20)

PPTX
Buffer overflow for Beginners
PDF
How To List Files on Remote Server - PowerShell
PPTX
Setting up a web server in Linux (Ubuntu)
PPTX
Incorporating PowerShell into your Arsenal with PS>Attack
PPT
Making the secure communication between Server and Client with https protocol
PDF
Installing Tomcat on Ubuntu Instance
ODP
PHP: The Beginning and the Zend
PDF
Oracle Enterprise Manager Cloud Control 13c13.3 Installation On Oracle Linux-7
PPT
Apache Presentation
PPT
How To Deploy A Cloud Based Webserver in 5 minutes - LAMP
PPTX
Apache web service
TXT
!!! Huong dan !!!
PPT
Apache Web Server Setup 2
PPTX
Pentesting Cloud Environment
PPTX
Dumping and Cracking SAM Hashes to Extract Plaintext Passwords
ODP
Apache ppt
PDF
Privileges Escalation by Exploiting Client-Side Vulnerabilities Using Metasploit
PPTX
Drupal, Memcache and Solr on Windows
PDF
Composer Tutorial (PHP Hampshire Sept 2013)
PDF
LCA2014 - Introduction to Go
Buffer overflow for Beginners
How To List Files on Remote Server - PowerShell
Setting up a web server in Linux (Ubuntu)
Incorporating PowerShell into your Arsenal with PS>Attack
Making the secure communication between Server and Client with https protocol
Installing Tomcat on Ubuntu Instance
PHP: The Beginning and the Zend
Oracle Enterprise Manager Cloud Control 13c13.3 Installation On Oracle Linux-7
Apache Presentation
How To Deploy A Cloud Based Webserver in 5 minutes - LAMP
Apache web service
!!! Huong dan !!!
Apache Web Server Setup 2
Pentesting Cloud Environment
Dumping and Cracking SAM Hashes to Extract Plaintext Passwords
Apache ppt
Privileges Escalation by Exploiting Client-Side Vulnerabilities Using Metasploit
Drupal, Memcache and Solr on Windows
Composer Tutorial (PHP Hampshire Sept 2013)
LCA2014 - Introduction to Go
Ad

Viewers also liked (17)

ODP
Caching Strategies
PDF
How to cache your static resources
PPTX
Cache memory
PPTX
Chain Reaction
PDF
HTTP cache @ PUG Rome 03-29-2011
PDF
Browser Caching and You: A Love Story
PPT
Rest services caching
PDF
Building your own CDN using Amazon EC2
PDF
Mobile Api and Caching
PDF
Securing your web application through HTTP headers
PDF
Progressive web apps
PPT
High Performance Web Pages - 20 new best practices
PPTX
Introduction to HTTP protocol
PPT
HTTP Basics
PPTX
Advanced Caching Concepts @ Velocity NY 2015
PPTX
HyperText Transfer Protocol (HTTP)
KEY
Fearless HTTP requests abuse
Caching Strategies
How to cache your static resources
Cache memory
Chain Reaction
HTTP cache @ PUG Rome 03-29-2011
Browser Caching and You: A Love Story
Rest services caching
Building your own CDN using Amazon EC2
Mobile Api and Caching
Securing your web application through HTTP headers
Progressive web apps
High Performance Web Pages - 20 new best practices
Introduction to HTTP protocol
HTTP Basics
Advanced Caching Concepts @ Velocity NY 2015
HyperText Transfer Protocol (HTTP)
Fearless HTTP requests abuse
Ad

Similar to Caching web contents in the browser (20)

PPT
Web Site Optimization
PPT
Web site optimization
PPT
Web Browsers And Other Mistakes
PPT
gofortution
PPTX
5 steps to faster web sites & HTML5 games - updated for DDDscot
PDF
How to specify a cache validator for a webpage in php
PPT
WE18_Performance_Up.ppt
PPT
Web Browsers And Other Mistakes
PPT
Internet Explorer 8 for Developers by Christian Thilmany
PPT
Unusual Web Bugs
PPT
Web Bugs
PPT
Apache Traffic Server
DOCX
1 Web Page Foundations Overview This lab walk.docx
PDF
Tuning Web Performance
PDF
Tuning web performance
PPTX
HTTP 2.0 - Web Unleashed 2015
PPT
Varnish and Drupal- Accelerating Website Performance and Flexibility with Var...
PPT
Scaling 101
PPT
Scaling 101 test
PPT
腾讯大讲堂09 如何建设高性能网站
Web Site Optimization
Web site optimization
Web Browsers And Other Mistakes
gofortution
5 steps to faster web sites & HTML5 games - updated for DDDscot
How to specify a cache validator for a webpage in php
WE18_Performance_Up.ppt
Web Browsers And Other Mistakes
Internet Explorer 8 for Developers by Christian Thilmany
Unusual Web Bugs
Web Bugs
Apache Traffic Server
1 Web Page Foundations Overview This lab walk.docx
Tuning Web Performance
Tuning web performance
HTTP 2.0 - Web Unleashed 2015
Varnish and Drupal- Accelerating Website Performance and Flexibility with Var...
Scaling 101
Scaling 101 test
腾讯大讲堂09 如何建设高性能网站

More from Ignacio Coloma (6)

ODP
Codemotion appengine
ODP
Css for nondesigners
ODP
Css3 101
PDF
Developing web applications in 2010
ODP
Developing and testing ajax components
PDF
Lessons learned on the web layer
Codemotion appengine
Css for nondesigners
Css3 101
Developing web applications in 2010
Developing and testing ajax components
Lessons learned on the web layer

Recently uploaded (20)

PDF
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
PDF
Architecture types and enterprise applications.pdf
PPTX
Tartificialntelligence_presentation.pptx
PPTX
Benefits of Physical activity for teenagers.pptx
PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PPT
What is a Computer? Input Devices /output devices
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PPTX
Modernising the Digital Integration Hub
PDF
Unlock new opportunities with location data.pdf
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
WOOl fibre morphology and structure.pdf for textiles
PDF
A review of recent deep learning applications in wood surface defect identifi...
PDF
1 - Historical Antecedents, Social Consideration.pdf
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
A contest of sentiment analysis: k-nearest neighbor versus neural network
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
Architecture types and enterprise applications.pdf
Tartificialntelligence_presentation.pptx
Benefits of Physical activity for teenagers.pptx
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
What is a Computer? Input Devices /output devices
NewMind AI Weekly Chronicles – August ’25 Week III
Modernising the Digital Integration Hub
Unlock new opportunities with location data.pdf
Zenith AI: Advanced Artificial Intelligence
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
Final SEM Unit 1 for mit wpu at pune .pptx
Group 1 Presentation -Planning and Decision Making .pptx
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
WOOl fibre morphology and structure.pdf for textiles
A review of recent deep learning applications in wood surface defect identifi...
1 - Historical Antecedents, Social Consideration.pdf
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
A comparative study of natural language inference in Swahili using monolingua...
A contest of sentiment analysis: k-nearest neighbor versus neural network

Caching web contents in the browser

  • 2. Caching web contents in the browser Nacho Coloma Java Architect Extrema Sistemas de Información
  • 3. Overall Presentation Goal Learn to think like the browser
  • 4. Speaker’s qualifications Nacho Coloma is a Java Architect at Extrema Sistemas de Información Since 1999 Nacho has designed air traffic systems, e-banking platforms, Document Management Systems and a full load of enterprise applications … during which he has dealt with browsers more than he would like to :)
  • 5. Ye olde cache We tend to avoid what we do not understand. Source: http://www.sawse.com/
  • 6. 304 (Not Modified) responses Expires headers Strong and weak cache indicators Three things to know
  • 7. Means “the browser already has the latest version of this file” Will happen with every click unless Expires is used 304
  • 8. If the server includes Last-Modified the browser will include If-Modified-Since with each further request Example: any static file with tomcat 304 with Last-Modified Browser Server <No header> Last-Modified: Fri, 02 Nov 2007 00:36:01 GMT If-Modified-Since: Fri, 02 Nov 2007 00:36:01 GMT 200 OK / 304 Not Modified First request Subsequent requests
  • 9. If server includes ETag the browser will include If-None-Match with each further request Example: <inode>-<file-size>-<last-modified> with apache 304 with ETag Browser Server <No header> ETag: 2e88051-8c-43f0b6dd972c0 If-None-Match: 2e88051-8c-43f0b6dd972c0 200 OK / 304 Not Modified First request Subsequent requests
  • 10. Indicates for how long the file should not be retrieved again. Cache-control (max-age) http 1.1 seconds to expire used by the browser Expires header Browser Server <No header> Expires: Mon, 15 Dec 2008 19:11:50 GMT Cache-Control: max-age=1209600 (No more requests until the resource expires) First request Subsequent requests EExpires http 1.0 Date used by proxies installed by The Roman Empire.
  • 11. Refresh : a new request will be sent for each file, ignoring the Expires header. Any If-Modified-Since or If-None-Match headers will be sent. The server may return a 304 response. Shift + Refresh : a new request will be sent for each file, ignoring the Expires header. Any If-Modified-Since or If-None-Match headers will not be sent . The server cannot return a 304 response. The Refresh button
  • 12. Weak : Last-Modified, default ETag implementations. Strong : MD5, version numbers Strong indicators can be inserted in the URL or used as ETag headers Weak and strong indicators
  • 13. Version numbers http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js http://yui.yahooapis.com/2.6.0/build/reset/reset-min.css Revision numbers http://localhost/myentity?id=5&revision=20 MD5 http://localhost/images/photo.gif?checksum=9e0bee8ace86b2230140642adcf57c4c Strong indicators
  • 14. Using strong indicators, you can set your Expires header to cache forever: HTTP spec : 1 year Yahoo! recommendation: 10 years Use only with immutable resources Expires & strong indicators
  • 15. DEMO You can try this yourself: Go to http://loom.extrema-sistemas.com/loomdemo/ Look the javascript file names that are retrieved; recognize the MD5 hash. Look the files downloaded for the first and further requests (use LiveHttpHeaders or Firebug) Click Refresh and see what happens
  • 16. Summary The browser will ask for every resource unless you specify an Expires header You may return 304 responses You can use strong and weak cache indicators, in the URL or as HTTP headers With strong cache indicators, you can cache immutable resources forever.
  • 17. Improve your performance! Set your goal to < 1 sec per request
  • 18. Q&A
  • 19. Thanks for your attention Nacho Coloma [email_address] http://icoloma.blogspot.com Source: http://www.sawse.com/ http://www.extrema-sistemas.com/