SlideShare a Scribd company logo
1 of 47
Download to read offline
Love the Functionality, Hate
the Speed, Now What?
WordCamp Phoenix 2017
JOSHUA EICHORN
CTO, PAGELY
My WordPress Experience
• Built Pagely’s Hosting Stack
• Worked on our devops team
• Solved many performance problems
I Built a wordpress site
Its performance didn’t suck
Then I made the site a bit cooler
Its performance isn’t so great now
Now What?
Full Page Caching to the Rescue
Maybe Not
• Low cache hit rate
• Traffic from bots
• Logged in requests
• Full cache purge
Red Flag
Page rendering time
over 2 seconds
Lets do some math
• Server has 2 cores
• Each core can render
4 WordPress pages at
once
• Each page takes 2
seconds to complete
RPS Max = (2 * 4) / 2
RPS = 4
Now What?
Lets find whats slow
Slow is normally IO
Slow Database query
Slow http request
Its sometimes doing tons of fast things
Its less commonly doing something slow in
PHP land
Revert changes
one at a time
to pinpoint a slow plugin
1. APM like New Relic
2. Query Monitor, etc
3. P3 profiler
4. PHP profilers, Xdebug
Tools help pinpoint
a slow line of code
Query Monitor
Everything you can see
Digging in, found the slow
Now What?
Lets fix it.
If its not your code
FORK IT.
Plugins hosted in github makes it simple
At a minimum rename the folder,
update comments
Goal is to get your fixes upstream
CAUTION
Running patched
plugins without
renaming is a good
way to have auto
updates ruin your day
You can’t make the API faster, so limit its effects
Options:
• Caching around the API call
• Use a work queue
Fixing a slow API call
Caching using transients
Transients are the generic WordPress caching API
https://codex.wordpress.org/Transients_API
Stores data in object cache if available or wp_options
Example Before
Example After
Things to think about
Default to set_transient is no expiration
Often we are getting timely data
Set expirations as long as possible
Dynamic expirations are often the solution
Setting an Expiration
Transient Caching Results
Problem Solved?
Only if we can get a high enough cache hit rate
Long tail content
Bots crawling the site
What if the api gets slower
Moving the API call out
1. If you have the data, display it
2. If you don’t queue a request to load it,
Make API request outside of the normal flow
3. Update the data in transients
Some projects to look at
WP Minions: https://github.com/10up/WP-Minions
WP Background Processing:
https://github.com/A5hleyRich/wp-background-
processing
Lets build a basic queue
Store jobs in an option
Process them using wp-cron
Limitations
Keep the max queue size relatively small
Will have a low max processing rate
Will be prone to race conditions
Setup the cron
Update render to handle no value
Return a cache value or queue
Make
API
calls
in the
cron
Remove tasks from the queue
Queue Results
Problem Solved?
As long as our queue can keep up
High rate sites will need to use something like WP
Minions
The fixes we tried
Added a full page cache
Patched the plugin
Caching around API calls
Moving API calls to a work queue
What I normally do
Use full page caching and Transient Caching
For really high traffic sites use WP Minions
Thanks ☺

More Related Content

What's hot

Automated Web App Performance Testing Using WebDriver
Automated Web App Performance Testing Using WebDriverAutomated Web App Performance Testing Using WebDriver
Automated Web App Performance Testing Using WebDriver
seleniumconf
 
Don’t Be Scared: Multi-Tenant Cluster Support at Scale (Kelly Attaway, Pandor...
Don’t Be Scared: Multi-Tenant Cluster Support at Scale (Kelly Attaway, Pandor...Don’t Be Scared: Multi-Tenant Cluster Support at Scale (Kelly Attaway, Pandor...
Don’t Be Scared: Multi-Tenant Cluster Support at Scale (Kelly Attaway, Pandor...
confluent
 

What's hot (20)

A Customized Approach to HTTP Proxy Caching in Ruby
A Customized Approach to HTTP Proxy Caching in RubyA Customized Approach to HTTP Proxy Caching in Ruby
A Customized Approach to HTTP Proxy Caching in Ruby
 
Introduction to performance tuning perl web applications
Introduction to performance tuning perl web applicationsIntroduction to performance tuning perl web applications
Introduction to performance tuning perl web applications
 
Cache is keeping you from reaching the full potential as a developer (word ca...
Cache is keeping you from reaching the full potential as a developer (word ca...Cache is keeping you from reaching the full potential as a developer (word ca...
Cache is keeping you from reaching the full potential as a developer (word ca...
 
Service workers: what and why UmbUKFest 2018!
Service workers: what and why UmbUKFest 2018!Service workers: what and why UmbUKFest 2018!
Service workers: what and why UmbUKFest 2018!
 
A Practical Introduction to Functions-as-a-Service
A Practical Introduction to Functions-as-a-ServiceA Practical Introduction to Functions-as-a-Service
A Practical Introduction to Functions-as-a-Service
 
The 5 most common reasons for a slow WordPress site and how to fix them – ext...
The 5 most common reasons for a slow WordPress site and how to fix them – ext...The 5 most common reasons for a slow WordPress site and how to fix them – ext...
The 5 most common reasons for a slow WordPress site and how to fix them – ext...
 
Use Xdebug to profile PHP
Use Xdebug to profile PHPUse Xdebug to profile PHP
Use Xdebug to profile PHP
 
PAC 2019 virtual Mark Tomlinson
PAC 2019 virtual Mark TomlinsonPAC 2019 virtual Mark Tomlinson
PAC 2019 virtual Mark Tomlinson
 
Low maintenance perl notes
Low maintenance perl notesLow maintenance perl notes
Low maintenance perl notes
 
Александр Махомет "Beyond the code или как мониторить ваш PHP сайт"
Александр Махомет "Beyond the code или как мониторить ваш PHP сайт"Александр Махомет "Beyond the code или как мониторить ваш PHP сайт"
Александр Махомет "Beyond the code или как мониторить ваш PHP сайт"
 
Automated Web App Performance Testing Using WebDriver
Automated Web App Performance Testing Using WebDriverAutomated Web App Performance Testing Using WebDriver
Automated Web App Performance Testing Using WebDriver
 
Nate Reist WCGR WP AJAX presentation
Nate Reist WCGR WP AJAX presentationNate Reist WCGR WP AJAX presentation
Nate Reist WCGR WP AJAX presentation
 
Spreadshirt Techcamp 2018 - Hold until Told
Spreadshirt Techcamp 2018 - Hold until ToldSpreadshirt Techcamp 2018 - Hold until Told
Spreadshirt Techcamp 2018 - Hold until Told
 
Performance Testing w/ WebPage Test Private Instance (DrupalCamp Ohio)
Performance Testing w/ WebPage Test Private Instance (DrupalCamp Ohio)Performance Testing w/ WebPage Test Private Instance (DrupalCamp Ohio)
Performance Testing w/ WebPage Test Private Instance (DrupalCamp Ohio)
 
Building a better web
Building a better webBuilding a better web
Building a better web
 
How to investigate and recover from a security breach in WordPress
How to investigate and recover from a security breach in WordPressHow to investigate and recover from a security breach in WordPress
How to investigate and recover from a security breach in WordPress
 
Altitude SF 2017: Reddit - How we built and scaled r/place
Altitude SF 2017: Reddit - How we built and scaled r/placeAltitude SF 2017: Reddit - How we built and scaled r/place
Altitude SF 2017: Reddit - How we built and scaled r/place
 
Inside election night at The New York Times | Altitude NYC
Inside election night at The New York Times | Altitude NYCInside election night at The New York Times | Altitude NYC
Inside election night at The New York Times | Altitude NYC
 
Altitude San Francisco 2018: HTTP Invalidation Workshop
Altitude San Francisco 2018: HTTP Invalidation WorkshopAltitude San Francisco 2018: HTTP Invalidation Workshop
Altitude San Francisco 2018: HTTP Invalidation Workshop
 
Don’t Be Scared: Multi-Tenant Cluster Support at Scale (Kelly Attaway, Pandor...
Don’t Be Scared: Multi-Tenant Cluster Support at Scale (Kelly Attaway, Pandor...Don’t Be Scared: Multi-Tenant Cluster Support at Scale (Kelly Attaway, Pandor...
Don’t Be Scared: Multi-Tenant Cluster Support at Scale (Kelly Attaway, Pandor...
 

Similar to WordPress Speed & Performance from Pagely's CTO

Site Performance - From Pinto to Ferrari
Site Performance - From Pinto to FerrariSite Performance - From Pinto to Ferrari
Site Performance - From Pinto to Ferrari
Joseph Scott
 
Tips for a Faster Website
Tips for a Faster WebsiteTips for a Faster Website
Tips for a Faster Website
Rayed Alrashed
 
My site is slow
My site is slowMy site is slow
My site is slow
hernanibf
 
2013 - Dustin whittle - Escalando PHP en la vida real
2013 - Dustin whittle - Escalando PHP en la vida real2013 - Dustin whittle - Escalando PHP en la vida real
2013 - Dustin whittle - Escalando PHP en la vida real
PHP Conference Argentina
 
PHP Performance: Principles and tools
PHP Performance: Principles and toolsPHP Performance: Principles and tools
PHP Performance: Principles and tools
10n Software, LLC
 

Similar to WordPress Speed & Performance from Pagely's CTO (20)

BTV PHP - Building Fast Websites
BTV PHP - Building Fast WebsitesBTV PHP - Building Fast Websites
BTV PHP - Building Fast Websites
 
Northeast PHP - High Performance PHP
Northeast PHP - High Performance PHPNortheast PHP - High Performance PHP
Northeast PHP - High Performance PHP
 
Optimizing the performance of WordPress
Optimizing the performance of WordPressOptimizing the performance of WordPress
Optimizing the performance of WordPress
 
12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL
 
Top ten-list
Top ten-listTop ten-list
Top ten-list
 
Site Performance - From Pinto to Ferrari
Site Performance - From Pinto to FerrariSite Performance - From Pinto to Ferrari
Site Performance - From Pinto to Ferrari
 
Speeding up your Drupal site
Speeding up your Drupal siteSpeeding up your Drupal site
Speeding up your Drupal site
 
Making it fast: Zotonic & Performance
Making it fast: Zotonic & PerformanceMaking it fast: Zotonic & Performance
Making it fast: Zotonic & Performance
 
My Site is slow - Drupal Camp London 2013
My Site is slow - Drupal Camp London 2013My Site is slow - Drupal Camp London 2013
My Site is slow - Drupal Camp London 2013
 
Profiling php applications
Profiling php applicationsProfiling php applications
Profiling php applications
 
Improve WordPress performance with caching and deferred execution of code
Improve WordPress performance with caching and deferred execution of codeImprove WordPress performance with caching and deferred execution of code
Improve WordPress performance with caching and deferred execution of code
 
Tips for a Faster Website
Tips for a Faster WebsiteTips for a Faster Website
Tips for a Faster Website
 
Speeding up your WordPress Site - WordCamp Toronto 2015
Speeding up your WordPress Site - WordCamp Toronto 2015Speeding up your WordPress Site - WordCamp Toronto 2015
Speeding up your WordPress Site - WordCamp Toronto 2015
 
My site is slow
My site is slowMy site is slow
My site is slow
 
Decoupling Edutopia.org
Decoupling Edutopia.orgDecoupling Edutopia.org
Decoupling Edutopia.org
 
2013 - Dustin whittle - Escalando PHP en la vida real
2013 - Dustin whittle - Escalando PHP en la vida real2013 - Dustin whittle - Escalando PHP en la vida real
2013 - Dustin whittle - Escalando PHP en la vida real
 
PHP Performance: Principles and tools
PHP Performance: Principles and toolsPHP Performance: Principles and tools
PHP Performance: Principles and tools
 
Profiling and Tuning a Web Application - The Dirty Details
Profiling and Tuning a Web Application - The Dirty DetailsProfiling and Tuning a Web Application - The Dirty Details
Profiling and Tuning a Web Application - The Dirty Details
 
Caching 101
Caching 101Caching 101
Caching 101
 
Background processing with hangfire
Background processing with hangfireBackground processing with hangfire
Background processing with hangfire
 

Recently uploaded

Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
Kamal Acharya
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
Neometrix_Engineering_Pvt_Ltd
 

Recently uploaded (20)

Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal load
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
Engineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesEngineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planes
 
Moment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilMoment Distribution Method For Btech Civil
Moment Distribution Method For Btech Civil
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to Computers
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 

WordPress Speed & Performance from Pagely's CTO