Slide 1

Slide 1 text

Making WordPress faster and greener By David Hilditch

Slide 2

Slide 2 text

How much energy does WordPress use? How to calculate? ● Percentage of websites using WordPress? ● Percentage of traffic hitting WordPress websites? ● Average price of hosting paid by WordPress websites?

Slide 3

Slide 3 text

WordPress hosting figures ● WordPress boasts about 35% of all websites ● 455 million WordPress websites ● Total hosting worth $77.5 billion per month ● $4 per site per month average for wordpress hosting ● WordPress about $2 billion per month worldwide ○ So about 2.6% of website traffic hits WordPress websites ● Websites use about 5% of electricity worldwide

Slide 4

Slide 4 text

Types of inefficiencies in the WordPress ecosystem Running code when not required Excessive options size and misuse of autoload Table Scans & WP_Query abuse Cache busting

Slide 5

Slide 5 text

Running code when not required ● Contact Forms 7 ● Popup Builder ● Mailjet ● Mailchimp ● Most plugins!

Slide 6

Slide 6 text

Excessive options size and misuse of autoload ● MBs of data loaded on every page ● MBs of data updated on every page

Slide 7

Slide 7 text

Table Scans & WP_Query abuse ● Table or index scans cause all your data to be read ● WP_Query with LIMIT 1 often used to check for existence of data ○ But they forget to remove the ‘orderby’ clause!

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

Cache busting ● Page caching is great ● But not if you can’t use it ● Commonly your uncached users are your most valuable ones ○ And they get a slow experience! ● If a WordPress plugin generates user-specific HTML, the solution is commonly to avoid page caching for those cases ○ That’s not good enough!

Slide 11

Slide 11 text

What can developers do to improve performance? ● Avoid table scans - test plugins at scale ● Avoid loading all data and processing it with PHP ● Avoid massive objects in wp_options ● Remove the sort order from WP_Query when not needed ● Learn how to use the object cache to store fragments from page to page ● Avoid cache busting - use Ajax for user-specific content ● Don’t run your code on pages where your code is not needed! ● Help me build an open source scalability test rig for WordPress

Slide 12

Slide 12 text

What can you do today to improve performance? ● Learn how to use Query Monitor ○ Long running queries ○ Hundreds or thousands of queries ○ Queries that retrieve thousands of rows ○ Excessive RAM usage ● Run Asset Cleanup Pro ○ Disable unused plugins per page ● Use an object cache ○ Prefer plugins which make good use of the object cache

Slide 13

Slide 13 text

How to get in touch Twitter: @davehilditch Facebook: davehilditch Github: dhilditch Website: www.wpintense.com Discord Server: Link on my website