Slow background loading in WordPress caused by multiple plugin loads

Original link: https://www.ixiqin.com/2023/08/28/cjdcjzdzdwhtjzhm/

In WordPress Jetpack’s Old Bug – Generate a lot of data in wp-Options , I mentioned that the root of the problem is not the database, although a lot of data is generated in the database, it does not really slow down the system What is slowing down the process?

With the in-depth investigation of the system, I found an abnormal thing. When entering the management background, there was a situation where the plug-in updated the plug-in list. This is rare. Because the entry of the management background should not involve the update of the plug-in list. Also, I found that the SQL for this query is huge and contains a lot of queries.

So it is estimated that this may be the real cause of the slow system. Readers who are familiar with WordPress must know that WordPress loads plugins by storing a set of plugin paths in the database, and loads plugins through this set of plugin paths each time it starts. This allows for fast loading of plugins for WordPress.

However, in this abnormal scenario, the same content plug-in is loaded multiple times, even if the plug-in is relatively small, it may still cause calculation time. In addition, after WordPress introduces a plug-in, it will load the corresponding Hook, Filter, and Action, which may cause the same Action to be triggered frequently, resulting in additional calculations. As a result, although the database query time is not long, the overall time-consuming is extremely long.

The solution to this problem is relatively simple:

  1. Back up active_plugins to avoid modification.
  2. Clear active_plugins, and WordPress will not load any plugins at all.
  3. Follow the previous list and enable all plugins.

Through the cleaning of active_plugins, the startup speed was successfully reduced to about 2 seconds, and the system performance was improved by 80%.

This article is reproduced from: https://www.ixiqin.com/2023/08/28/cjdcjzdzdwhtjzhm/
This site is only for collection, and the copyright belongs to the original author.