0

From a recently migrated Craft CMS 2 site, there are various entries in the Control Panel which take a very long time to load (sometimes over 30 seconds). This is the same in our production environment with debugging off, so it is not overhead from dev mode. Testing on the old Craft CMS 2 site with entries that exist in both, this is not happening.

Profiling with Yii Toolbar I can see that it's clearly showing rendering the matrix field in the Control Panel is taking up a sizable amount of the request. This is also consistent with testing other entries which do not feature this field and load much quicker. Removing this field is obviously not an option because it provides many matrix blocks for entry content.

The front end is fine and does not have issues loading entries which take a very long time to load in the Control Panel.

I cannot see any DB query that's causing such a long load time but any pointers on digging into this issue would be appreciated. Something is clearly hanging the render template call, but again this is limited to the Control Panel and not front end.

The site is running Craft CMS 3.7.46.

enter image description here

1 Answer 1

0

This turned out to be a badly performing custom element source criteria being loaded on the EVENT_REGISTER_SOURCES event. The query was causing render blocking when loading entries. Entries using matrix fields seems to have the worst performance. Making the criteria more performant allows things to load quicker. It was a bit of a misleading trace, but looking at the DB query profiling more closely identified it. This was being called in a custom module. After removing this module from the bootstrap in the app.php, things loaded much quicker so it narrowed it down to then troubleshoot. A good lesson for the future.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.