HOW TO MAKE WP FLY...



Similar documents
Layers of Caching: Key to scaling your website. Lance Albertson -- Narayan Newton

WordPress Optimization

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

Cache All The Things

BASICS OF SCALING: LOAD BALANCERS

Drupal Performance Tuning

MAGENTO HOSTING Progressive Server Performance Improvements

E-commerce is also about

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

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

Accelerating Wordpress for Pagerank and Profit

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

making drupal run fast

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

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

Igor Seletskiy. CEO, CloudLinux

Server Architecture for High- Performance Drupal

Choosing a Host. Gary binarygary.com WordCamp Jax 2016 #WCJAX

Are You Ready for the Holiday Rush?

BOA BARRACUDA ON ÆGIR ~ MY FIRST YEAR ~ Mladen

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

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

Ensuring scalability and performance with Drupal as your audience grows

A 100k Users.. Now What?

Buyer s Guide to Managed WordPress Hosting

How To Buy A Crikit For A Fraction Of The Price

PHP web serving study Performance report

The Benefits of WordPress Specific Web Hosting. Jamii Corley, Southwest Cyberport

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

Practical Load Balancing

Installation Guide for contineo

CloudLinux is a proven solution for shared hosting providers that:

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

Brace for 2012 Christoph

by

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

Zend Platform TM. White Paper: Zend Download Server. By Zend Technologies, Inc. May Zend Technologies, Inc. All rights reserved.

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

Performance for Site Builders

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

Interactive Module Uploading & Maintaining Websites

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

HW9 WordPress & Google Analytics

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

Advanced performance optimizations. By Peter Elmered

SETTING UP AN INSTANT MESSAGING SERVER

Efficient Network Marketing - Fabien Hermenier A.M.a.a.a.C.

MySQL: Cloud vs Bare Metal, Performance and Reliability

The Social Accelerator Setup Guide

Magento Performance Optimization Whitepaper

EXECUTIVE SUMMARY CONTENTS. 1. Summary 2. Objectives 3. Methodology and Approach 4. Results 5. Next Steps 6. Glossary 7. Appendix. 1.

WINDOWS AZURE EXECUTION MODELS

Lesson 7 - Website Administration

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

Getting FileMaker Server 11 and IIS 7.x to Work with SSL. By Todd Duell

How to get MOSS 2007 dev. environment set up in Vista with sample project.

How to Install SQL Server 2008

Bubble Full Page Cache for Magento

by Geoff Blake TenTonOnline.com

Who s me? Zequi Vázquez DevOps & Backend PhD student Hacking & Security Rock n Roll (electric guitarist) Videogames Books

JaM - PHP Error Monitoring Extension

Building Success on Acquia Cloud:

Session Storage in Zend Server Cluster Manager

Instalar debian 6 atualizado. Executar a sequencia abaixo

MLADEN

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

Scalability of web applications. CSCI 470: Web Science Keith Vertanen

HOW TO BUILD A VMWARE APPLIANCE: A CASE STUDY

Speed up your web site. Alan Seiden Consulting alanseiden.com

Asia Web Services Ltd. (vpshosting.com.hk)

University of Edinburgh. Performance audit. Date: Niels van Klaveren Kasper van der Leeden Yvette Vermeer

Varnish the Drupal way

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

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

3/21/2011. Topics. What is load balancing? Load Balancing

Coding Serbia. Systematic Load Testing of Web Applications.

Bubble Full Page Cache for Magento

Remote Network Accelerator

WordPress SEO 101

Designing, Scoping, and Configuring Scalable Drupal Infrastructure. Presented by David Strauss

White Paper. Java versus Ruby Frameworks in Practice STATE OF THE ART SOFTWARE DEVELOPMENT 1

Setting up FileMaker 10 Server

WEBSITE PERFORMANCE TAKING A LOOK AT PERFORMANCE TO HELP DECIDE WHERE TO HOST YOUR NEXT WEBSITE.

Common Server Setups For Your Web Application - Part II

Version of this tutorial: 1.06a (this tutorial will going to evolve with versions of NWNX4)

Magento Optimised Template CentOS 6 with cpanel/whm V1.0

HOSTING PYTHON WEB APPLICATIONS. Graham Dumpleton PyCon Australia Sydney 2011

Amazon Web Services Yu Xiao

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

THE WINDOWS AZURE PROGRAMMING MODEL

Cloud Computing & Hosting Solutions

Measuring CDN Performance. Hooman Beheshti, VP Technology

An Introduction to Cloud Computing Concepts

Receptionist-Small Business Administrator guide

I-Motion SQL Server admin concerns

How to Outsource Without Being a Ninnyhammer

5 Mistakes to Avoid on Your Drupal Website

Offerte del 10 maggio 2013

Supercharge your MySQL application performance with Cloud Databases

Web Hosting Tips & Tricks For Affiliates

Transcription:

EAST BAY WORDPRESS MEETUP HOW TO MAKE WP FLY... LIKE A BAT OUT OF HELL

EXPLAINING THE SECRETS BEHIND MANAGED HOSTING AND REALLY FAST WORDPRESS SITES THE ALTERNATIVE TITLE I could have renamed this presentation

Stefan Didak http://www.stefandidak.com ( not a web developer )

The sound a WordPress site should make when your client is happy to pay you more because their site is so fast that it puts their competition to shame. TIME = MONEY

Caching provided by optimizing your site Caching through plugins Caching because of all of the above As you ve already been shown today LEVELS OF CACHING all of those make a difference but... NOT ENOUGH

Don t just optimize your site Optimize YOUR SERVER! and if you have none, build one! Optimize YOUR CODE TOO! LEVELS OF CACHING Everything I m going to show today requires you to have full control and access to your server (VM, VPS, Cloud, etc.)

WordPress Caching Digital Ocean + DEMO OpCode Caching Apache v.s. Nginx Varnish Memcached WHAT I LL BE COVERING Also known as the Tip of the Iceberg

WP CACHING OVERVIEW Everyone should know what levels of caching WP supports

Only lasts the duration of the request. After the request the run-time cache no longer exists. For example: the global $post and $wp_query variables WORDPRESS CACHING Run-Time Cache

WordPress has a Transient Cache API that allows you to store data in your MySQL DB. Ahum... Right... But it can still be useful... if used selectively WORDPRESS CACHING Transient Cache

Is usually persistent because it s stored somewhere. Somewhere could be in memory through APC, Memcached, or Redis, but could also be in your MySQL DB or on disk. WORDPRESS CACHING Object Cache

Stores HTML data representing entire pages. This is one of the more typical caching schemes used by most plugins. Unfortunately, not so useful when you have highly dynamic pages where someone does not always get the same content (i.e. membership sites). WORDPRESS CACHING Page Cache - Stored on disk or in memory

I don t like the term and it is no different from the Object Cache. Instead of storing entire HTML pages it stores parts of pages. I like to think of it as just another object because that s what it is. WORDPRESS CACHING Fragment Cache

I prefer to have full control over my own online servers because I can have them be faster than managed hosting at a fraction of the cost. PERSONAL EXPERIENCE Managed Hosting, however optimized, is still designed to be a version of a one size fits all approach

GREAT PERFORMANCE & COOL PRICES GREAT(ER) PERFORMANCE & OK PRICES SLOW & EXPENSIVE NICE PERFORMANCE & CAN GET EXPENSIVE

After running and testing my first droplet on Digital Ocean and after playing with some deployments on Linode I knew my shared hosting for 30+ domains would come to an end. A very WELCOME END! FIRST DEPLOYMENT It was really exciting to see my first droplet come online

If you don t care much about the managed part of managed hosting and really want things to roar like a bat out of hell... HOSTING, BUT WHERE The long search has come to an end

Once my stealth project goes live I expect that within 2 years I will need around 150 to 500 virtual servers. (virtual servers of various capacities) Digital Ocean has the absolute best price point I ve seen. And I ve been looking. Really looking. STEALTH PROJECT Not to mention, Digital Ocean has a nice evolving API to manage all your droplets. Not as mature as Linode, though!

$20/mo shared hosting v.s. $5/mo Digital Ocean Droplet Oakley Chamber of Commerce WordPress site (a heavy and NOT OPTIMIZED one!) DEMO TIME! DEMO TIME! If this doesn t convince you I don t know what will

http://oakleychamber.com http://oc.ignyter.com TRY IT FOR YOURSELF anyone with laptops here are encouraged to check it out

WAS THAT FAST OR WAS THAT FAST? Or is it just cool to know that you can do it TOO!? YES YOU CAN Stop whining about the commandline and typing on the keyboard, as if you don t do that crap when you re CSS ing!!!

I can t show you managed hosting vs. Digital Ocean at a $25-30/month vs. $5-10/ month price point... BUT...

I will take any bet, for any amount of serious money, that I can setup and configure servers on Digital Ocean or Linode that beat the living daylights out of any managed hosting in terms of performance. And YOU can do it TOO! So let s not even talk about shared hosting anymore, ok?

I know what I m doing and... may be biased. I do, however, believe, that if you put in some time to learn more than what you copy & paste will serve you to be even more valuable to your clients! COPY AND PASTE If you can t do copy and paste then I m wasting your time and I am very sorry. If you can, however... new doors will open!

https://www.digitalocean.com/community https://library.linode.com/ TUTORIALS, GUIDES, AND MORE INSTALLING AND RUNNING On how to install, configure, and run with all the things I mentioned today, visit the libraries.

OPCODE CACHING And now to explain what you ve just seen

What your server does for EVERY page hit on your site: Read most (or all) of your PHP files/code Interpret each line & compile it into what the CPU understands Execute the compiled code and render out the page by sending it to the browser. OPCODE CACHING Yeah, uh, sure, what what does it DO?!

What your server does for EVERY page hit on your site: Read most (or all) of your PHP files/code Interpret each line & compile it into what the CPU understands Execute the compiled code and render out the page by sending it to the browser. OPCODE CACHING Yeah, uh, sure, what what does it DO?!

WITHOUT OPCODE CACHING PHP PARSE COMPILE EXECUTE SEND PHP APC CACHE EXECUTE SEND WITH OPCODE CACHING OPCODE CACHING The simple explanation

APC XCache eaccelerator Zend OpCache NuSphere PHPExpress IonCube Accelerator OPCODE CACHING Speeds up your site much more than regular file/data caching

Because APC is going to be included in PHP6 But as we all know, there is no such thing as PHP6, right? There is a book on PHP6. But there is no Beta of PHP6. There isn t even an Alpha of PHP6. BUT PHP 5.5 HAS OPCACHE Performance between APC, XCache, etc. is all very similar

PHP APC APC = Alternative PHP Cache

Without APC With vanilla APC Req. Per Sec : 85 Time Per Req. : 900ms Conc. Time Per Req. : 20ms Xfer Rate : 898 Kbytes/s Req. Per Sec : 138.5 Time Per Req. : 476ms Conc. Time Per Req. : 9.5ms Xfer Rate : 1265 Kbytes/s Great, but... IS THAT ALL? BENCHMARKING APC Your site without APC sucks donkey balls

Without APC With vanilla APC Req. Per Sec : 85 Time Per Req. : 900ms Conc. Time Per Req. : 20ms Xfer Rate : 898 Kbytes/s Req. Per Sec : 138.5 Time Per Req. : 476ms Conc. Time Per Req. : 9.5ms Xfer Rate : 1265 Kbytes/s Now with apc.stat=off Req. Per Sec : 317.4 Time Per Req. : 152.1ms Conc. Time Per Req. : 3.1ms Xfer Rate : 3985 Kbytes/s BENCHMARKING APC Your site with APC and apc.stat = off WILL FLY!

Only turn APC.STAT to OFF if: Your PHP code on the server does not change and you are willing to restart the web server if it does. WP or Plugin updates = CHANGE OF PHP CODE APC.STAT = OFF THINK AND PLAN BEFORE YOU TURN IT OFF

# /etc/init.d/apache2 restart It s just one line. Maybe not exactly the same as this one, though. And it s only for a few seconds. RESTARTING? SO WHAT? There are other ways to deal with this but those are for another time when we get real deep into server stuff

Ensure your server has: php-pear, php5-dev, make, apache2-prefork-dev # pecl install apc Then add the extension to your php.ini (or other) extension=apc.so INSTALLING APC Because it might be different for your flavor of server I m not going into too much detail here, but it s dead easy

apc.enabled=1 apc.shm_segments=1 apc.shm_size=128m (or 1G, etc.) apc.ttl=3600 apc.user_ttl=7200 apc.gc_ttl=3600 apc.max_file_size=1m apc.stat=1 (or 0) CONFIGURING APC You should tweak it as much as needed And there s a lot more you can tweak in APC

With APC installed you can use PHP function calls to... Manage the APC cache Interrogate the APC cache Load/Dump Binary cache data START OPTIMIZING YOUR CODE Integrate it selectively in your plugins WORTH KNOWING APC will also extend PHP with new functions

APC Object Cache Backend http://wordpress.org/plugins/apc/ Place the object-cache.php in your wp-content directory. Optionally you can also install the BATCACHE plugin APC WITH A WP PLUGIN Your mileage may vary

Apache = Process Based Nginx = Event Based APACHE V.S. NGINX Because you might get a lot of visitors... all at the same time!

Asynchronous Asynchronous = Scalability Fewer Server Resources (i.e. much less memory) Better for heavy load sites A FEW ADVANTAGES On sites with light traffic you will not see much difference in performance between event vs. processed based servers

10.000 concurrent connections and Nginx still uses only a few MB of memory Apache... 100 s of MB s And often will not even handle the load. ALSO A COST DIFFERENCE Part of the cost of virtual servers is the amount of memory that is available. Disk space is not as important as memory.

Back in 2008... 8000 live traffic requests per second Apache would have fallen over and DIED WORDPRESS.COM Big servers and big sites prefer Nginx... and now you know why

15MB of RAM and 10% of CPU resources Apache and a pound load balancer would freak out at the 1000th process, using 400+MB RAM and leaking 20MB RAM per hour GAME OVER Big servers and big sites prefer Nginx... and now you know why

WP development is intertwined with the Apache world. Support is limited but growing. http://codex.wordpress.org/nginx http://wiki.nginx.org/wordpress WORDPRESS & NGINX Not quite a match made in heaven You ll have to do some marriage counseling

Nginx has no conceptual notion of this thing called an.htaccess file http://wordpress.org/plugins/nginx-helper/ Search for Nginx related WP plugins WORDPRESS & NGINX WHERE THE HECK DID MY.HTACCESS FILE GO?!

Caching HTTP Reverse Proxy Proxy Servers are not just the thing you set in your browser

BROWSER PROXY SERVER WEBSITE BROWSER VARNISH WEBSITE With Varnish YOU control the caching (because not everyone uses a proxy) VARNISH And it really is... really really, really, REALLY FAST!

Cache on Disk Cache in Memory Control through VCL (Varnish Cache Language) VARNISH You control the proxy and you control the resources

VARNISH PORT 80 http://mysite.com APACHE OR NGINX PORT 8080 http://mysite.com:8080 Varnish points to a backend server which happens to be itself but with the web server on a different port VARNISH SAME SERVER Change the web server port to something else because Varnish should respond on port 80

VARNISH PORT 80 http://mysite.com http://somesite.com http://wowy.com http://admin.com APACHE OR NGINX PORT 8080 http://mysite.com:8080 http://wowy.com:8080 APACHE OR NGINX PORT 8081 http://somesite.com:8081 http://admin.com:8081 VARNISH DIFFERENT SERVERS You can do the setup in whatever way you like

# Drop any cookies sent to Wordpress. sub vcl_recv {! if (!(req.url ~ "wp-(login admin)")) {!! unset req.http.cookie;! } } # Drop any cookies Wordpress # tries to send back to the client. sub vcl_fetch {! if (!(req.url ~ "wp-(login admin)")) {!! unset beresp.http.set-cookie;! } } WP AND VARNISH BEWARE OF COOKIES

MEMCACHED The name of the game is DISTRIBUTED

The for dummies version: Make better use of memory Cache data in memory on other servers that aren t using it as much. AND IT DOES WHAT? It manages cache and memory... for more than one server

DISTRIBUTED, I SAID The more the merrier

System interconnects on servers (depending on how you plan and set them up) can still get more performance over TCP/IP and memory than a local server faced with only its limited resources. More servers = more memcached WORDPRESS.COM Yes, wordpress.com uses memcached. As do Twitter, Flickr, Wikipedia, Craigslist, YouTube, and many others

$mc = new Memcache; $mc->connect( 10.0.1.20, 11211); $data = cache this! ; $mc->set( mydata, $data, false, 100); $result = $mc->get( mydata ); MEMCACHED PHP When installed Memcached will provide you a lot of PHP functionality to have full control over your caching

BATCACHE http://wordpress.org/plugins/batcache/ Place the advanced-cache.php in your wp-content directory MEMCACHED PLUGIN Your mileage may vary

Single Malt Scotch Hi Stefan! Bourbon Hi Mitch! Tequila Hi Kelly! Beer Hi Andrei! LIFE IN THE SLOW LANE If all this server and site performance is getting to you! :-)

http://eastbaywp.com/ http://www.stefandidak.com DOWNLOAD THE SLIDES Because this MAY have gone WAY too FAST for you!

Digital Ocean https://www.digitalocean.com/ Linode https://www.linode.com/ Rackspace http://www.rackspace.com/ Amazon VPC http://aws.amazon.com/vpc/ APC http://php.net/manual/en/book.apc.php XCache http://xcache.lighttpd.net/ eaccelerator http://eaccelerator.net/ Zend OpCache/Optimizer/Platform http://en.wikipedia.org/wiki/zend_technologies Redis http://redis.io/ Memcached http://memcached.org/ WordPress Batcache http://wordpress.org/plugins/batcache/ WordPress APC Object Backend http://wordpress.org/plugins/apc/ And finally, a real developer s home office because everyone keeps asking... :-) http://www.stefandidak.com/office/ http://www.flickr.com/photos/didak/sets/72157633152434208/ http://www.flickr.com/photos/didak/sets/72157632343719954/ http://www.flickr.com/photos/didak/sets/72157632244753177/ Nginx http://nginx.org/ Varnish https://www.varnish-cache.org/ THINGS MENTIONED In case you want to go look stuff up for yourself

QUESTIONS Because I m sure there ll be some!