- 08 Feb 2023
- 1 Minute to read
- Print
- DarkLight
Troubleshooting Wordpress high pageload times / memory timeouts
- Updated on 08 Feb 2023
- 1 Minute to read
- Print
- DarkLight
In some cases, WordPress plugins may see an issue, which causes it to loop over and over, and cause a memory issue to load on the website regardless of the assigned PHP memory_limit.
Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 92 bytes) in /home/username/public_html/wp-includes/class-wp-hook.php on line 298
Using "ps" as the user, you can see the PHP application increasing it's RAM usage, and running in the background (this will only work in a suphp/lsapi environment).
#ps auxwwf
username 280337 98.0 5.6 1239224 914400 ? RN 10:54 1:16 | \_ /usr/bin/php /home/username/public_html/wp-admin/index.php
In order to trace the usage on this process, you can then go ahead and use the "strace" application to see what is doing it. In the example below, one WordPress plugin can be seen looping over and over, for 10-20 seconds, on the same lines, making it obvious which plugin is causing the high page load time.
lstat("/home/username/public_html/wp-content", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/home/username/public_html/wp-content/plugins/plugin-name/admin/core/um-admin-filters-fields.php", {st_mode=S_IFREG|0644, st_size=5139, ...}) = 0
lstat("/home/username/public_html/wp-content/plugins/plugin-name/admin/core", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/home/username/public_html/wp-content/plugins/plugin-name/admin", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/home/username/public_html/wp-content/plugins/plugin-name", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/home/username/public_html/wp-content/plugins", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/home/username/public_html/wp-content", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/home/username/public_html/wp-content/plugins/plugin-name/admin/core/um-admin-columns.php", {st_mode=S_IFREG|0644, st_size=3218, ...}) = 0
lstat("/home/username/public_html/wp-content/plugins/plugin-name/admin/core", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/home/username/public_html/wp-content/plugins/plugin-name/admin", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
In the above example, you can then either decide to disable the broken plugin, or you can troubleshoot it further using the available WordPress debugging.