16.03.2024 12:00

How to Discover WordPress Plugin an Overly Demand?

News image

Hello!

Have you ever wondered how the WordPress plugin can overload the CPU and how could you find it and then solve the problem?

First of all, we should mention PHP competitiveness, as well as CPU – a resource that isn’t unlimited. Then we’ll give actual examples of bad plugins that are due to being too demanding on server resources.

What’s PHP Competitiveness?

PHP competitiveness refers to the maximum number of parallel PHP workers that can be executed in a given time interval. When it comes to WordPress scalability, it’s one of the most important factors that are closely related to the power of the CPU, a topic that’s often not given enough attention. This is actually one of the reasons why we don’t have much confidence in WordPress benchmark tests, which are very widespread.

Shared hosting providers usually limit PHP competitiveness because they want the hosting to be stable and that information isn’t always available to users. When you have a VPS/Cloud server, there’s no such restriction, except in the resources you have leased.

How Does PHP Competitiveness Work ‘Under the Hood’?

PHP workers execute one request at a time. When there’s no PHP worker for a request, it won’t be executed (error 503) or will be delayed. Many shared hosting providers have plans in their offer with PHP competitiveness, which means processing 2 simultaneous dynamic requests, and at least 4 are necessary. Here’s why.

For example, when you run a backup, that request will take time. Imagine running WordPress cron in parallel, which also takes a lot of time. At that point, backup and cron will be executed at the same time using the maximum capacity of your PHP competitiveness. Each subsequent PHP request will either be delayed or canceled with an error 503. 

Imagine expecting information about the status of your backup, and there’s no such information. Your impression could be that the backup WordPress plugin doesn’t work. And the real reason is that the PHP request to check the backup status can’t be executed because PHP competitiveness allows only 2 simultaneous requests.

The higher the CPU power, the less time it takes to execute PHP requests. When the processor isn’t strong enough, caching comes into play. Caching can help save the server from unnecessary code execution or more frequent savings over database queries.

How Do You Find Out Which WordPress Plugin ‘Kills’ Your CPU?

There are 2 types of plugins that overload the CPU. The first ones send too many requests that can’t be cached, and the other ones run PHP processes that take too long consuming a lot of CPU power. In any case, you should make sure you use such plugins and consider alternatives.

Here’s what you can do.

Analyze All HTTP Requests From the Browser

To analyze all HTTP requests, open Chrome Developer Tools (CTRL+SHIFT+I), then the Network tab, and review any requests not sent to static files.

Here is an example of a log file: v1.2 ‘127.0.0.1’ ‘443’ ‘[12/Jul/2018:09:40:13 +0000]’ ‘/home/5b2d0fe3f911c8149cd0e889/public_html/wp-cron.php’ ‘POST/wp-admin/admin-ajax.php HTTP/1.1’ ‘200’ ‘278’ ‘-‘ ‘Clostebot/1.0’ ‘no-cache’ ‘-‘ ‘US’

Pay attention to 4 parameters: IP address (127.0.0.1), Date/Time (12/July/ 2018:09:40:13+0000), request method & URL (POST/wp-admin/admin-ajax.php), as well as cache status (no-cache) to find potential problems:

  1.       Are most requests that can’t be cached related to the same or similar URLs and different query strings?
  2.       Did these requests come from one or more IP addresses?
  3.       What’s the purpose of such a request?
  4.       Can I use another method and what will happen if I turn off the plugin?

What’s the Biggest Mistake That Affects the Performance of WordPress

When you have one PHP request on each page that can’t be cached, that’s a big enough problem, and when you have 4 such requests on each page, it’s a really big mistake that can seriously compromise WordPress performance.

For example, the WordPress theme SornaCommerce Pro makes dynamic PHP requests even for loading CSS, Javascript, as well as to check if the cart is empty.

Here are some more examples of plugins that send more requests and don’t cache.

  1.  WordPress GDPR. WordPress GDRP plugin, version 1.6.4 is one of the plugins that have 2 requests that aren’t cached on each page.
  2. Kingdom – WooCommerce Amazon Affiliates Theme. Another commercial theme for WordPress, which sends 3 requests per page.
  3. WP GDPR. WP GDPR is a plugin that helps with GDPR cookie management. It checks if a GDPR cookie notification should be displayed and ensures compliance. With WP GDPR, website owners can provide users control over their cookie settings in line with GDPR. Cookie management refers to the practices and processes of handling cookies on websites. By effectively managing cookies in compliance with GDPR requirements, organizations demonstrate their commitment to protecting user privacy and personal data. It fosters trust, transparency, and respect for user rights, which are central principles of the GDPR.
  4. WooBought. This WordPress plugin sends a request that isn’t cached every 5 seconds. If 10 visitors don’t close your site, you’ll have 7,200 uncached requests in one hour: 3,600 / 5 * 10 = 7,200.

Let’s Sum Up

A well-optimized WordPress site with a million visitors may be less demanding than, for example, a poorly optimized WooCommerce site that has literally no visitors.

Yes, it’s really possible. A site with a million visitors can have a cached page that Facebook or newsletter formed by VerticalResponse, that has hundreds of templates and various customization options at a low price, directs them to, while on a site without visitors, crawlers visit pages to add products that can’t be cached and thus significantly burden the CPU.

What Have We Learned?

  1. Even though you’ve bought a large enough shared hosting plan, it’s very possible that your site fails to serve all visitors.
  2. The fact that you have to pay for a WordPress plugin doesn’t mean that the plugin is better in terms of complexity than a similar free one.
  3. You should never completely clear the cache or leave Development Mode enabled on a site that has a large number of visits. Imagine what would happen if Google cleared its search cache. It would be offline for days or weeks.
  4. Scaling a site with non-cached requests is complex and usually requires new and different solutions.
  5. In most cases, optimized caching is required and the number of visitors is only relative.
  6. The WooCommerce site needs more resources at the start, compared to some heavily visited news portals because many pages can’t be cached such as shopping carts and payment pages, user profiles, etc.

There are many other examples of WordPress plugins that overload the CPU, as well as methods for finding them. However, the examples we mentioned are the most common.

Thank you!
Join us on social media!
See you!


0 comments
Read more