Cache All The Things

Similar documents
CloudOYE CDN USER MANUAL

The importance of Drupal Cache. Luis F. Ribeiro Ci&T Inc. 2013

Drupal Performance Tuning

(An) Optimal Drupal 7 Module Configuration for Site Performance JOE PRICE

making drupal run fast

Accelerating Wordpress for Pagerank and Profit

Varnish Tips & Tricks, 2015 edition

4x High Performance for Drupal. Presented by Fabian Franz. Step by Step

Web Performance. Sergey Chernyshev. March '09 New York Web Standards Meetup. New York, NY. March 19 th, 2009

Performance for Site Builders

WordPress Optimization

Simple Tips to Improve Drupal Performance: No Coding Required. By Erik Webb, Senior Technical Consultant, Acquia

E-commerce is also about

Headless Drupal. Buzzword or Next Big Thing? Drupal City Berlin

Modern Web Development From Angle Brackets to Web Sockets

Protocolo HTTP. Web and HTTP. HTTP overview. HTTP overview

Large-Scale Web Applications

BASICS OF SCALING: LOAD BALANCERS

A 100k Users.. Now What?

N-tier ColdFusion scalability. N-tier ColdFusion scalability WebManiacs 2008 Jochem van Dieten

Edge80: A New Approach to High Performance Content Delivery

Practical Load Balancing

HOW TO MAKE WP FLY...

HTTP Caching & Cache-Busting for Content Publishers

Tipping The Scale Tips, Tools, and Techniques For Building Scalable. Steve French Senior Software Engineer digg.com

PHP on IBM i: What s New with Zend Server 5 for IBM i

Nginx 1 Web Server Implementation

The best reverse proxy around. Kristian Lyngstøl PRODUCTS CONSULTING APPLICATION MANAGEMENT IT OPERATIONS SUPPORT TRAINING

Web Application Deployment in the Cloud Using Amazon Web Services From Infancy to Maturity

Drupal Performance Tips and Tricks. Khalid Baheyeldin. Drupal Camp Toronto 2014

The Hyper-Text Transfer Protocol (HTTP)

9 Tried and Tested Tips to Increase the Power of your Magento Store

Are You Ready for the Holiday Rush?

Virginia, United States Zurich, Switzerland Cape Town, South Africa. Hosted at the data center of VSHN, DIN-ISO/ IEC and Finma 2008/7 certified

Ensuring scalability and performance with Drupal as your audience grows

reference: HTTP: The Definitive Guide by David Gourley and Brian Totty (O Reilly, 2002)

ZingMe Practice For Building Scalable PHP Website. By Chau Nguyen Nhat Thanh ZingMe Technical Manager Web Technical - VNG

Drupal in the Cloud. by Azhan Founder/Director S & A Solutions

Web Performance. Lab. Bases de Dados e Aplicações Web MIEIC, FEUP 2014/15. Sérgio Nunes

Server Architecture for High- Performance Drupal

Computer Networks. Lecture 7: Application layer: FTP and HTTP. Marcin Bieńkowski. Institute of Computer Science University of Wrocław

Demystifying cache. Kristian Lyngstøl Product Specialist Varnish Software AS

Loudon & Company. Better Decision-Making:! Drupal Performance

by

Drupal Training Modules 2015

Buyer s Guide to Managed WordPress Hosting

Brace for 2012 Christoph

Dynamic Content Acceleration: Lightning-Fast Web Apps with Amazon CloudFront and Amazon Route 53

Integrating the F5 BigIP with Blackboard

HTTP. Internet Engineering. Fall Bahador Bakhshi CE & IT Department, Amirkabir University of Technology

5 Mistakes to Avoid on Your Drupal Website

MAGENTO HOSTING Progressive Server Performance Improvements

Outline Definition of Webserver HTTP Static is no fun Software SSL. Webserver. in a nutshell. Sebastian Hollizeck. June, the 4 th 2013

What Happens When A Website Crashes: A Case Study. John Bafford Senior Director, Programming Services The Bivings Group

Varnish the Drupal way

79 Tips and Tricks for Magento Performance Improvement. for Magento Performance Improvement

CONTENT DELIVERY WHITE PAPER proinity GmbH 1

Comparative Performance Report

Measuring CDN Performance. Hooman Beheshti, VP Technology

CDN Operation Manual

CS 188/219. Scalable Internet Services Andrew Mutz October 8, 2015

Magento & Zend Benchmarks Version 1.2, 1.3 (with & without Flat Catalogs)

Common Server Setups For Your Web Application - Part II

AUDIT REPORT EXAMPLE

Ruby on Rails Security. Jonathan Weiss, Peritor Wissensmanagement GmbH

Distributed Systems. 23. Content Delivery Networks (CDN) Paul Krzyzanowski. Rutgers University. Fall 2015

Wednesday, October 10, 12. Running a High Performance LAMP stack on a $20 Virtual Server

TABLE OF CONTENTS. I. Executive Summary II. Results Overview III. Performance Testing Methodology... 5

The Devil is in the Details. How to Optimize Magento Hosting to Increase Online Sales

Lesson 7 - Website Administration

Doug Goldberg. Vice President of Magento Solutions, ZeroLag

Project #2. CSE 123b Communications Software. HTTP Messages. HTTP Basics. HTTP Request. HTTP Request. Spring Four parts

CS640: Introduction to Computer Networks. Applications FTP: The File Transfer Protocol

Architecture of So-ware Systems HTTP Protocol. Mar8n Rehák

Introduction to ServerIron ADX Application Switching and Load Balancing. Module 6: Content Switching (CSW) Revision 0310

Comparitive Performance Report

Modern Web development and operations practices. Grig Gheorghiu VP Tech Operations Nasty Gal

Learning To Fly: How Angry Birds Reached the Heights of Store Performance

CTIS 256 Web Technologies II. Week # 1 Serkan GENÇ

Implementing Reverse Proxy Using Squid. Prepared By Visolve Squid Team

Getting Started with AWS. Hosting a Static Website

Exercises: FreeBSD: Apache and SSL: pre SANOG VI Workshop

Hypertext for Hyper Techs

8ch.net Privacy Policy

Intro to Web Programming. using PHP, HTTP, CSS, and Javascript Layton Smith CSE 4000

APACHE WEB SERVER. Andri Mirzal, PhD N

Drupal CMS for marketing sites

CIS 551 / TCOM 401 Computer and Network Security. Spring 2007 Lecture 20

Hardened Plone. Making Your Plone Site Even More Secure. Presented by: Nathan Van Gheem

Click to edit Master title style. Click to edit Master text styles. Hedley Aylott. CEO Summit

Taking Drupal development to the Cloud. Karel Bemelmans

Advanced performance optimizations. By Peter Elmered

FormAPI, AJAX and Node.js

Cache Configuration Reference

Distributed Systems. 25. Content Delivery Networks (CDN) 2014 Paul Krzyzanowski. Rutgers University. Fall 2014

Building a large scale CDN with Apache Trafficserver. Jan van Doorn jan_vandoorn@cable.comcast.com

The Web: some jargon. User agent for Web is called a browser: Web page: Most Web pages consist of: Server for Web is called Web server:

Table of Contents. Overview... 1 Introduction... 2 Common Architectures Technical Challenges with Magento ChinaNetCloud's Experience...

Website Optimization Tips for Speed

Carbon Dating the Web

Transcription:

Cache All The Things

About Me Mike Bell Drupal Developer @mikebell_ http://drupal.org/user/189605

Exactly what things? erm... everything!

No really... Frontend: - HTML - CSS - Images - Javascript Backend: - PHP - MySQL So pretty much everything then!

Where to start? Ask yourself: Why is my site slow? a) Bad code b) Bad server c) It's not!

Bad Code Stop. Caching will help... but it won't solve your bigger issues. There are tools to help - xhprof (not covered here)

Bad Server? So how's 5.99 a month working out for you? Caching will help... but you still have bigger issues. Scale horizontally/vertically for a quick fix then work on additional caching.

It's not! I like you! Caching is always a good thing, except when you have to debug it...

Caching in Drupal - Code Level (cache_get/cache_set) - APC (not covering) - Resource caching (this get's tricky!) - DB Layer - CDNs (related to resource caching)

Code Level Drupal has it's own caching api. Module Developers use it! cache_set - store data in Drupals cache table cache_get - get data from Drupals cache table You can even define your own cache tables!

Code Level (example) <?php function mymodule_cached_data($reset = FALSE) { global $language; $langcode = $language->language; $data = &drupal_static( FUNCTION, NULL, $reset); if (!isset($data)) { if (!$reset && $cache = cache_get("mymodule_cached_data:$langcode") &&!empty($cache->data)) { $data = $cache->data; } else { $data = t('this would be an array or string generated using translated strings.'); cache_set("mymodule_cached_data:$langcode", $data); } } return $data; }?> (source - http://drupal.org/node/145279)

Resource Caching Many different types of resources Each can be cached by different tools Example: - Drupals CSS/JS Cache - Drupals Page Cache - Boost - Varnish

Resource Caching Drupal default: CSS/JS and Page (taken from digital006.com - ooppss!)

Resource Caching - Boost Boost - http://drupal.org/project/boost Static caching for all Drupal Assets Anonymous users only Ideal for shared hosting environments Potentially the easiest to setup

Resource Caching - Varnish Application Accelerator Linux Only Caches resources based on initial view Anonymous only - very picky with sessions and cookies Insanely Powerful

Resource Caching - Varnish Advanced setup - requires additional module and VCL for Drupal - http://drupal.org/project/varnish Granular ttls (time to live) Specific resource (image/css) and page element! All available through VCL config.

Resource Caching - Varnish Anatomy of a varnish hit: HTTP/1.1 200 OK Server: Apache X-Drupal-Cache: MISS Expires: Sun, 19 Nov 1978 05:00:00 GMT Last-Modified: Tue, 08 Jan 2013 21:20:17 +0000 Cache-Control: public, max-age=900 ETag: "1357680017-1" Content-Language: en X-Generator: Drupal 7 (http://drupal.org) Link: </node/5468>; rel="shortlink",<http://badgerfakedomain.com/>; rel="canonical" Vary: Accept-Encoding Content-Type: text/html; charset=utf-8 Date: Tue, 08 Jan 2013 21:20:22 GMT X-Varnish: 979772308 979772303 Age: 3 Via: 1.1 varnish Connection: keep-alive X-Cache: HIT

Resource Caching - Varnish Cache Stores - RAM - Disk Ram - super fast - requires a lot of ram Disk - fast - disk space is rarely an issue

Data Caching - memcached Data and Database caching layer Caches cache... (and things!)

Data Caching - memcached Example: Core cache - core cache tables (cache_*) Moved into memcached and shared between multiple instances across multiple servers Simple api makes getting and setting easy Drupal requires - http://drupal. org/project/memcache and pecl extension

3rd Party Caching - Akamai One of the biggest caching providers A high chance you've experienced Akamai 4-5 times today. Static cache of resources Content Distribution Network 100+ Edge servers all over the planet

3rd Party Caching - Akamai Coverage for DDOS attacks - Active monitoring and defense Advanced redirection rules through control panel It's not cheap! It's also pretty magical.

3rd Party Caching - Cloudflare Similar to Akamai Smaller scale Emphasis on security and DDOS protection

Content Distribution Networks CDNs for short Offload resource handling to external provider - Images - Video - Audio - Large files Syndicate content around the world

Content Distribution Network Why use a CDN? - Content is delivered quicker -- Latency cut down Pricing is granular - pay as you go type deal Amazon + Rackspace Cloud Files

How does it all fit together? Varnish Apache / Nginx Mysql / memcache Akamai Load Balancer Apache / Nginx Apache / Nginx Mysql / memcache Mysql / memcache Varnish Apache / Nginx Mysql / memcache

What happens when it all goes wrong?

Caching to the rescue Each layer provides protection 3rd Party - shield 99% of anon traffic Varnish - the rest Anonymous users should never know your site has issues.

Debugging Tips Configure different urls for different platforms - Easier to identify what cache layer has an issue Don't be afraid to flush caches - Your backend should be able to cope with it Analyse headers! Drupal and Varnish provide a lot of info

Debugging Tips Monitor each layer - Icinga - Pingdom

Any Questions?