Useful Snippets


This blog is used to collect useful snippets related to Linux, PHP, MySQL and more. Feel free to post comments with improvements or questions!

Are your smart devices spying on you? Make better purchasing choices and find products that respect your privacy at

RSS Latest posts from my personal blog

Most viewed posts

Subscribe to RSS feed

Mark Jaquith: Next Generation WordPress Hosting Stack – Summary and highlights

Stanislav KhromovStanislav Khromov

Mark Jaquith gave an interesting talk on the future of the WordPress hosting stack at WordCamp Europe 2014 last week. Let’s see what the future holds!

WordPress is dynamic, and that’s both a strength and a weakness

WordPress has little cache built-in by default. There is only a non-persistent, in-memory Object Cache. Most data is fetched from database and processed on every request.

“Old-style” hosts can’t deliver the performance modern sites need

Old “cPanel-style” hosting isn’t equipped to handle high-performance WordPress. Specialized stacks do a much better job.


People don’t like slow sites

Reducing your TTFB is crucial.

Guidelines for page generation speed:

WordPress Managed Hosting

Managed Hosting – a new breed of hosting providers tailored to WordPress.

In addition, you can purchase a VPS where you can customize the stack yourself. When choosing a VPS, use a reputable company, as many are fly-by-night and may disappear at any time.

Some reputable VPS providers:


Basics of a high performance WordPress stack


nginx is a fast web server that uses little resources. It support SPDY, which improves loading sites with many assets (css, js, images) through pipelining. nginx also supports load-balancing and caching.

php-fpm or HHVM

nginx does not have php baked into it. this is good, since it reduces memory usage for static requests as compared to Apache with mod_php. Always use the latest PHP version – newer PHP versions have increased performance and built-on opcache.

An alternative is HHVM – a PHP implementation created by Facebook, which aims to improve performance. (up to 5x faster than regular PHP!) It’s fully compatible with WordPress core, but may not support all third party plugins.

Caching fundamentals

Caching is about doing as little as possible for as many users as possible without visibly affecting how dynamic the site feels to users.

Full page caching

Most cache plugins use full page caching, showing a pre-saved version to anonymous visitors.

Full page caching may be utilized at different levels of the stack:

Marks own cache settings using Nginx and php-fpm:

Object Cache

Persistent caches include:

Object caching is used extensively in core and is also available to plugins.

MySQL performance

MySQL is usually not the bottleneck – PHP performance is. – Gives you tips on improving MySQL performance!

HyperDB – replaces the built-in WordPress database layer. Can talk to multiple MySQL servers, has failover, sharding and much more! uses this.

But make sure you enable the MySQL query cache.

There are drop-in alternatives to MySQL like Percona and MariaDB, which can improve performance for some sites.

Making a stack

Mark presented a few stacks that build on the basic stack.


Nginx + PHP

Static files are served by Nginx and PHP requests go through to php-fpm or hhvm. The easiest stack.


Nginx + Varnish + Nginx + PHP

Nicknamed the “nginx sandwich”. This variant uses Varnish for caching. nginx is used at the front because Varnish does not support SSL. It’s also possible to add HAProxy to the mix to load balance between multiple servers.

And finally, the big reveal:

The future hosting stack


The combo of choice is nginx + hhvm + mysql + redis.

This stack allows you to scale horizontally when required and has high performance.

Other useful stuff

Mark showed off a few useful functions that he had built.

Web Developer at Aftonbladet (Schibsted Media Group)
Any opinions on this blog are my own and do not reflect the views of my employer.
Twitter Profile
Visit my other blog

Comments 0
There are currently no comments.