Improving WordPress site performance and reliability

Improving WordPress site performance and reliability

When it comes to a money-producing website, speed and reliability do matter. The era of 33k dialup when visitors would patiently wait a minute for a site to load are LONG gone.

As we help clients to improve user experience on their WordPress websites and use WP ourselves, we wanted to share some of our experiences and strategies for WP server optimization. We have a lot of tricks in our bag!

Even if your website doesn’t have a lot of traffic, having an optimized WordPress server and website is critical to Google Adwords and Organic performance. The longer a site takes to load, the more likely a user is to click the BACK button and try a different site instead!

START WITH A BASELINE

Before changing anything, it’s critical to start with a baseline. We like using a free tool called GT Metrix. See a previous blog post where we discuss how to improve website page load times. This process will catch a lot of page errors, bad scripts, bloated images and other bloat issues. Make sure to record the results for both the home page and other key pages (such as shopping carts) so that you have something to compare too later!

PICK THE LOW HANGING FRUIT

Regardless of what’s happening on the server backend, there are a list of optimizations that can be done on the front-end to improve page load times. Typically this will require a website developer or somebody familiar with WP to dig into. As mentioned in the Improving Website Load Time for more Leads blog post, common techniques include combining and shrinking JavaScript and CSS files, reducing the size of large images, using speed-optimized themes, disabling plugins that aren’t strictly necessary, and minimize use of 3rd party plugins such as Google Analytics. The 3rd party plugins all have an overhead to locate and load, so use sparingly and wisely.

This process could take 10 hours to work through, but will never be wasted effort.

CONSIDER HOSTING OPTIONS

We see that a lot of businesses start out by parking their beautiful shiny new WordPress site on a budget or entry-level shared hosting environment with their ISP, mail provider, Managed Service Provider, or something like GoDaddy. Functionally this certainly works. The downsides are that there is limited ability to tune the server or even understand what the bottlenecks and utilization is. It is what it is. On top of that, these hosting environments are typically shared with many other websites, which means that if another website has a ton of traffic, your site will also be impacted. Keep in mind that these hosting providers are designing for having MANY websites hosted and not just you, so they configure for broad compatibility instead of specifically for your lonely website.

As your website becomes more valuable and critical, you will want to consider a hosting option that can scale and be custom tailored to YOUR needs and what YOU want to get out of the website.

USE A SERVER ARCHITECTURE THAT CAN SCALE

The challenge with the widely used CPanel and Plesk hosting options is that they are very vanilla, cookie-cutter, and proprietary. There isn’t much that can be done to improve server performance, other then to upgrade to a larger server with more expensive CPU processors and lots of RAM.

As Linux consulting experts, we recommend starting with a simple base Linux server (we prefer Debian and Ubuntu) that is bare-bones, lean and mean. We build a simple starting point that supports scalability. As required by your business and website requirements, we can utilize strategies such as:

  • Moving the MySQL database to its own dedicated server. That way, the Web and DB servers are not fighting for the same CPU, RAM and disk resources.
  • Set up multiple Web servers in a pool with load balancing.
  • Set up dedicated caching servers, to redirect resources away from the MySQL database and WordPress PHP server. 

DON’T ASSUME THE DEFAULT WEB SERVER IS OK

For many years, the Apache web server using mod_php reigned as king. Best practices have changed so much in this area, that Apache is actually more of a last resort option. NGinx is very popular, with different tools like FPM for running the PHP engine. SSL can be offloaded as well to separate processes. Different web servers are optimized for different purposes, such as authentication, dishing out static files, and heavier back-end language runtimes such as Java, PHP, Python, and Ruby.

Choosing the best web servers for the job will definitely allow more users to be served in the same amount of RAM and CPU resources.

CACHE ALL THE THINGS

As mentioned above, caching is crucial. Caching can happen at many levels:

  • Linux filesystems will cache files in memory, assuming there is sufficient memory available
  • MySQL will cache indexes, records, and queries in memory, assuming there is enough memory and the configuration permits it
  • WordPress can be configured to write static pages (pages that don’t change often) to disk as static HTML files, rather then rebuilding it from the MySQL database on each request
  • WordPress can also be configured to cache dynamic content to a memory store such as Memcache or Redis.
  • PHP opcode caching modules can be installed, to avoid PHP code from having to be parsed and compiled on every single request. This alone can provide a HUGE improvement!
  • Reverse HTTP web proxies can be situated in front of the your main web server, and optionally cache both static and dynamic content, reducing load on MySQL and PHP.
  • Content Distribution Networks (CDNs) can be used for a 3rd party content caching, further minimizing the load on your actual servers
  • Browser level caching can be used for content that rarely changes

Some of these are enabled by default, some just need minor configuration, and some require explicit installation and setup to be effective.

GOOGLE TOOLS

Google Webmaster Tools, Search Console, and Pagespeed tools can be used to quickly find crawling issues, slow pages, errors and more on your site. Do keep a periodic eye on these tools, and/or set them up to notify you proactively of issues.

DETAILED METRICS FOR DETAILED PERFORMANCE MONITORING.

We need data to help pinpoint and solve issues once and for all. Stabbing in the dark doesn’t make sense, so we collect as many data points as possible. This includes items like:

  • Ping time to the web server
  • How long it takes for a browser to START loading data from the server
  • How long it takes to COMPLETELY load your website, including all related images, Javascript and CSS files.
  • MySQL health, utilization and performance
  • Server metrics like disk space, CPU usage and memory usage
  • Network usage on the server – megabits per second, packets per second
  • Web server utilization – requests per second, number of threads
  • Backup system health
  • Business specific metrics, by running individual SQL queries or API calls

We use Grafana for creating highly customized dashboards for our clients.

OPTIMIZE THE SQL DATABASE

With a larger WordPress website that has custom modules, reports, integrations, and a ton of data, the database itself can start to be a bottleneck. This is easy to determine based on amount of CPU cycles being used by the MySQL system processes. Here are some of the things we evaluate:

  • Base MySQL configuration: sometimes it just needs more memory or an upgrade
  • Number of queries being run: is it reasonable for this application?
  • Slow or complex queries: sometimes developers have written SQL queries that run acceptably with a development database with limited data, but are brutally slow in the real world. First step is always to look at how well they are using indexes, and if any indexes should be added.
  • Hardware configuration: fast I/O performance is critical. Upgrading to an SSD drive can do wonders.
  • Architecture: as mentioned, sometimes MySQL just needs to run on a dedicated server so that it’s not fighting with the web servers for RAM and CPU resources.

TESTING WEBSITES

On any serious website, having a test version of the website is VERY highly recommended. Its a small cost and insurance policy to avoid embarrassing website outages and glitches. The test version of the website can be used for many situations:

  • WordPress upgrades
  • Module upgrades
  • PHP code changes
  • New theme installation and testing
  • Layout changes, such as redesigning your home page layout
  • Linux backend upgrades

A typical URL might be https://wwwtest.YOURDOMAIN.com instead of https://www.YOURDOMAIN.com. 

RATHER THEN RELY ON BUDGET HOSTING FOR YOUR REVENUE-GENERATING WEBSITE, USE AN EXPERT THAT CAN CONTINUALLY OPTIMIZE PERFORMANCE AS THE TRAFFIC TO YOUR SITE INCREASES

Use a website hosting expert to design a proper server configuration, monitor it, and make ongoing changes to improve performance as your business grows and traffic increases. If you rely heavily on your website for business purposes, Godaddy and such hosting providers are often not the best option. We would love to help you! Contact us using the form below for a budget estimate for WordPress optimization and Linux server management. We structure our agreement as follows:

  • Upfront project to handle migration and setup
  • Monthly Proactive Management for monitoring, patching, and routine maintenance. This is done flat-fee, no surprises
  • Support, changes, optimization and server migrations are done on an retainer basis

Categories: Databases, Development, Marketing

By Wim Kerkhoff

March 12, 2019

Wim Kerkhoff
Author: Wim Kerkhoff

CEO

PREVIOUS

Spotlight with BC Tech Association

NEXT

Journal notes from Open Source Summit 2018