Excessive resource usage-Virtual Memory Size

6 posts by 2 authors in: Forums > CMS Builder
Last Post: April 1, 2014   (RSS)

By dlsweb - March 29, 2014

I am getting an alert "Excessive resource usage"
Resource:     Virtual Memory Size
Exceeded:     226 > 200 (MB)
Executable:   /usr/bin/php
Command Line: /usr/bin/php /home/xxxx/public_html/bnews/viewer.php

My memory_limit is set at 2048M
but I found in CMS init.php-  ini_set('memory_limit', '1028M')

Should there be any problem changing this to 2048?

Tks, Larry

By Chris - March 31, 2014

Hi Larry,

You can safely change that, yes, but be aware that your changes will be lost if you upgrade CMS Builder in the future. I recommend creating a file called CUSTOM_CHANGES.txt in your cmsAdmin directory and keeping a log of any custom changes you made.

You may want to check what the memory_limit actually is using phpinfo. CMS Builder can display phpinfo for you from the Admin > General Settings page. Sometimes the ini_set() lines in init.php are ignored.

It's a little worrying that your page is using up so much memory. Can you post your viewer.php script here as an attachment so I can take a look if there might be a simple way to trim down the memory usage?

All the best,
Chris

By dlsweb - March 31, 2014

It concerns me as well. I have close to 10,000 records so I was thinking a blank search would do it.

viewer attached

Attachments:

Viewer_php.txt 2K

By Chris - March 31, 2014

Can you also post the included file "newslist.php", just in case there's something suspect in there?

It probably won't save much, but since you're not using "createdBy." fields, you can add this line to your getRecords() which will save a little work and memory:

  'loadCreatedBy' => false, // optional, defaults to yes, adds createdBy. fields for created user

10,000 is a lot of records! There are many possible ways to optimize this.

One simple solution would be to use pagination so you don't have one page that has to load your entire artman_articles table. You can see an example of how to create a paginated viewer for your section if you go to Admin > Code Generator within CMS Builder.

If you need all of your articles displayed on the one page, there are more complicated solutions. One approach would involve removing unused fields (and extra data from long `content` fields) from the Mysql query (unfortunately, this involves migrating away from getRecords(), which is currently providing your '_link' and 'categoryNum:label' pseudo fields.) Another solution might be to use LIMITs to process the page in chunks (you could even use AJAX to load the page in chunks, which would also speed up the perceived page load times for your visitors.) Actually, that last option might not be *too* complicated, without the AJAX that is...

Our consulting department is, of course, available to help with any of this. Please let me know if you'd like us to put together a quote on anything.

Hopefully, pagination will work for you!

All the best,
Chris

By dlsweb - March 31, 2014

Thanks, I sure missed the pagination- and sure helps with load time.

newslist attached

Attachments:

newslist_php.txt 4K