web caching workshop - mod_cache, varnish, amazon cloudfront cdn & s3
DESCRIPTION
"Add Expires Headers", "Use of a Content Delivery Network (CDN)", "Leverage browser caching", "Leverage proxy caching", ... Did the Yahoo YSlow! plugin or the Google Chrome Developer Tools flash with some caching & CDN warnings? Or even worse, does your web site collapse often or your data center's internet connection sometimes saturate from constantly serving static files? Discover through this workshop how to use on your project the caching techniques of the big players of the Internet. Agenda: * Headers Http 'Expires' and 'Cache-Control' ** The theory: RFC 2616 - Hypertext Transfer Protocol -- HTTP/1.1 - Header Field Definitions - Cache-Control ** "cacheable content" versus "static content" : offer a new scalability to your web site, ** How to add caching headers with your web framework, ** ExpiresFilter: how to add caching headers to the static content of a java webapp, * Apache Httpd mod_expires and NGinx HttpHeadersModule : global filters on web servers, * Apache Httpd mod_cache and NGinx proxy_cache : the "quick wins" to add a caching proxy to your infrastructure, * Varnish, the star of the caching proxies, * Amazon CloudFront : the Content Delivery Network (CDN) made by Amazon AWS. It's simple, it's cheap and it works, * Amazon S3, the other way to serve static content. Bonus: deploy your webapp on Amazon Beanstalk, the Tomcat as a Service made by Amazon AWS. The lab: https://github.com/xebia-france/workshop-web-caching-cocktail/wikiTRANSCRIPT
Web Caching Workshopmod_cache, Varnish,
Amazon CloudFront CDN & S3
Julia MateoCharles BlondeCyrille Le ClercSeven Le MesleStéphane Moreau
Wednesday, August 1, 12
L’équipe
§ Julia Mateo @juliamateo82§ Charles Blonde @blondecharles§ Cyrille Le Clerc @cyrilleleclerc§ Seven Le Mesle @slemesle§ Stéphane Moreau @stfmoreau
2Wednesday, August 1, 12
Cocktail
3Wednesday, August 1, 12
Initial Architecture
4
TomcatInternet
cocktail
YSlow
Initial Architecture
http://xfr-cocktail-xxx.elasticbeanstalk.com/
Wednesday, August 1, 12
Amazon S3 as a media database
5
TomcatInternet
cocktail
YSlow
Amazon S3 as a media database
http://xfr-cocktail-xxx.elasticbeanstalk.com/
S3 Simple Storage Service
http://cocktail.s3-website-us-east-1.amazonaws.com/
Wednesday, August 1, 12
Javascript and CSS libs’ CDN
6
TomcatInternet
cocktail
Javascript & CSS libs' CDN
http://xfr-cocktail-xxx.elasticbeanstalk.com/
Bootstrap
http://ajax.googleapis.com/
YSlow
Wednesday, August 1, 12
Expires Headers
7
Tomcat
Internet cocktail
Expires: ...Cache-Control: max-age ...
YSlow
Expires Headers with a Filter
http://xfr-cocktail-xxx.elasticbeanstalk.com/
Wednesday, August 1, 12
Apache Httpd as a Caching Proxy
8
TomcatInternet
cocktail
YSlow
Apache Httpd as a caching proxy
Apache
mod_cache
http://www-cocktail-xxx.aws.xebiatechevent.info/
Wednesday, August 1, 12
Varnish Caching Proxy
9
TomcatInternet
cocktail
YSlow
Varnish caching proxy
Varnish
http://www-cocktail-xxx.aws.xebiatechevent.info:6081/
Wednesday, August 1, 12
Amazon Cloud Front CDN
10
TomcatInternet
cocktailYSlow
Amazon Cloud Front CDN
Cloud Fronthttp://xfr-cocktail-xxx.elasticbeanstalk.com/
http://d1mm4v4zybjqbh.cloudfront.net/
Wednesday, August 1, 12
“Ideal” Architecture
11
Tomcat
cocktail
"Ideal" ArchitectureAmazon Cloud Front CDN + Varnish Caching Proxy
+ Google CDN & Bootstrap CDN+ Amazon S3 as a "media database"
Cloud Front
http://xyz12.cloudfront.net/
Varnish
http://www-cocktail-xxx.aws.xebiatechevent.info:6081/
http://ajax.googleapis.com/
Bootstrap
S3 Simple Storage Service
http://cocktail.s3-website-us-east-1.amazonaws.com/
Wednesday, August 1, 12
You have learned
§ Add expiration headers to a Java web application
§ Use Bootstrap CDN and Google CDN
§ Use a web server auch as Apache Httpd as a Caching Proxy
§ Use a Caching Proxy such as Varnish Cache
§ Use a Content Delivery Network such as Amazon CloudFront
§ Integrate CDN based URLs in a web application
12Wednesday, August 1, 12
Your turn!
13
https://github.com/xebia-france/workshop-web-caching-cocktail/wiki/
Wednesday, August 1, 12
One more thing
14Wednesday, August 1, 12
Le billet de blog
15Wednesday, August 1, 12
Les 10 commandements du cache
http://blog.xebia.fr/2012/07/10/les-10-commandements-du-cache/
16Wednesday, August 1, 12