All add-ons currently require PHP 7.4 or greater.

On July 4th 2024 PHP 8.2 will be the new minimum requirement for all add-ons. Expect any add-on released after that date to require 8.2 or greater. Some releases may not immediately take advantage of 8.x specific features in PHP, which means you might, be able to continue using new releases in PHP 7.4, however, if you experience an error the first thing you should do is update to PHP 8.2 then create a support ticket if the error persists.

Please read about the changes to BoldMinded add-on licensing.

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)

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)

Comment has been marked private.

#3

Andrew Gunstone

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)

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

#5

Andrew Gunstone

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)

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

#7

Andrew Gunstone

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)

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

Login to reply