<![CDATA[ Manager slow to load Resources - My Forums]]> https://forums.modx.com/thread/?thread=99816 <![CDATA[Manager slow to load Resources]]> https://forums.modx.com/thread/99816/manager-slow-to-load-resources#dis-post-539890 Environment

- Windows Server 2012
- PHP 5.3.29 with Wincache
- MySQL 5.6.26
- MODX Revolution 2.1.3-pl (I know)

Server has 8 2.2ghz cores and 12gb RAM. Typical use is 40-50% for both CPU and RAM.


Issue

The Manager typically takes 20 seconds to open Resources however occasionaly exceeds the max execution time of 30 seconds.

Other pages eg. Manage Users and Access Controls load in 1 second.


Background

The website was migrated to a new server with nearly identical configuration to the original. The website ran without issue before being moved.


Details that may help identify the issue

PHP error log for timeout contains a number of errors:

First
[23-Mar-2016 17:11:59 UTC] PHP Fatal error:  Maximum execution time of 30 seconds exceeded in C:\net\hosts\domain.co.uk\httpdocs\core\model\modx\modtemplatevar.class.php on line 492

#492 from modtemplatevar.class.php relates to render directories
if (!$file->isReadable() || !$file->isFile()) continue;


Second
[23-Mar-2016 17:11:59 UTC] PHP Fatal error:  Maximum execution time of 30 seconds exceeded in C:\net\hosts\domain.co.uk\httpdocs\core\xpdo\om\mysql\xpdoquery.class.php on line 57

#57 from xpdoquery.class.php is
$escape = !preg_match('/\bAS\b/i', $column) && !preg_match('/\./', $column) && !preg_match('/\(/', $column);

I don't think these help identify the issue though.

MySQL does not log any queries taking over 2 seconds to execute.

Does this indicate an issue on the PHP side?

Can anyone advise how to investigate further?]]>
chris.dempsey78 Mar 23, 2016, 01:40 PM https://forums.modx.com/thread/99816/manager-slow-to-load-resources#dis-post-539890
<![CDATA[Re: Manager slow to load Resources]]> https://forums.modx.com/thread/99816/manager-slow-to-load-resources#dis-post-539934 TVs take almost as much time to populate in the Manager That may be it. Caching could mask the same issue presenting on the front end.

There have been no changes to the site for many years other than to add news items, each as their own resource.

I'm convinced there is a difference in the server configuration causing the issue.

The new server has double the memory_limit of the original.

I'll need to compare the mysql configurations on each to see if that indicates the source of the problem.

Will also get a look at your MySQL tuning link.]]>
chris.dempsey78 Mar 25, 2016, 05:50 AM https://forums.modx.com/thread/99816/manager-slow-to-load-resources#dis-post-539934
<![CDATA[Re: Manager slow to load Resources]]> https://forums.modx.com/thread/99816/manager-slow-to-load-resources#dis-post-539929 here.

]]>
BobRay Mar 24, 2016, 09:17 PM https://forums.modx.com/thread/99816/manager-slow-to-load-resources#dis-post-539929
<![CDATA[Re: Manager slow to load Resources]]> https://forums.modx.com/thread/99816/manager-slow-to-load-resources#dis-post-539928 If this is in the front end and the TVs are all displayed, that would explain it Nope, issue is viewing Resources in the Manager. Most take upwards of 20 seconds to load, sometimes in excess of 30 seconds which hits the max_execution_time time. This is TTFB, not time to load all css/js and other assets.

Other Manager pages load in 2 seconds eg. Components > Batcher, Security > Manage Users.

As mentioned above I noticed Resources with no Template Variables load in 2 seconds. So I created a Test Template, assigned it to a test Resource and played with the Template Variables assigned to the template Template.

The result is TTFB when loading a Resource in the manager is definitely related to the number of TVs assigned to the Template that particular Resource uses. I didn't test the TVs individually to see if the issue is one in particular or the cumulative effect of 49 TVs.

What I don't understand is why the site was fine on the original server when it was almost identical hardware and configuration.

There must be a difference but I don't know where to look to figure what needs adjusted.]]>
chris.dempsey78 Mar 24, 2016, 05:49 PM https://forums.modx.com/thread/99816/manager-slow-to-load-resources#dis-post-539928
<![CDATA[Re: Manager slow to load Resources]]> https://forums.modx.com/thread/99816/manager-slow-to-load-resources#dis-post-539926
The bottom line is that TVs are a terrible place to store data.

If you want to speed things up, 1) move any TVs that do not contain page-specific data into the template, and 2) move all other TVs into a custom table with ClassExtender.

If you have a lot of conditional output modifiers (like :ifempty or :default), you might want to consider a custom snippet to create the page output (in addition to the suggestions above).]]>
BobRay Mar 24, 2016, 04:17 PM https://forums.modx.com/thread/99816/manager-slow-to-load-resources#dis-post-539926
<![CDATA[Re: Manager slow to load Resources]]> https://forums.modx.com/thread/99816/manager-slow-to-load-resources#dis-post-539911
There is only one template on the affected site and the first thing that comes to mind is that it has permissions to access 49 Template Variables in 7 groups.

TV types include text, text area, rich text, checkbox and image.

Think I'll create a test template, restrict the TVs it can access and see if that seems to relate directly to load time.]]>
chris.dempsey78 Mar 24, 2016, 10:49 AM https://forums.modx.com/thread/99816/manager-slow-to-load-resources#dis-post-539911