Bug #14885
closedLong Loading Times -- Wordpress Admin Site
0%
Description
Via ZD:
"The load times for my Wordpress Admin pages are extremely long. It often takes 30-40 seconds to click between pages. The load time for my public facing site seems fine. But the Wordpress Admin pages in particular are having this issue.
Is this problem unique to my site or something others are also experiencing?
Wordpress Admin --- long load times
https://assessatcuny.commons.gc.cuny.edu/wp-admin/
Public Site – load time fine
Updated by Marilyn Weber about 3 years ago
I do see exactly what he means, and it is not the case on my sites. This seems to be only for this one site - any ideas?
Updated by Raymond Hoh about 3 years ago
The lag is caused by the Newsletters Lite plugin.
The main offender is the get_fields()
call: https://github.com/cuny-academic-commons/cac/blob/de282b6137cde40af1a1d00ef6e41d285f325ee0/wp-content/plugins/newsletters-lite/wp-mailinglist-plugin.php#L7095. The second offender is the check_table()
call: https://github.com/cuny-academic-commons/cac/blob/de282b6137cde40af1a1d00ef6e41d285f325ee0/wp-content/plugins/newsletters-lite/wp-mailinglist-plugin.php#L6964.
Both calls appear to be some part of an update routine. According to the Query Monitor plugin, the first query runs more than 700 times on a pageload, while the second one runs about 200 times. Together, they cause the roughly 50-60 second load time in the admin area.
I need to do some more debugging to see what Newsletters Lite is doing, but perhaps we can suggest switching this site over to an external newsletter alternative as in #11878. I think we were recommending Tinyletter, but not sure if there is an updated ticket about this.
Updated by Raymond Hoh about 3 years ago
I've fixed the issue.
The NewsLetters Lite plugin uses its own object cache to cache its own options: https://github.com/cuny-academic-commons/cac/blob/de282b6137cde40af1a1d00ef6e41d285f325ee0/wp-content/plugins/newsletters-lite/wp-mailinglist-plugin.php#L10178.
During the updating_plugin()
method, it checks the saved version against the file version before doing its update routine: https://github.com/cuny-academic-commons/cac/blob/de282b6137cde40af1a1d00ef6e41d285f325ee0/wp-content/plugins/newsletters-lite/wp-mailinglist-plugin.php#L10548.
When grabbing the saved version, this value was old and not the same as the value in the DB.
So I purged the cached value with wp_cache_delete( 'version', 'newsletters' )
and this fixed the issue!
Updated by Boone Gorges about 3 years ago
Nice sleuthing, Ray!
Did you see any obvious reason why there was a mismatch between the cached value and the value in the database? I realize these things are very hard to debug, but perhaps if there's an obvious fix we could suggest upstream, it would be worthwhile.
Is there any way we can detect this kind of problem in the future? It feels odd that the plugin would rely on a cached value during something like an upgrade routine - maybe we could skip it, and force the plugin to fetch directly from the database? Maybe this is a long shot, and maybe it's a case that won't come up again in the future, but it might be worth a bit of investigation.
Updated by Raymond Hoh about 3 years ago
It feels odd that the plugin would rely on a cached value during something like an upgrade routine
It's an architectural problem. Their option fetching routine has a cache, so Tribulant needs to purge their cache entry after the upgrade is complete. I took a quick look at their codebase and it looks like they never delete or update any option in their object cache! Crazy!
This means that there could be other issues with the plugin and older, cached values.
I've made a post in their support forum here and Tribulant says they are looking into it.
In the meantime, I can probably patch newsletters-lite
so their options object cache is properly updated and deleted when needed.
Updated by Raymond Hoh about 3 years ago
- Category name set to WordPress Plugins
- Status changed from New to Staged for Production Release
- Assignee set to Raymond Hoh
- Target version set to 1.18.21
I've added a fix here: https://github.com/cuny-academic-commons/cac/commit/639cab15127c5cff89973a5344a647e7d1753729
I've basically removed Tribulant's cache lookup from their custom get_option()
method since that method already calls on WP's get_option()
function, which has an object cache built-in.
Updated by Marilyn Weber about 3 years ago
Thank you! Both from me and the user.
Updated by Boone Gorges about 3 years ago
- Target version changed from 1.18.21 to 1.18.22
Updated by Raymond Hoh about 3 years ago
- Status changed from Staged for Production Release to Resolved
Looks like Tribulant added my suggestion to the latest version of newsletters-lite
, which was deployed as part of today's maintenance release, 1.18.21. See https://github.com/cuny-academic-commons/cac/blob/11f95626af01b7fc6ed5bfeb0e9aa6ac1ad28d78/wp-content/plugins/newsletters-lite/wp-mailinglist-plugin.php#L10196-L10198.
Going to close this one.