📜 ⬆️ ⬇️

Accelerate Wordpress

SEO Digest #5 This review is written specifically for SEO Digest - a popular online magazine among webmasters and search engine optimizers. The materials published in it are designed for a wide audience of users: from Runet professionals to amateurs and beginners. The magazine is available in PDF and online versions.

Wordpress is now the most popular platform for a single blog hosting. A number of hosting providers even offer sites with pre-installed Wordpress, and in a large number of publications they argue about how best to make money on a new blog or how to use it correctly. I'm going to highlight one of the main questions that blog administrators face: how to make a website work quickly. The following material is intended for the widest possible audience of users.

Main provisions


Acceleration of any system is possible mainly due to caching some (it’s worth emphasizing that it is some, but not all in a row) frequently used operations. All caching events, including those for Wordpress, can be divided into several main parts:

This problem can be illustrated using the following figure.
Wordpress
Caching links for Wordpress, source www.arnebrachhold.de
')

Database


It has already happened that the main bottleneck of almost any system is in the database, so they are trying to speed it up in all possible ways. It is worth noting that the problem of numerous calls to the database is not solved simply by reducing their number (to provide the same information), here we need to approach more comprehensively and set up a multi-level cache for queries.

Regarding MySQL, this is quite simple: just write the following parameters in the my.cnf (or my.ini ) configuration file (in case of a large amount of RAM, 20M can be increased to any acceptable amount):

  query-cache-type = 1
 query-cache-size = 20M 


To optimize tables (which will reduce query time by 20–50%), you can use the Optimize DB add-on, which will significantly reduce the size of MySQL tables and improve their structure.

Compiling Server Scripts


Each time a PHP script is executed, it is recompiled in memory into executable code, which takes considerable time. To avoid recompilation of the same scripts, applications such as APC or eAccelerator are used , which store the already compiled code in memory and allow you to run significantly (up to several dozen times) faster.

Also, these solutions work well with a large number of small files that are connected when processing a request to a page, reducing the costs of accessing the file system. The PHP engine does not load files from disk (or from disk cache) every time - it gets the executable code immediately, which is much faster. After database optimization (caching settings), this is one of the most bottlenecks (except for creating statically pages instead of dynamically generating them).

Static pages


The next step to deal with the long preparation time of the page on the server will be full caching of the page being created into one file or one in the memory. To enable internal caching at the level of Wordpress itself, it is enough to uncomment (or add) the following lines to the wp-config.php (after checking that wp-content/cache is writable, otherwise it will not work):
  define ('ENABLE_CACHE', true);
 define ('CACHE_EXPIRATION_TIME', 900); 


More serious caching results can be achieved using the WP-Super-Cache add - on (based on WP-Cache ) or Hyper Cache , which will not make any database queries to display external web pages at all. However, it will be impossible to take into account the statistics of visits through the built-in Wordpress methods (only through external counters or server logs).

For Wordpress installed on IIS, it would also be best to use WP-Super-Cache instead of IIS Output Caching. This is discussed in detail in the corresponding English-language note , below is the number of requests per second with a particular server caching method.

Wordpress  IIS
Wordpress caching performance for IIS, source blogs.iis.net

But let's see what can be done with the client component (design and scripts) of a regular blog.

Client part



The main disadvantage of wealth for Wordpress themes is that they are mainly developed by amateurs. As a result, such topics may consist of a large number of images and style files, which together load very slowly. However, the situation is reparable.

To speed up site loading in the browser itself (and this, according to Yahoo experts , takes 95% of the total page load time), you can use several solutions:


In general, even the most ordinary blog can be accelerated several (tens) times in a matter of minutes. Most likely, separate Wordpress assemblies will appear in the near future, tuned for maximum performance when using any topic and random blog traffic. Now you can simply use the above tips and be glad for a significant increase in the number of visits and regular readers.

Source: https://habr.com/ru/post/57346/


All Articles