<![CDATA[ Excessive resource usage? - My Forums]]> https://forums.modx.com/thread/?thread=95845 <![CDATA[Excessive resource usage?]]> https://forums.modx.com/thread/95845/excessive-resource-usage?page=2#dis-post-518765
I have multiple modx websites running on a VPS with csf/lfd plugin installed and i'm getting these error mails regularly.
It happens to different sites, on different times and it allways refers to public_html/index.php
Is this a normal amount of memory a modx Revo site uses? Or nothing to worry about.
Any ideas how to lower the memory size?
Could it be that a plugin is causing the problem?
The sites doesnt have that many visitors and are basic small company websites, with basic plugins installed, such as wayfinder, getresources, redactor, .....

Thanks for any help!

Time: Mon Jan 19 21:41:37 2015 +0100
Account: ****
Resource: Virtual Memory Size
Exceeded: 320 > 200 (MB)
Executable: /opt/php52/bin/php-cgi
Command Line: /opt/php52/bin/php-cgi /home/***/public_html/index.php
PID: 26410 (Parent PID:26330)
Killed: No]]>
phyxcius Jan 19, 2015, 03:24 PM https://forums.modx.com/thread/95845/excessive-resource-usage?page=2#dis-post-518765
<![CDATA[Re: Excessive resource usage?]]> https://forums.modx.com/thread/95845/excessive-resource-usage?page=2#dis-post-518952 sottwell Jan 21, 2015, 08:53 PM https://forums.modx.com/thread/95845/excessive-resource-usage?page=2#dis-post-518952 <![CDATA[Re: Excessive resource usage?]]> https://forums.modx.com/thread/95845/excessive-resource-usage#dis-post-518947 phyxcius Jan 21, 2015, 06:14 PM https://forums.modx.com/thread/95845/excessive-resource-usage#dis-post-518947 <![CDATA[Re: Excessive resource usage?]]> https://forums.modx.com/thread/95845/excessive-resource-usage#dis-post-518945
Is the chunk tag for your top banner chunk containing getResources in the Template or the content field of pages?]]>
BobRay Jan 21, 2015, 05:56 PM https://forums.modx.com/thread/95845/excessive-resource-usage#dis-post-518945
<![CDATA[Re: Excessive resource usage?]]> https://forums.modx.com/thread/95845/excessive-resource-usage#dis-post-518943
Thanx Susan and Bob, I did manage to find a 'loophole', it was a chunk in a chunk appearently!
Alltho i'm still getting the exact same amount of memory 320 MB usage on lfd-reports.

I checked the rest of the site for more 'loophole's, but couldnt find any.
The most complexed thing the site has is a chunck 'Top-banner' with a getResource to show the latest news and MXcalender-call to show the latest events.
GetResources searches about 20-25 resources, calendar about 30 items and pictures

Bob, i tried your code to see the memory usage on the site (it works if you remove the "*/" at the end fo your code), and with that i'm only getting a maximum peak of 20~25 MB.
But while i was checking every single page, i got an other lfd report saying it had 320 MB of Virtual Memory, so i really dont know anymore...


]]>
phyxcius Jan 21, 2015, 05:14 PM https://forums.modx.com/thread/95845/excessive-resource-usage#dis-post-518943
<![CDATA[Re: Excessive resource usage?]]> https://forums.modx.com/thread/95845/excessive-resource-usage#dis-post-518868
<?php
$mem_usage = memory_get_usage();
$peak_usage = memory_get_peak_usage(true);
$output .= "\nBefore MODX Final Memory"
    . ': ' . round($mem_usage / 1048576, 2) . ' Megabytes';
$output .= "\n" . 'Peak: ' . round($peak_usage / 1048576, 2) . ' MegaBytes';
echo $output;


Is there a better way (or maybe my math is wrong)?]]>
BobRay Jan 21, 2015, 01:46 AM https://forums.modx.com/thread/95845/excessive-resource-usage#dis-post-518868
<![CDATA[Re: Excessive resource usage?]]> https://forums.modx.com/thread/95845/excessive-resource-usage#dis-post-518850 AMDbuilder Jan 20, 2015, 04:52 PM https://forums.modx.com/thread/95845/excessive-resource-usage#dis-post-518850 <![CDATA[Re: Excessive resource usage?]]> https://forums.modx.com/thread/95845/excessive-resource-usage#dis-post-518844
In the simplest form, it could be a chunk with a chunk tag for itself in the content. E.g., if you have a chunk called "SomeChunk" and you have this tag in the chunk:

[[$SomeChunk]]



Similarly, a getResources tag on a page that's under the &parents specified in the tag will also loop continuously.

]]>
BobRay Jan 20, 2015, 03:14 PM https://forums.modx.com/thread/95845/excessive-resource-usage#dis-post-518844
<![CDATA[Re: Excessive resource usage?]]> https://forums.modx.com/thread/95845/excessive-resource-usage#dis-post-518796 sottwell Jan 20, 2015, 03:03 AM https://forums.modx.com/thread/95845/excessive-resource-usage#dis-post-518796 <![CDATA[Re: Excessive resource usage?]]> https://forums.modx.com/thread/95845/excessive-resource-usage#dis-post-518782
AFAIK, MODX Revolution itself only takes up about 8 or 9 Megabytes, so your figure seems excessive. Usually, about 120 megabytes is more than enough for even a fairly large MODX site.

About how many resources is the getResources call processing and how big is the Tpl chunk it's using?

I just ran a few tests with getCollection() and getResources() and couldn't get past about 17 megabytes.]]>
BobRay Jan 20, 2015, 12:35 AM https://forums.modx.com/thread/95845/excessive-resource-usage#dis-post-518782