Level Up: 5 Expert Tips for Optimizing WordPress Performance
For gamers, there’s nothing quite as satisfying as going up a
level. There’s a swirl of light, a fanfare plays, and suddenly
you’re doing everything a little bit better.
The enemies who looked unbeatable are nipping at your
Your WordPress site has the potential to level up. The
lag monsters and crash imps that seem invincible can
be cut down to size. As in video games—as in life—it
just takes the right combination of equipment,
knowhow, and effort.
Ready to take your WordPress performance to the next
level? Read on.
You can’t fix performance with a plugin. To optimize performance in a
game-changing way, it’s important to understand the “full stack” at work.
Here are a few things to know before you get in the game:
Cache optimization is key. Preventing unnecessary computation is the
single most important factor in performance. Caches exist at every layer
of the stack, sometimes several at once.
WordPress is the smartest (and slowest) thing in your stack. Just
because WordPress can do everything doesn’t mean it should. Simpler
subsystems can focus on doing one thing with far more efficiency.
The database is your ultimate bottleneck. Every time WordPress executes, it
queries the database. If your database isn’t responsive, every page load will
Throwing hardware at the problem is a temporary fix. New hardware can put
a band-aid on performance issues, but it can’t fix poor software design.
Great performance takes constant improvement. Commit to improving over
time and you’ll be amazed at the progress you can make.
Level 1: Modernize PHP
The most recent versions of PHP are between
20 and 100% faster than 5.2. Getting up-to-date
is one of the quickest wins available.
With your new, streamlined PHP, add an Opcode
Cache to dramatically reduce WordPress’ CPU
cycles. PHP 5.5 has an Opcache built in. With
earlier versions you can use the APC module.
Using an older version of PHP is like choosing to
stick with an original iPhone instead of the
latest 6S. Many PHP 7 benchmarks have shown
up to 2x performance improvements for
Opcode cache simply saves PHP from doing a lot
of work. Take WordPress for example: on a
single request PHP is loading, parsing, and
compiling thousands of scripts (files) into
Level 2: Reduce Load with a Persistent Object Cache
WordPress does a lot of computation creating data objects that are thrown away at the end of a
page load. These objects need to be recreated every time—hitting the database, compiling in
PHP—even if nothing has changed.
Use a persistent Object Cache like Redis (standard on Pantheon) or Memcached to keep the load
off the database, and reduce CPU overhead.
“Used appropriately, a persistent object cache like Redis or Memcached can be an incredibly
helpful tool for scaling your WordPress site.
Say, for instance, you have an unavoidable query which takes an entire second to run. Or, you need
to make an API request to a service that’s notoriously slow. You can mitigate the performance
impact in both cases by storing the result of the operation in the persistent object cache, and then
using the stored reference when render your response.
Like a fine wine with steak, persistent object caches like Redis or Memcached are best paired with
complex data generation. They provide a useful way to store computed data that was expensive to
create, and don’t make sense to waste on a cheap meal."
--Daniel Bachhuber, Principal, Hand Built
Level 3: Improve Speed and Volume with Reverse Proxy-Page Cache
Serving cached pages is a simple job, and other subsystems can do it better than WordPress. A reverse proxy can
deliver up to 200x improvement in speed and volume.
You can use an open source solution (like Varnish and Nginx), or a commercial CDN as your reverse proxy. Either way,
sites that don’t let WordPress handle this process perform better. And they tend to be more stable in a traffic spike.
“My preferred reverse proxy is Varnish. It is the most popular and well supported open source reverse-proxy cache
For me, the power and flexibility of Varnish's VCL configuration system, plus the fact that it's focused on reverse
proxy and web acceleration, make it a go-to.”
--Josh Koenig, Co-Founder & Head of Development Experience, Pantheon
Level 4: Tackle the ultimate bottleneck with SSD-backed Databases & InnoDB
Slow queries in MySQL are the most common cause for poor site performance. Moving to
solid-state drives (SSDs) means no more waiting for spinning metal disks to read your data.
Once you’re free of physical limitations, use the InnoDB Storage Engine to avoid costly table-
level locking. As a bonus, InnoDB also has the best chance at preserving your data in the event
of a crash.
Track your progress via the slow-query log and tools like Percona’s pt-query-digest.
"It's a no-brainer at this point to have your database running on SSDs. After running MySQL on
SSDs for the first time, we never used another spinning-disk server again. There's an order of
magnitude of difference in IOPS.
Likewise, the fact that InnoDB prevents table-level locking eliminates one pretty common
cause for site slowness or even downtime. It's a must-have if you have multiple content
editors working at the same time, or use any plugin that produces a lot of write operations.
Except on tables that are super read-intensive, InnoDB is the obvious choice."
--Daniel Dvorkin, Director of Development, Modern Tribe
Level 5: Streamline Search with a Dedicated Search Index
WordPress’s default search lacks the features and performance capacity of a dedicated index. If you
expect a lot of searching on your site, get it out of your database with a quickness.
ElasticSearch and Apache Solr—already bundled into the Pantheon platform—are both great open
source solutions. There are other paid services out there to solve the problem, too.
“MySQL is not a search optimized database and it's relational. As such it isn't performant for search
queries, especially ones involving filters.
ElasticSearch, as a standalone database for not only search but just complex queries in general, is an
easy and relatively inexpensive way to improve search and site speed.
We created ElasticPress to lower the barrier for entry in integrating WordPress with ElasticSearch.”
--Taylor Lovett, Director of Web Engineering, 10up
The Next Level and Beyond: Develop Expertise and Keep Learning
The more complex your site gets, the more challenging it is to optimize
performance. If you’re a site owner, you know how important web
performance is to your business, so consult a professional developer to get
the most out of your WordPress implementation.
If you are a developer, dive in. There’s no better way to level up your
expertise than to start gaining experience.
Conclusion: Get in the Game
WordPress has a well-deserved reputation for usability and flexibility. But the
basic vanilla build presents plenty of opportunities for optimization. Improving
the layers of the stack that support WordPress can give you exponential
improvements in performance.
At Pantheon, we are dedicated to being a world-class platform for WordPress
sites. That means the resources you need for next-level performance are built
Ready to level up? Try Pantheon for free today.