Prepare Your WP Site for High Amounts of Traffic

Let’s imagine that your site will begin to get high amounts of traffic in the nearest future. Obviously, you will get high amounts of visitors if the content of your site becomes popular on Hacker News. Can you be sure that your online resource will be able to handle a lot of traffic? Don’t miss your chance to make your site popular and successful!

No matter, whether you are a website developer or the owner of an online resource. In one way or another, you will need to ensure that your site can handle any amount of traffic anytime.

Would you like to increase web page load speed of your site significantly? Do you want your site to work quickly and effectively? Here, you will find useful advices on how to prepare a WordPress site for high amounts of traffic!

How Traffic is Processed

You can decrease server load if you select a good theme for your WordPress blog and install some plugins on it. However, the problem will not be resolved completely. When your website starts getting high traffic it will begin to consume high amounts of server resources. As a result, its web page load speed will decrease significantly. Obviously, the server’s resources are limited. So, a server can handle only the certain amount of traffic. Your site will experience problems if a server is overloaded.

So, what to do if your site is getting more traffic and server load is increasing? Fortunately, an effective solution exists! All that you need to do is to scale your site for high traffic.

When your site starts getting more traffic server will receive more requests. So, you will need to make sure that a request doesn’t consume high amount of server resources. There are several ways to decrease server load:

  1. serve less requests;
  2. serve requests in a more effective way and
  3. serve less requests and server requests effectively.
Now, let’s analyze the back-end and front-end of a website to understand where we can minimize server load.

WordPress is the platform that uses MySQL database

Special attention should be drawn to the fact that WordPress site uses MySQL database. MySQL plays a key role in the server’s work. It should be noted that a WordPress site can’t exist and function properly without MySQL. MySQL server supports the work of a WordPress site.

MySQL server processes queries which are sent by PHP. The PHP needs to get a respond with data from the database before to start doing any work. Keep in mind that web page load speed of your site depends on how quickly a MySQL query is processed. So, you will need to minimize the load on your database in order to decrease web page load speed. If you manage to do this then your site will begin to work much faster.

The Best Ways of Resolving Problems in MySQL Performance and Increasing Page Load Speed

Define queries

The first step that you need to take in order to increase page load speed of a WordPress site is to define queries. This will help you realize where your slowest queries come from. In fact, there is an easy way to define queries in WordPress. All that you need to do is to open your wp-config.php file and insert the “Define” command into it.

define( ‘SAVEQUERIES’, true );

Debug Objects plugin

At the next step, you will need to analyze query data. The main objective of this work is to realize which queries take a lot of time. Obviously, these queries make a web page load longer. A plugin like Debug Objects can be perfectly used for this purpose. Of course, this work requires some time. However, your WordPress site will certainly work much faster if you do this and get rid of problematic queries.

In order to increase web page load speed you will need to take two important steps:

  1. you need to analyze your queries carefully and
  2. you need to get rid of long queries that increase page load speed.
What is a query?

There are different types of queries are sent to a database. So, a query can be “create”, “read”, “update” or “delete” data from a database.

Work with Options Table

The options table is used by MySQL for storing various important data (for example, it stores the data about plugins, themes and the WordPress core).

The Options Table Doesn't Have to be Overloaded!

A LONGTEXT column is used for storing the option_value in the Options table. However, this column is translated to special columns in MySQL. Such columns can store about 4 GB in a row. Obviously, you can store high volume of data in a column. However, it is recommended not to overload these columns.

Auto-loaded Queries Can Decrease Your Page Load Speed Significantly

Auto-loaded queries can cause huge server load and become a big problem for your site. They are known to be one of serious page load speed issues. So, in order to increase page load speed you need to detect auto-loaded queries and get rid of them.

By-default auto-loaded queries have the “wp_” table prefix. See the code below:

mysql> SELECT count(*) FROM wp_options WHERE

autoload=’yes’;

For good page load speed it is recommended to have no more than 200 auto-loaded queries on any page. However, the less auto-loaded queries a web page has — the better! Blogs that have a lot of auto-loaded queries often download slowly. However, you can resolve this problem successfully if you get rid of auto-loaded queries on your site.

Keep in mind that it is not easy to identify auto-loaded queries on a site. This work may take a lot of time. However, this work is definitely worth doing. It goes without saying that auto-loaded queries have a negative influence on site’s health and page load speed. However, it is not always enough to get rid of auto-loaded queries for increasing page load speed. It should be noted that auto-loaded queries are only one of wide spread page load speed problems. So, you should also check your site for other factors that affect page load speed.

Eliminating the Options

Options table contains the options, which use “sum” and “length” functions in MySQL. These options are loaded automatically. So, it is very important for WordPress site optimization to find these options and determine their size. You can use the following code to cope with this task:

mysql> SELECT SUM(LENGTH(option_value)) as autoload_size FROM wp_options

WHERE autoload=’yes’;

There is another good way of determining the options which have a negative influence on page load speed and cause a lot of damage. You can try this code to cope with this task:

mysql> SELECT option_name, length(option_value) AS option_value_length

FROM wp_options WHERE autoload=’yes’ ORDER BY option_value_length DESC

LIMIT 10;

Does your site have low web page load speed? Then it is definitely a good idea to search for an autoload_ size in the MBs. Also, it makes sense to get rid of some plugins and themes. Acting in such a way, you can resolve your page load speed issues effectively!

You should definitely try to disable any of the plugins or themes which have been mentioned in the larger options.

Search for options that have the “autoload” status in the options table. Such options may have a negative impact on site’s performance. Keep in mind that these options can continue to affect your site’s performance for a long time after the plugin or theme is removed.

You can easily realize whether options of a plugin or theme affect site’s performance or not. First of all, you need to make the theme or plugin. Then you should make options not auto-loaded (just change their autoload value from “Yes” to “No”). When this is done you should test site’s performance once and see if there are any improvements.

In order to scale your site for high traffic you should definitely ask your developer to disable its auto-loaded options. First of all, you should focus on options which are associated with plugins and themes that you don’t use anymore. Also, don’t forget to backup files before doing any operations with a site.

Number of Options

There is another reason for which your site may work slowly. Keep in mind what page load speed might also depend on the number of options in the table. This situation is not common, however it is possible. Nevertheless, if slow page load speed is caused by the number of options it is a very serious and difficult problem.

In fact, you can easily realize how much time it takes to process all auto-load options. You can use the following query for this purpose (it will work only if the “wp_” table prefix is used):

mysql> SELECT option_name, option_value FROM wp_options WHERE

autoload = ‘yes’;

Pay special attention to how long it takes to execute a query. The less time it takes to execute this query — the better! The point is that page load speed depends on query processing time. Obviously, the query will take more time if there are many options. If the query takes more than a second then special actions must be taken. However, the problem can be easily resolved. An index has to be added to the autoload column. Use the following query for this purpose.

mysql> CREATE INDEX autoload ON wp_options (autoload);

If this doesn't help then it makes sense to drop the index. Use the following query to do this.

mysql> DROP INDEX autoload ON wp_options;

You will see WordPress grind to a half if a master/slave database setup is completed. It is used for analyzing visitor statistics data. You can also use special services (such as Google Analytics) for tracking visitor data. Such services will allow you to load a special JavaScript library. So, visitor data tracking will be done automatically.

It is not easy to log visitor data if your site is built on the WordPress platform. The point is that it takes much more time for MySQL to lock its tables when it is necessary to perform INSERT. However, SELECT is performed much faster. After a table is locked MySQL will continue to receive some requests anyway. These requests are sent by website users, who are trying to read or make changes to the database. However, the table can’t be accessed quickly. It takes some time for the table to unlock after previous requests. As a result, page load speed may decrease.

Be Very Careful When Doing These Things:

1. If you add indexes to a production database then you should be ready that your database can be locked for some period of time. So, it is better to make such changes when website traffic is low.

2. It is not always a good idea to add an index. Sometimes this can even increase page load speed. That is why it makes sense for you to test page load speed of a site prior to making any changes. So, you will be able to make comparisons later.

Pay Special Attention to These Issues

1. The cron option can be activated when misbehaving plugins or themes are used on a site. If this happens you will see this option in the list of your top 10 largest auto-loaded options. The option_name of the option is equal to “cron”.

2. Analyze the behavior of plugins which are tracking data. Very often such plugins store their logs in the wp_options table. Moreover, these plugins also read or make changes to logs each time a page is loaded. It goes without saying that such plugins have a negative influence on site’s performance.

Like what you read? Give Dauren a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.