cli script slow

Author Message

Oliver Frommel

Wednesday 05 September 2007 1:11:43 am

Björn Dieding@xrow.de

Wednesday 05 September 2007 5:43:50 am

eZOperationHandler::execute( 'content', 'publish', array( 'object_id' => $object->attribute( 'id' ), 'version' => $object->attribute('current_version')))

Well the contentobject publishing just needs quite a long time usually about 1 sec. You can`t really make it faster.

The only tips i can give you is execute this on a linux maschine and clear the internal object cache after every 100 contentobjects

Else it looks like you are working with existing objects and you try to just change some values

in this case you can:

- skip creating a new version, just use fetch(), setAtrribute() and store()

you basicly keep the current version

Looking for a new job? http://www.xrow.com/xrow-GmbH/Jobs
Looking for hosting? http://hostingezpublish.com
-----------------------------------------------------------------------------
GMT +01:00 Hannover, Germany
Web: http://www.xrow.com/

Oliver Frommel

Wednesday 05 September 2007 6:04:54 am

That is good to know. I was unsure about the correct handling of versions, storing, publishing
and so on (and on languages, but that's another story :). There's not very much documentation out there, so you have to figure out a lot based on cli scripts floating around (which aren't necessarily correct, too)

Thanks for the hint.
Oliver

Kristof Coomans

Thursday 06 September 2007 1:55:27 am

Hi Oliver

Enabling delayed indexing can speed it up a bit as well.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Damien Pobel

Thursday 06 September 2007 8:13:19 am

Hi Oliver,

you can also replace this part :

foreach( $version->contentObjectAttributes() as $attr )
{
    $attr_datatype = $attr->attribute( 'data_type_string' );
    $attr_id = $attr->attribute('contentclass_attribute_identifier');
    if ($attr_id == 'date_publish') {
        $date = strftime("%d.%b %Y", $newtime);
        print "setting date of ".$article->attribute('name')." to ".$date."\n";
        $attr->fromString($newtime);
        $attr->store();
    }
}

by something like this :

$dataMap = $version->dataMap();
if ( array_key_exists( 'date_publish', $dataMap ) )
{
    $date = strftime("%d.%b %Y", $newtime);
    print "setting date of ".$article->attribute('name')." to ".$date."\n";
    $dataMap['date_publish']->fromString( $newtime );
    $dataMap['date_publish']->store();
}

It avoids looping on content attributes whereas you know its identifier...

Damien
Planet eZ Publish.fr : http://www.planet-ezpublish.fr
Certification : http://auth.ez.no/certification/verify/372448
Publications about eZ Publish : http://pwet.fr/tags/keywords/weblog/ez_publish

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 16:18:39
Script start
Timing: Jan 18 2025 16:18:39
Module start 'layout'
Timing: Jan 18 2025 16:18:39
Module start 'content'
Warning: PHP: E_WARNING Jan 18 2025 16:18:40
DOMDocument::loadXML(): Opening and ending tag mismatch: literal line 2 and paragraph in Entity, line: 96 in /home/ze/public_html/share.se7enx.com/kernel/classes/datatypes/ezxmltext/ezxmloutputhandler.php on line 174
Warning: PHP: E_WARNING Jan 18 2025 16:18:40
DOMDocument::loadXML(): Opening and ending tag mismatch: paragraph line 2 and section in Entity, line: 96 in /home/ze/public_html/share.se7enx.com/kernel/classes/datatypes/ezxmltext/ezxmloutputhandler.php on line 174
Timing: Jan 18 2025 16:18:40
Module end 'content'
Timing: Jan 18 2025 16:18:40
Script end

Main resources:

Total runtime0.9616 sec
Peak memory usage4,096.0000 KB
Database Queries67

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0051 591.3125152.6094
Module start 'layout' 0.00510.0027 743.921939.4141
Module start 'content' 0.00780.9522 783.3359655.0859
Module end 'content' 0.96000.0015 1,438.421916.4063
Script end 0.9616  1,454.8281 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.3668160.0002
Check MTime0.00140.1411160.0001
Mysql Total
Database connection0.00060.061910.0006
Mysqli_queries0.900493.6364670.0134
Looping result0.00080.0856650.0000
Template Total0.931796.920.4659
Template load0.00210.217520.0010
Template processing0.929696.673520.4648
Template load and register function0.00020.024510.0002
states
state_id_array0.00080.086110.0008
state_identifier_array0.00360.375620.0018
Override
Cache load0.00170.1795290.0001
Sytem overhead
Fetch class attribute can translate value0.00120.125840.0003
Fetch class attribute name0.00160.166180.0002
XML
Image XML parsing0.00180.187140.0004
class_abstraction
Instantiating content class attribute0.00000.001780.0000
General
dbfile0.00120.1265280.0000
String conversion0.00000.003440.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
7content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 21
 Number of unique templates used: 7

Time used to render debug report: 0.0003 secs