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
![Page 1: Web Caching Workshop - mod_cache, Varnish, Amazon CloudFront CDN & S3](https://reader034.vdocuments.us/reader034/viewer/2022052206/554fb7f2b4c9053d018b45bd/html5/thumbnails/1.jpg)
Web Caching Workshopmod_cache, Varnish,
Amazon CloudFront CDN & S3
Julia MateoCharles BlondeCyrille Le ClercSeven Le MesleStéphane Moreau
Wednesday, August 1, 12
![Page 2: Web Caching Workshop - mod_cache, Varnish, Amazon CloudFront CDN & S3](https://reader034.vdocuments.us/reader034/viewer/2022052206/554fb7f2b4c9053d018b45bd/html5/thumbnails/2.jpg)
L’équipe
§ Julia Mateo @juliamateo82§ Charles Blonde @blondecharles§ Cyrille Le Clerc @cyrilleleclerc§ Seven Le Mesle @slemesle§ Stéphane Moreau @stfmoreau
2Wednesday, August 1, 12
![Page 3: Web Caching Workshop - mod_cache, Varnish, Amazon CloudFront CDN & S3](https://reader034.vdocuments.us/reader034/viewer/2022052206/554fb7f2b4c9053d018b45bd/html5/thumbnails/3.jpg)
Cocktail
3Wednesday, August 1, 12
![Page 4: Web Caching Workshop - mod_cache, Varnish, Amazon CloudFront CDN & S3](https://reader034.vdocuments.us/reader034/viewer/2022052206/554fb7f2b4c9053d018b45bd/html5/thumbnails/4.jpg)
Initial Architecture
4
TomcatInternet
cocktail
YSlow
Initial Architecture
http://xfr-cocktail-xxx.elasticbeanstalk.com/
Wednesday, August 1, 12
![Page 5: Web Caching Workshop - mod_cache, Varnish, Amazon CloudFront CDN & S3](https://reader034.vdocuments.us/reader034/viewer/2022052206/554fb7f2b4c9053d018b45bd/html5/thumbnails/5.jpg)
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
![Page 6: Web Caching Workshop - mod_cache, Varnish, Amazon CloudFront CDN & S3](https://reader034.vdocuments.us/reader034/viewer/2022052206/554fb7f2b4c9053d018b45bd/html5/thumbnails/6.jpg)
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
![Page 7: Web Caching Workshop - mod_cache, Varnish, Amazon CloudFront CDN & S3](https://reader034.vdocuments.us/reader034/viewer/2022052206/554fb7f2b4c9053d018b45bd/html5/thumbnails/7.jpg)
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
![Page 8: Web Caching Workshop - mod_cache, Varnish, Amazon CloudFront CDN & S3](https://reader034.vdocuments.us/reader034/viewer/2022052206/554fb7f2b4c9053d018b45bd/html5/thumbnails/8.jpg)
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
![Page 9: Web Caching Workshop - mod_cache, Varnish, Amazon CloudFront CDN & S3](https://reader034.vdocuments.us/reader034/viewer/2022052206/554fb7f2b4c9053d018b45bd/html5/thumbnails/9.jpg)
Varnish Caching Proxy
9
TomcatInternet
cocktail
YSlow
Varnish caching proxy
Varnish
http://www-cocktail-xxx.aws.xebiatechevent.info:6081/
Wednesday, August 1, 12
![Page 10: Web Caching Workshop - mod_cache, Varnish, Amazon CloudFront CDN & S3](https://reader034.vdocuments.us/reader034/viewer/2022052206/554fb7f2b4c9053d018b45bd/html5/thumbnails/10.jpg)
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
![Page 11: Web Caching Workshop - mod_cache, Varnish, Amazon CloudFront CDN & S3](https://reader034.vdocuments.us/reader034/viewer/2022052206/554fb7f2b4c9053d018b45bd/html5/thumbnails/11.jpg)
“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
![Page 12: Web Caching Workshop - mod_cache, Varnish, Amazon CloudFront CDN & S3](https://reader034.vdocuments.us/reader034/viewer/2022052206/554fb7f2b4c9053d018b45bd/html5/thumbnails/12.jpg)
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
![Page 13: Web Caching Workshop - mod_cache, Varnish, Amazon CloudFront CDN & S3](https://reader034.vdocuments.us/reader034/viewer/2022052206/554fb7f2b4c9053d018b45bd/html5/thumbnails/13.jpg)
Your turn!
13
https://github.com/xebia-france/workshop-web-caching-cocktail/wiki/
Wednesday, August 1, 12
![Page 14: Web Caching Workshop - mod_cache, Varnish, Amazon CloudFront CDN & S3](https://reader034.vdocuments.us/reader034/viewer/2022052206/554fb7f2b4c9053d018b45bd/html5/thumbnails/14.jpg)
One more thing
14Wednesday, August 1, 12
![Page 15: Web Caching Workshop - mod_cache, Varnish, Amazon CloudFront CDN & S3](https://reader034.vdocuments.us/reader034/viewer/2022052206/554fb7f2b4c9053d018b45bd/html5/thumbnails/15.jpg)
Le billet de blog
15Wednesday, August 1, 12
![Page 16: Web Caching Workshop - mod_cache, Varnish, Amazon CloudFront CDN & S3](https://reader034.vdocuments.us/reader034/viewer/2022052206/554fb7f2b4c9053d018b45bd/html5/thumbnails/16.jpg)
Les 10 commandements du cache
http://blog.xebia.fr/2012/07/10/les-10-commandements-du-cache/
16Wednesday, August 1, 12