WordPress High Load

13 Necessary Measures for Your WordPress to Manage High Load

If your product or concept suddenly gets a lot of attention, for example through a TV appearance on "Dragon's Den", the recommendation of an influencer or a large-scale marketing campaign, this means one thing - a lot of traffic on the server! For some websites and servers, unfortunately, a little too much. Today, I will present this topic to you in more detail.

What happens when one team member of a rowing team weakens? The entire team loses power and has to compensate for the lack of strength. If this happens during a tournament, it is fatal and will most certainly lead to defeat. The same is true for your WordPress website during high load. If your server, your theme, your plugins, your database, etc. are not a well-rehearsed team, your website will collapse under load peaks - of course potential will be wasted.

If your WordPress website can't withstand a sudden rush, the result is always the same: your website is down, and you lose money indirectly. So what do you need to do to prevent this from happening?

We have thought about what measures you should take, for example, before a broadcast of "Dragon's Den" to prepare your WordPress website for high load. The basis for the best practice optimization process are the following steps:

  1. Planning
  2. Optimize infrastructure
  3. Backend
  4. Frontend
  5. Offsite
  6. Tests & Reporting
  7. Live stream

Based on this process and our years of experience, we've created a concrete 13 point plan to help you get your WordPress website ready for high load.

Note

The 13 measures are sorted according to planning and execution and not according to their importance. We recommend completing all the points in the order we've given.
WordPress  high load - planning

#1 Planning

1.1 Time

The time you have for implementation is unfortunately often an underestimated factor in planning, but sometimes the most important.

You need time for you and your team to optimize and test your WordPress website and store. If necessary, you (or your web host) also need time to move your website or domain or to scale the server.

You also need time to rethink concepts and possibly change third-party providers or plugins.

"*" indicates required fields

I would like to subscribe to the newsletter to be informed about new blog articles, ebooks, features and news about WordPress. I can withdraw my consent at any time. Please note our Privacy Policy.
This field is for validation and should not be changed.

1.2 Rethinking concepts

Plugins, widgets and resources

You should remove all resource consuming plugins, widgets and features that you don't absolutely need in your Dashboard or on your website. Do you really need your monitoring tools like Matomo or Google Analytics in your WordPress Dashboard?

Try to keep it to the absolute minimum when it comes to keeping your website online even under the heaviest load. Even the smallest things like a social media button can double the loading time. In the following example even 12 scripts with a total of 462.7 kB - just to display a social media button.

Loading scripts from Social Media Button
To enlarge the image, click here or on the graphic.

Advertisements

Too many ads on your website not only slow down your server, but also makes people leave your website sooner. As a result, you lose advertising revenue. Limit yourself to a few, high-quality ads to increase your return on investment (ROI) as quickly and efficiently as possible.

Email

Your website is your online presence - your email should not be controlled from it. The server uses a lot of load and this is quite costly for you, especially at high load peaks.

We distinguish here between two types of email:

  • Marketing (newsletter)
  • Management

Marketing mail, such as your newsletter, should always be outsourced. GDPR compliant German providers are, for example, Cleverreach or Newsletter2Go. Of course, there are also international providers such as Mailchimp or ActiveCampaign, which also do a great job.

Note: You should not send marketing mail via your website.

Administrative email, such as invoices, password resets, account creation emails, etc. can also be outsourced. Especially if there are a lot of orders when you have a high number of visitors, you should consider this.

There are also several providers here that you can simply use as a third party SMTP server: Mailgun is my favorite here. There is also an easy to set up WordPress plugin.

13 Necessary Measures for Your WordPress to Manage High Load

#2 Hosting

The most important point that you should pay attention to is hosting. First and foremost, it is important to choose a host that does not have a traffic limit. Because if your traffic exceeds this limit, your host can block your website and all the effort would be gone.

Hosting plans based on shared hosting are also completely unsuitable for high load growth, since you share the CPU time with other users (websites). In most cases, these are also not powerful enough to withstand such traffic onslaughts as on "Dragon's Den", for example.

A WordPress and WooCommerce host is in most cases the best choice, if you don't want to take care of the setup, maintenance, performance optimization and security of your website yourself. Which four factors you have to pay special attention to at WooCommerce web hosting, you can read in our article.

It might also make sense to scale your server for a short period of time. This means that you scale up your server for a period of time (more CPU/RAM etc) and then return to the regular plan after the traffic peak to save costs.

Ideally, you should talk to your web host at the beginning of the planning process. They can give you the best advice and recommendations.

WordPress  high load - backups

#3 Backups

Backups are an absolute must, not only for peak loads, but in general. Your website should be backed up automatically every night and you should also have the option to create manual backups. This gives you an additional safety net, especially in phases such as restructuring your website.

This way you can secure large milestones by saving different versions along the way.

For example:

  • Backup 1: Initial site version
  • Backup 2: Caching plugin installed and configured
  • Backup 3: Database cleaned up
  • … and so on

This way you can always jump back to specific points in your adjustments if something goes wrong.

I recommend that you actually use this as you work your way through this document.

3.1 Backup systems

Backup with Managed WordPress Web Hosts (recommended):
With most specialized hosters you can rely on a nightly automatic backup of your website. In addition, there is usually the option to create and restore manual backups with one click. Since these backups don't mean any inconvenience for you and don't take away any storage space from you, the recommendation clearly goes in this direction.

Backup via WordPress plugin:
Plugins like BackWPup, Updraft, BackUpWordPress and similar can backup your entire WordPress website, including media and database, to your server.

Depending on the plugin and the version you're using (free or paid), you can also save or download your backup in the cloud*.

BackWPup is written by Inpsyde and is well supported. Therefore, this is our recommendation for you if you don't have a backup solution in your hosting package. BackWPup offers scheduled backups, storage on cloud services* like Dropbox or Microsoft Azure or another FTP server.

In the purchase version, you can specify additional cloud services as storage space and encrypt your backups.

*When storing backups in the cloud, you should think carefully about which provider you use in times of GDPR, since your backups also contain customer data such as names, addresses and e-mails.

WordPress  high load - caching

#4 Caching & Minifying

The number one factor when it comes to delivering websites quickly and with as little server load as possible is clearly caching.

With caching, you minimize the requests to your server, which then delivers static files instead of dynamic content, such as your images or the HTML of your websites. This gives you an enormous speed improvement as well as a much lower load, since the server doesn't have to load the same content over and over again. Think of it like your mother sending you out for milk over and over again. Instead of running again and again, you just fill the fridge with several bottles. This reduces the load on your legs and the stress with your mom because you weren't fast enough.

Here we distinguish between the server-side cache and the caching by plugins. We have compiled a detailed overview of the cache and the differences between these cache options for you in our Caching Basics article.

Minifying CSS and JS can also give you a performance advantage. Here, the contents of the respective stylesheets and JavaScript files are relieved of comments and spaces and merged into one long string. We recommend for example the plugin "Merge + Minify + Refresh".

WordPress  high load - optimize images

#5 Media optimization (scaling images, outsourcing videos)

5.1 Images

Large media are, of course, killers in terms of load and performance. If your store subpage contains 25 product images in full resolution, although they are only displayed in 200px x 250px, then the website quickly goes to its knees.

You should be especially careful with images in the shopping cart or checkout area, because these areas are uncached. If you load 300dpi images on 2000px there, although only a pictogram is needed, you can be sure that at full load no one can buy anything.

With which WordPress plugins you can automatically prepare your images, we explain in our image optimization plugin comparison.

5.2 Videos

Videos belong on video portals and are then embedded on your website! At least, if you are purely concerned about performance. There is hardly any reason to host videos yourself (in some cases maybe the GDPR, but let's leave that aside here).

If you really want to host videos yourself, do it on a dedicated server and then host them on your site. Otherwise, just upload them to YouTube, Vimeo, 3q, or Brightcove.

WordPress  high load - clean up database

#6 Clean up your database

Now let's go into the depth of WordPress IT: the database.

Highly important: Make a backup first!

WordPress stores posts, comments, pages and other types of textual data in a single database (images and videos excluded, because they are located in the "wp-content/**" folder). After a while, of course, this database becomes a bit full and "cluttered".

When we say "clutter", we're talking about:

  • Spam comments
  • Blog and page edits
  • Items in the trash
  • Post and comment metadata such as validations that have long expired

This is all legacy stuff that you usually don't need anymore and which will drag your server down.

How do you get rid of this stuff?

TL;DR & for those who want it a little easier: Install WP-Optimize and let it run!

6.1 Revisions

Revisions are the interim stages of your posts, pages and projects.

In most cases, you can reduce them enormously, for example to a maximum of 8 to 10 revisions. In some cases, it even makes sense to switch them off completely.

Add the following to your wp-config.php file:

Switch off revisions entirely:

define( 'WP_POST_REVISIONS', false );

Limit revisions:

define( 'WP_POST_REVISIONS', 10 ); // Max 10 revisions

6.2 Optimizing the wp_options

The wp_options table is one of the most important and at the same time often overlooked tables in WordPress when it comes to load optimization. The wp_options contains things like the site URL, home URL, time formats and admin data as well as settings for plugins, themes, WP cronjobs and cache data.

To optimize this, we first need to understand what each table column means. The wp_options has the following columns:

  • option_id
  • option_name
  • option_value
  • autoload

Let's take a look at the autoload column. This column controls which options and settings are loaded by the wp_load_alloptions() function. This means: If the entry in a row is set to 'yes', this function will be loaded on every site of your website.
With many plugins the setting is behind it that this is so damn important that it has to load on every site - Although the plugin is actually only used on a site (for example a calculator or contact form).

Of course, this clutters up your website and causes enormous extra load. How to fix this?

Ultimately, this is a planning question. As noted in point 1.2 "Rethinking concepts", you should ask yourself the question, "Do I need this plugin?". If you can replace it, do it.

For example, you can not load Google Analytics in the WordPress Dashboard, but externally. Or instead of using a redirect plugin, you could check with your web host if they already have such things integrated.

To find out which plugins cause long loading times, I have written a SQL query for you:

SELECT option_name, length(option_value) AS option_value_length FROM wp_options WHERE autoload = 'yes' ORDER BY option_value_length DESC

After executing this query, you'll receive a list showing which functions are causing the most load.

WordPress high load: wp_options autoload query

In this case it comes from the plugin "Rewrite Rules". If you host at Raidboxes, you can use the rewrite rules in the Raidboxes Dashboard , for this Box simply take the rewrite rules and delete the plugin.

WordPress high load: URL Rewrites Raidboxes

Remove old "plugin garbage" from wp_options

Deleted plugins have a nasty habit of leaving remnants in the wp_options and also on autoload = yes. This is, of course, absolutely useless. The functionality the code once enabled doesn't even exist anymore and it just means your server's computing time is being wasted for nothing.

What I like to do is always look up and remove the names of deleted plugins in the wp_options.

Assuming we no longer need the "Rewrite Rules" plugin from above, I run this SQL query:

SELECT * FROM `wp_options` WHERE `autoload` = 'yes'AND `option_name` LIKE %rewrite_rules%'

Important

It may be that your database prefix is different, so you may need to adjust this query at the "wp_options" location to "yourprefix_options".

I then get back a whole bunch of functions that are no longer needed, all of which are still set to autoload = yes, but are completely useless. I simply delete these. I already mentioned backups. 😉 

I repeat this procedure for every deleted plugin. The wp_options is now a lot less cluttered than before.

6.3 Deleting old transients

Update

Since WordPress Ver. 4.9.9 this is no longer necessary, because WordPress takes care of this task itself.

For WordPress versions prior to 4.9.9:
Transients are nothing more than temporary options that are stored in the database for a short time. Once they expire and are no longer needed, they are deleted. As an example: "site_transient_update_plugins" simply contains the info which plugins have an update and which do not. As soon as you update these plugins or run a new update check, this transient will be deleted.

Unfortunately, this doesn't always go as planned. Some transients stay in the database forever and make queries difficult so we need to remove them.

It is best to use the Transient Cleaner for this, because doing this manually is a huge effort. After you have successfully used this plugin, you can safely remove it afterwards. The Transient Cleaner only removes the expired transients and nothing else - a great tool!

Performance Measurement e-Book

6.4 WordPress Sessions

Sessions are there to control, log, check and expire user login sessions. After a while a WP cronjob deletes these sessions from the database. At least that's how it should be.

Unfortunately, cronjobs hang or they are disabled by plugins - Then you have a lot of sessions in the database in no time.

To see if you are affected by this, I have another SQL query for you:

SELECT * FROM `wp_options` WHERE `option_name` LIKE '_wp_session_%'

Important

It may be that your database prefix is different, so you may need to adjust this query at the "wp_options" location to "yourprefix_options".

If you find that there are thousands and thousands of entries, use the following SQL query to delete them:

DELETE FROM `wp_options` WHERE `option_name` LIKE '_wp_session_%'

At Raidboxes we have our own server-side cronjob for this purpose, which you can control according to intervals. You can find it in your Box settings under WP Session Eraser.

WordPress high load: WP Session Eraser

6.5 Adding an Index to the Autoload

Ok, now it's getting tricky! But if you manage to apply this trick from 10up to your WordPress website, you will have gained a lot.

What he does in principle:

An index is added to the autoload field in the wp_options. This significantly reduces the query time and even brings it to a constant, very low, "maximum".

The result is obvious:

WordPress high load: wp_options Query Time Index
Source: 10up

The nice thing is: For most websites, our plugin Add Index To Autoload works wonderfully. As always, remember to backup beforehand!

Manually it would go with this SQL query here:

ALTER TABLE `wp_options` ADD INDEX (`autoload`);

Important

It may be that your database prefix is different, so you may need to adjust this query at the "wp_options" location to "yourprefix_options".

WordPress  high load - updates

#7 Keep everything up to date!

A very effective way to withstand high traffic is to keep your software up to date. Not only your WordPress itself, but also your active theme, your plugins and most importantly: your PHP version.

7.1 PHP

PHP is the "software engine" of WordPress. This also means that the better the performance of the engine, the faster your website will be. PHP 7.0 can already execute more than twice as many requests per second as PHP 5.6 - and that in half the latency. With PHP 7.1 and 7.2, the whole thing got a bit faster again.

Note

The official support for PHP versions before PHP 8.0 has already expired. So it's best to at least update to PHP 8 now to avoid compromising the security of your WordPress website.

Overall, it makes more than sense to use the PHP version that gives you the best performance. But beware: not all plugins and themes are compatible with the latest versions! Here either the documentation of the plugins and themes or simple trial and error will help.

PHP versions Raidboxes

7.2 WordPress version

To get the maximum performance, your WordPress version should also be up to date. If you haven't updated your WordPress for a while, you should not jump directly from one major version to the next (e.g. 4.3 to 4.4) but move forward in minor versions (e.g. from version 4.3.3 to 4.3.4).

Always check the overall functionality of your website between updates. In principle, it is recommended to always create individual backups of your website. This is especially true before major version jumps!

Basically, a managed WordPress web host is recommended here as well, which will take care of the WordPress updates for you.

7.3 Plugins and Themes

Just like your WordPress version, you should also update your plugins and themes. Security and performance are the main reasons. Insecure plugins and themes can ruin all your work. An overview of currently known vulnerabilities for WordPress, themes and plugins can be found in the "WPScan Vulnerability Database" from the security provider Sucuri.

Plugin- and theme updates also bring the possibility to upgrade to a higher PHP version and thus achieve a significant performance boost. Besides, bugs are eliminated and you have more features available.

Again, for major updates, backup your site beforehand or test the new version in a staging environment. Check the functionality of your website before you go live with the changes.

The consequences of lagging behind with your plugin updates have been shown, for example, with the security vulnerability of a GDPR plugin.

WordPress  high load - Broken LInks

A very simple issue that doesn't necessarily drag down your website performance, but can cost you page views, is broken links. You can easily check your website using the online Broken Link Checker.

I recommend you to use this website instead of a WordPress plugin for the check, because plugins drag down the performance of your website - even if you don't use them at the moment. But there are many more tools and methods to find broken links. You can find out what they are in this post.

WordPress  high load - Lazy Loading

#9 Lazy loading

Update

Since WordPress version 5.5 you don't need a lazy loading plugin anymore, because WordPress takes care of this task itself.

With lazy loading, only the contents that the user has in their visible browser area are displayed. The rest is loaded dynamically as the user continues to scroll down.

To reduce the load of your website, only those requests are fulfilled that actually have to be fulfilled immediately. This includes, for example, images, videos and texts as well as scripts and other things. A real power tool - Thor's hammer, so to speak, to save resources.

Here's how it works:

The browser already loads all the textual content (the DOM), but uses Javascript to load only the images/video/script resources that the user needs. If the user scrolls deeper, the things that come into his field of view are reloaded.

A lot of modern themes, especially for shops, have lazy loading already implemented. Unfortunately, it's not always easy to add lazy loading at a later point.

But there is a plugin for that! There are many lazy loading plugins on the market. But there is one I like very much: a3 Lazy Load. A3 Lazy Load works in very many cases and can lazy load videos and iFrames in addition to images. Furthermore, it supports WordPress AMP, WooCommerce and Advanced Custom Fields.

WordPress  high load - payment process

#10 Optimize payment process

Especially if you want to sell one or more products, it is essential to optimize the payment process exactly. As mentioned above, things like the shopping cart or the checkout are not cacheable. Therefore you should reduce the server load enormously exactly here, because every request means a completely new and resource-intensive request to the server.

Take a look at your browser tools (in Chrome, for example, via the "Network" tab) to see how many requests are generated during a checkout and which ones. If you see that you generate 400 requests just by calling up the shopping cart, something is going wrong.

Investigate which plugin or resource generates many of these requests and try to reduce them. This means that you may have to get rid of plugins that you don't absolutely need.

What we often see here are fonts that are loaded and rendered from external sources, but not even used on the shopping cart or checkout page.

Also ask yourself whether you really need to list all products with full-resolution images in the checkout display, or whether a textual display is sufficient here.

Payment options via gateways

It may also be necessary to change your payment gateway. For example, if your PayPal plugin takes a long time to process requests, you may lose deals here.

If you want to offer as many payment options as possible and a secure experience for you, check out Stripe. Stripe offers easy WordPress integration and fast payment transactions with a high number of payment options.

WordPress  high load - CDN

#11 CDN

On page everything is now optimized? Servers are fast? Great! Then comes the next step to keep the load as low as possible: A Content Delivery Network (CDN).

A CDN is effectively a copy of your cached website distributed on different servers in different locations around the world. In this way, the end devices that are in one of these locations can access the data more quickly. Quasi - to take up the milk example from above again - a fridge full of milk in each room. In addition, the CDN will also free your server from load, since it delivers parts of your website cached from its server.

We recommend Cloudflare as a CDN partner. Some CDN plans even include a firewall and an image optimizer. How to connect Cloudflare at Raidboxes with your Box, we explain here:

In Cloudflare:

  1. You enter your domain via "Add Website" and click on "Scan DNS Records".
  2. Now CF automatically scans for your records - you just need to wait until it's complete.
  3. Afterwards, CF will give you suggestions (usually two for A Records). And this is fine. Click on "Continue".
  4. In the next step, select your plan and click "Continue" again.
  5. Now you'll see the name servers you have to update.
  6. Cloudflare shows you ours and which ones you can change it to. (Of course, this only applies to domains you have with us. If you have the domains somewhere else, you have to make the changes with that domain host).
  7. You have to enter these nameservers (5) as nameservers in the domain administration. If you manage your domains with us, you can adjust them here. There you click on "DNS" for the respective domain and change the name servers to those of Cloudflare. If you have your domains with another provider, you have to check there.

Done!

Important: If you get the error message: "Too many redirects", you have to activate "Full Strict" in the SSL settings of Cloudflare.

WordPress  high load - reporting

#12 Reporting

You can't always watch your website everywhere, so a monitoring and uptime reporting tool is very important. These mostly free tools monitor the status of your website. They check in short intervals if your website is reachable. We recommend the free plans from Pingdom or UptimeRobot.

Beware the check intervals!

Do not set this check too short, because this also means a load on your web server. Therefore the check intervals should not be shorter than 5 minutes.

#13 Final backup

Everything running? Satisfied? Great! Now you just need to make a final backup. Now your website shouldn't go down during the next load peak caused by "Dragon's Den" and the like.

Conclusion

I hope my step by step guide will help you get your WordPress website ready for high load. If you're still stuck on the more technically challenging parts, we recommend you to call in a WordPress professional. Do you have any other questions or comments about preparing for high load? Feel free to leave me a comment!

Did you like the article?

Your rating helps us improve our future content.

Post a comment

Your email address will not be published. Required fields are marked with *.