enterprise-scale wordpress

54
Enterprise-Scale WordPress KEANAN KOPPENHAVER @KKOPPENHAVER HTTP://GITHUB.COM/KKOPPENHAVER HTTP://LEVELUPWP.NET [email protected]

Upload: keanan-koppenhaver

Post on 16-Apr-2017

286 views

Category:

Technology


0 download

TRANSCRIPT

Enterprise-Scale WordPress

K E A N A N KO P P E N H AV E R

@KKOPPENHAVER

HTTP://GITHUB.COM/KKOPPENHAVER

HTTP://LEVELUPWP.NET

[email protected]

Who Am I?

• Developer at doejo

• Been working primarily on WP projects for the past 3 years

• Scaling up from small marketing sites

What’s the #1 rule of Enterprise-Scale WordPress?

Everything takes longer. (and that’s a good thing)

Part 1 | Infrastructure

WordPress VIP

What is WordPress VIP?

• Managed Hosting by Automattic

• Serves just over 22 billion page views/month

• Includes Security, Code Review, and much more

• Hosted on the same platform that powers millions of blogs on WordPress.com

WordPress.Com Serves 70,000 Req/Sec And Over 15 Gbit/Sec Of Traffic (2012)

Source: http://highscalability.com/blog/2012/9/26/wordpresscom-serves-70000-reqsec-and-over-15-gbitsec-of-traf.html

What if I don’t want to pay $5k+/month?

What if I want to manage it myself?

What kind of traffic are we talking about?

• 4-6 million pageviews / month

• 20,000 page views / hour (during the work day)

• 5 page views every second (among 100s of concurrent connections)

Multiple Environments

Small-Scale

FTP

KEANAN’S MACBOOK HTTP://KEANANKOPPENHAVER.COM

SSH

Enterprise-Scale

KEANAN’S MACBOOK

HTTP://DEV.KK.COM

HTTP://QA.KK.COM

HTTP://BETA.KK.COM

HTTP://KK.COM

Load Balancing

Small-Scale

HTTP://KEANANKOPPENHAVER.COMKEANAN’S MACBOOK

Enterprise-Scale

KK-PROD1

KK-PROD2

KK-PROD3

KEANAN’S MACBOOK

Load Balancer Icon by Alex WaZa for Noun Project

HTTP://KK.COM

Why load balance?

Servers are busy

• Serving static assets (HTML/CSS/JS/JPG/PNG/PDF, etc…)

• Processing and serving all needed PHP templates

• Making MySQL calls

Enterprise-Scale

KK-PROD1

KK-PROD2

KK-PROD3

KEANAN’S MACBOOK

Load Balancer Icon by Alex WaZa for Noun Project

HTTP://KK.COM

Caching

Servers are busy

• Serving static assets (HTML/CSS/JS/JPG/PNG/PDF, etc…)

• Processing and serving all needed PHP templates

• Making MySQL calls

Front End Caching

Front End Caching• Cache stored on the user’s machine

• Specified expiration date when the asset is “stale”

• Saves the server from serving these assets that don’t change

• Advanced Mode: Cache busting URL string

• Super Advanced Mode: CDN

Back End Caching

https://memcached.org/

Memcached is…often used to speed up dynamic database-driven websites by caching data and

objects in RAM to reduce the number of times an external data source (such as a database or API)

must be read.

Backend Caching

• Memcached saves web server and database server

• Prevents blocking DB calls

• Must be flushed when changes are made

Phil Carlton, Tim Bray, Jeff Atwood, and many others

There are two hard things in computer science: cache invalidation, naming things, and off-by-one

errors.

Part 2 | Workflow

Task Management

Task Management

• JIRA/Trello

• Sprint Planning

• Can be tied in with Version Control

Version Control

Version Control

• Git (Command Line or Source Tree)

• Branches are important

• Tie branches and commits to tickets

• You may need…

Code Review

Code Review

• Peer review of your commits

• Included with WP VIP

• Useful double check

• Useful for learning across the team

Automated Deployments

Automated Deployments

• No more manual FTP

• Deploy from Version Control

• Ensure pre- and post-deployment steps are the same every time

• Deployment == One Less Thing To Think About

Part 3 | Dos and Don’ts

( ^^ functions.php)

DON’T: Dump everything in functions.php

• Multiple files with grouped functions

• Namespacing

• Sanity when Searching

• lib/*

DON’T: Dump everything in functions.php (Part 2)

• Bigger than a group of functions? Feature Plugin.

• Pros: Can be maintained independently

• Cons: Has to be maintained independently

DO: Keep request count low

• Ad Networks, Analytics, Social Integration, etc

• Maximum simultaneous connections (per browser)

• Think of the mobile users

• Luckily, Dev Tools has your back

In summary…

Everything takes longer. (and that’s a good thing)

Questions?K E A N A N KO P P E N H AV E R

@KKOPPENHAVER

HTTP://GITHUB.COM/KKOPPENHAVER

HTTP://LEVELUPWP.NET

[email protected]