Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: Slow page load when using Structure custom titles

Status Resolved
Add-on / Version Publisher Lite 3.9.1
Severity
EE Version 7.2.9

Andrew Gunstone

Feb 13, 2023

I have a site that uses Structure quite extensively ... with about 8 channels, and a couple of thousand entries across those channels. Many are “listing” pages so aren’t shown in the Structure list, but they are still processed when using the custom titles (ie channel:title=“mychannel:myfield” combination).

When using this with Publisher Lite (and I assume Publisher) ... it makes the page load incredibly slow (and in some case causes a timeout).

This has previously been an issue with Structure as well ... but was fixed in a recent release - https://github.com/ExpressionEngine/ExpressionEngine/issues/2432

The issue is in Publisher_structure_hooks.php with the create_custom_titles() function. Very specifically the issue is this database call that causes the issue:

// Get the Channel Entries that have are in a Structure Channel
            $channelEntries = ee('Model')->get('ChannelEntry')
                 ->filter('channel_id', 'IN', array_keys($structure_channels))
                 ->filter('site_id', '==', $this->siteId)
                 ->fields('entry_id')
                 ->all();

In the top of this function you mention “Shamelessly borrowed from Structure and altered slightly.” ... and I think that you may need to review the new version of this function from Structure as it’s now been improved for speed.

Cheers!

#1

BoldMinded (Brian)

Feb 14, 2023

Thanks. This is probably the 2 busiest weeks for me of the year so it might be a bit before I can look into this more.

note for reference: https://github.com/ExpressionEngine/ExpressionEngine/pull/2554/commits/7ee5cb19439e6b971469664eaa0af49dc1585f02

#2

BoldMinded (Brian)

Feb 15, 2023

Comment has been marked private.

#3

Andrew Gunstone

Feb 16, 2023

Hey Brian,

Yes ... this is great. I’ve tested this build and the speed issues are gone (at least as far Publisher is concerned ... ha!).

Thanks for working on this one. Much appreciated!

Cheers.

#4

BoldMinded (Brian)

Feb 16, 2023

Good to hear. Are you able to share any before and after speed metrics?

#5

Andrew Gunstone

Feb 16, 2023

Not really as it pretty much killed the pages, particularly on my local version. On my staging version pages were taking around 15-18 seconds longer because of the issue. Without Publisher, they were loading in around 1-1.5 seconds ... with Publisher it was around 20 seconds (if it didn’t crash). This was the same metrics I was seeing prior to the Structure fixes as well (no Publisher).

Now with both the Structure fixes, and the Publisher fixes, pages are back to 1-1.5 seconds.

Which is good given how complex this (hospital) site is. Lots of content, lots of relationships between complex, etc.

#6

BoldMinded (Brian)

Feb 16, 2023

This is when saving entries or viewing on the front end?

#7

Andrew Gunstone

Feb 16, 2023

Front end only. The CP was okay.

For a lot of the Structure tags ie… {exp:structure:breadcrumb channel:title=“pages:display_title” ... } ... I use the channel:title field. As soon as you get more than about 100 entries in Structure (either a page or a listing), then all of a sudden it would start running super slow. The EE team fixed this in the latest Structure, but it was still happening with the create_custom_titles() function in Publisher (which was, as you mention, a copy of the old Structure code).

Super appreciate you having looked into this one!

#8

BoldMinded (Brian)

Feb 17, 2023

Really glad this improved things. Thanks for pointing it out!

Login to reply