Forums / Developer / Reduce memory usage on users import (120k +)

Reduce memory usage on users import (120k +)

Author Message

Remi B

Tuesday 01 March 2011 12:56:43 am

Hi,

I've made a script, used as a cronjob in ssh.
This script open a txt file, and for each line, import data as new user in eZPublish.

All is ok, but the eZOperationHandler::execute content publish memory usage increase at each iteration.

I make an eZContentObject::clearCache(), and the memory usage is steady, but the memory peak increase ( I associate it to the content publish action).

Is there any solution to reduce actions on publishing ?
I've already added the [SearchSettings]DelayedIndexing=enabled in site.ini.append of my siteaccess.

Many thanks.

Marko Žmak

Tuesday 01 March 2011 3:02:23 pm

I believe you should use:

$object->resetDataMap();
eZContentObject::clearCache($object->attribute('id'));

after import of every user. Maybe also using some unset() for used variables.

If you want some more details, I had a question about this here:

http://share.ez.no/forums/developer/resetdatamap-and-ezcontentobject-clearcache/

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Marko Žmak

Tuesday 01 March 2011 3:06:02 pm

Also, for faster import, you could disable some module operations, look at this discussion for more info:

  • http://share.ez.no/forums/developer/publish-objects-from-script-without-cache-clear

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Remi B

Wednesday 02 March 2011 12:30:17 am

Thanks for your second post with the disableModuleOperation, the memory peak does not increase at each iteration.

I was already do the reset stuff, memory usage is about 30Mo between each publication.
But the publication take 500Mo :)

Btw, i've just relaunched my import with your trick, i'll post here to debrief about the memory usage.

Marko Žmak

Wednesday 02 March 2011 2:56:26 am

From your case I can conclude that executing module operations operations upon publishing increases the memory usage.

That would suggest that some of the module operation has a memory leakage...

Anyone from the eZ crew wishes to comment on this one?

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Remi B

Wednesday 02 March 2011 4:59:40 am

ATM, the script memory usage peak is 547 Mo
Since this morning, 2980 objects have been imported

I've got 31375 objects in the destination node.

Script is still runing...

Jean-Yves Zinsou

Wednesday 02 March 2011 5:20:05 am

Hi Remi B,

I have used those lines inside an import loop, with significant results :

"

eZContentObject::clearCache();
unset( $GLOBALS['eZContentObjectContentObjectCache'] );
unset( $GLOBALS['eZContentObjectDataMapCache'] );
unset( $GLOBALS['eZContentObjectVersionCache'] );
unset( $GLOBALS['eZContentClassAttributeCache'] );
//unset( $GLOBALS["eZUserObject_".$node->ContentObjectID] );

"

Give it a try !

Jey

Do Androids Dream of Electric Sheep?
I dream of eZpubliSheep....
------------------------------------------------------------------------
http://www.alma.fr

Remi B

Wednesday 02 March 2011 6:09:37 am

Hi Jey,

Thanks for your post, but, as i said, I already make this stuff :-)

The memory peak coming during content publish action.

Bertrand Dunogier

Wednesday 02 March 2011 6:39:53 am

One thing I can say for sure is that using the Asynchronous Publishing that comes with eZ Publish 4.5 will significantly reduce the memory usage that comes from the publishing process (make it close from 0), and will fasten the process a LOT.

Bertrand Dunogier
eZ Systems Engineering, Lyon
http://twitter.com/bdunogier
http://gplus.to/BertrandDunogier

eZ debug

Timing: Jan 29 2025 13:46:49
Script start
Timing: Jan 29 2025 13:46:49
Module start 'content'
Timing: Jan 29 2025 13:46:49
Module end 'content'
Timing: Jan 29 2025 13:46:49
Script end

Main resources:

Total runtime0.1090 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0055 588.0625180.8203
Module start 'content' 0.00550.0058 768.8828102.6797
Module end 'content' 0.01130.0975 871.5625530.6094
Script end 0.1088  1,402.1719 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00292.6602200.0001
Check MTime0.00121.0959200.0001
Mysql Total
Database connection0.00060.570510.0006
Mysqli_queries0.070864.93661410.0005
Looping result0.00110.96711390.0000
Template Total0.097289.210.0972
Template load0.00080.689910.0008
Template processing0.096588.507210.0965
Override
Cache load0.00050.486310.0005
Sytem overhead
Fetch class attribute can translate value0.00070.642210.0007
XML
Image XML parsing0.00040.351310.0004
General
dbfile0.00413.7423200.0002
String conversion0.00000.006630.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0002 secs