Top.Mail.Ru

WordPress Website Maximally Straining Server – Solutions and Optimization

Imagine this scenario: a WordPress website nearly grinds to a halt on its hosting server due to excessive CPU load. In this article, we’ll explore various solutions to address this issue and optimize your WordPress site’s performance.

  1. Disable wp-cron.php: WordPress relies on wp-cron.php to execute various tasks, including checking for updates, scheduling post publications, sending comment notifications, and running plugins like Akismet for spam filtering. If the execution of this file places an unhealthy load on your server, you can disable these tasks by adding the following line to your wp-config.php file:
php
define('DISABLE_WP_CRON', 'true');

You can place this line alongside other ‘define’ statements in the wp-config.php file. Additionally, you can comment out a line in the wp-cron.php file with the following code:

php
//ignore_user_abort(true);

To effectively disable wp-cron.php, it’s recommended to perform both of these actions.

  1. Utilize the Heartbeat Control Plugin: Download and install the “Heartbeat Control” plugin from WordPress. This plugin manages the WordPress Heartbeat API, which can increase CPU usage and slow down your website. Detailed information about the plugin and its features can be easily found online.
  2. Increase the Interval between Search Engine Bot Requests: To alleviate the server load caused by search engine bots, you can adjust the settings in Google Webmaster Tools or Google Search Console. In the “Crawl rate” section, select “Limit maximum Googlebot crawl rate” and set it to “Low.”

For Yandex, you can use the “Crawl-delay” directive in your robots.txt file to specify the minimum time in seconds between page requests. Here are some examples of how to use it:

plaintext
User-agent: Yandex
Disallow: /folder/
Crawl-delay: 2 # sets a 2-second delay
User-agent: Yandex
Disallow: /folder/
Crawl-delay: 4.5 # sets a 4.5-second delay

Adding the Crawl-delay directive right after the Allow and Disallow directives in your robots.txt file is essential. It’s advisable not to set an excessively long delay, as it may significantly slow down your site’s indexing.

  1. Enable Website Caching: Among the caching tools available, the WP Super Cache plugin is a noteworthy option. You can download it from the official WordPress plugin repository. This plugin significantly reduces page load times by creating cache copies of pages, thus minimizing repeated server requests. To enable caching, you can also use the following code in your .htaccess file:
apache
<FilesMatch ".(flv|gif|jpg|jpeg|png|ico|swf|js|css|pdf)$">
Header set Cache-Control "max-age=2592000"

Here, you specify the file types to be cached and set the maximum cache age in seconds.

  1. Block IP Addresses: To mitigate server strain caused by unwanted users, spammers, or disruptive individuals, consider using the “Best WP Security” plugin. Alternatively, you can manually block IP addresses in your .htaccess file with the following code:
apache
order allow,deny
allow from all
deny from 114.205.539
deny from 65.531.901
deny from 127.690.909
deny from 125.810.326

To block additional IP addresses, duplicate the “deny from” line with the new address.

  1. Manual Website Optimization: Optimize your site by disabling unnecessary plugins, verifying the proper functioning of active ones, and updating or replacing problematic plugins. Remove any extraneous or suspicious scripts and consider running antivirus utilities or performing online virus scans.

In conclusion, by implementing one or a combination of these strategies, you can significantly improve the performance of your WordPress website and reduce the server load. Keep in mind that each website may require a unique approach, so experimentation may be necessary. We wish you a stable website and a positive online experience!