paint-brush
Putting WordPress into Hyperdriveby@jhabdas
3,099 reads
3,099 reads

Putting WordPress into Hyperdrive

by Josh HabdasApril 25th, 2017
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

After giving a talk at <a href="https://2017.ubud.wordcamp.org/" target="_blank">WordCamp Ubud 2017</a> — where I showed how to use a <strong>$5 Vultr box and Redis with </strong><a href="https://loadimpact.com/" target="_blank"><strong>Load Impact</strong></a><strong> to support up to 7000 concurrent WordPress users </strong>— I was asked to help turn some of the performance optimization work demoed into a WordPress plug-in.

People Mentioned

Mention Thumbnail

Company Mentioned

Mention Thumbnail

Coin Mentioned

Mention Thumbnail
featured image - Putting WordPress into Hyperdrive
Josh Habdas HackerNoon profile picture

Prepare for Ludicrous Speed

After giving a talk at WordCamp Ubud 2017 — where I showed how to use a $5 Vultr box and Redis with Load Impact to support up to 7000 concurrent WordPress users — I was asked to help turn some of the performance optimization work demoed into a WordPress plug-in.

This is that plugin, currently in beta:


comfusion/hyperdrive_hyperdrive - ⚡ Hyperdrive Plugin for WordPress_github.com

It’s the first of it’s kind — and like no other performance plugin to precede it. Based on initial tests it speeds up the stock Twenty Seventeen theme about 300% and I suspect time will show even greater gains for other themes. It builds on top of a performance optimization technique called Fetch Injection, enabling external scripts to download asynchronously in parallel while preserving execution order.

Here’s what a WordPress waterfall looks like using Fetch Injection, provided by the Fetch Inject library and now available as a WordPress plugin in Hyperdrive:

WordPress Twenty Seventeen theme with a Subsecond render using Fetch Inject. This performance can be reproduced on other systems using the functions.php file used during testing.

To achieve scale with Fetch Injection installed on WordPress, I added Redis Object Cache. Here’s a view of data (more data available below) as I slam the $5 Vultr box with 10,000 VU using Load Impact:

Ramping up traffic against a 1GB RAM CentOS 6.9 (Final) box running WordPress with Redis Object Cache and Fetch Injection. Image courtesy of Load Impact. Measurements taken on April 21, 2017. Raw data logged to New Relic available upon request. Raw WebPageTest metrics available below.

htop running on the Vultr box under test as it nears the 10,000 VU marker. Screen Shot 2017–04–21 at 11.55.53 PM.

Check out Load Impact’s Go + JavaScript tool called K6 for CI integration of load testing using Load Impact.

During testing I also took a number of WebPageTests being run externally to the system, and WPT reported page load never crept above 5 seconds.

Timed WebPageTests taken during various points of the VU load testing (click to view).

You can drill down to the actual WPT metrics by clicking the image above and choosing any points in the graph (if you see nothing, just change the date range). The tests dated April 21, 2017 correspond directly with the VU ramp-up.

Full talk including info on how to deck out a $5 VPS for scale up to thousands of users coming soon to WordPress.tv. Keep your eyes peeled.

Thanks to everyone at WordCamp Ubud 2017 for providing a platform with which to share this work. It wouldn’t have been possible without you.