Forums / Developer / Best practice for threaded comments

Best practice for threaded comments

Author Message

Oliver Frommel

Friday 01 August 2008 6:47:52 am

Hello,

for a project I need to import some old data from another CMS. Among other things there are lot of comment threads up to about four levels deep. What I'd like to know is what's that best way of storing them in eZ publish.

I thought about re-creating the comment thread structure in terms of container objects containing the children. Or I could save theme somewhere flat and re-create the structure through object relations. Or a mixture. Or something I did not think of yet.

The aim is to save processing in a template that has to display that tree structure of a certain object, say an article and all affiliated comments.

I would be grateful if you could give me some best practice advise on this.

Thanks
Oliver

Piotrek Karaś

Friday 01 August 2008 11:17:48 pm

I'm not sure there is a best practice for that, or at least I'm not aware of it.

Creating an object per comment and reflecting threads by structuring parent/child comments would be the default way, I think, and definitely some API exists to import that quite easily. But if you have a substantial number of those comments (going into tens or hundreds of thousands and above) and/or those comments are a key functionality and are expected to be very popular, then moving them into eZ Publish as objects may be risky - you'll end up with gigantic structure of objects of little singular importance. I such case I would think of moving this functionality outside of eZ Publish content model, into my own extension/database tables.

But it would be really great to hear someone who has actually dealt with this problem!

Cheers,
Piotrek

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Oliver Frommel

Monday 04 August 2008 4:41:03 am

Thanks for your comments, Piotrek. Actually there are quite a few comments I want to import, about 60.000. What exactly will be the problem when I import them as eZ objects? Will that slow down eZ that much?

Best
Oliver

Piotrek Karaś

Tuesday 05 August 2008 11:40:19 am

Hi,

Threaded comments under a number of articles (or any other objects) should be fine - it's usually a problem when you have too many objects under one node. But I haven't dealt with an eZ site of that size from administrative side, so I wouldn't know for sure, but I expect the content-model tables to grow significantly. Sites with way more nodes are known to work fine, though, but you would have to ask others what's the cost.

Cheers,
Piotrek

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

eZ debug

Timing: Jan 18 2025 15:59:01
Script start
Timing: Jan 18 2025 15:59:01
Module start 'content'
Timing: Jan 18 2025 15:59:02
Module end 'content'
Timing: Jan 18 2025 15:59:02
Script end

Main resources:

Total runtime1.0702 sec
Peak memory usage4,096.0000 KB
Database Queries197

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0067 588.8516180.8281
Module start 'content' 0.00670.9500 769.6797556.3281
Module end 'content' 0.95670.1135 1,326.0078336.7422
Script end 1.0702  1,662.7500 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00420.3962210.0002
Check MTime0.00150.1368210.0001
Mysql Total
Database connection0.00060.053110.0006
Mysqli_queries0.996193.07041970.0051
Looping result0.00190.17961950.0000
Template Total1.035896.820.5179
Template load0.00210.197220.0011
Template processing1.033796.586120.5169
Template load and register function0.00010.011810.0001
states
state_id_array0.00100.089010.0010
state_identifier_array0.00200.182820.0010
Override
Cache load0.00180.1658270.0001
Sytem overhead
Fetch class attribute can translate value0.00100.094730.0003
Fetch class attribute name0.00170.161050.0003
XML
Image XML parsing0.00080.070430.0003
class_abstraction
Instantiating content class attribute0.00000.001860.0000
General
dbfile0.00320.2978280.0001
String conversion0.00000.000530.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
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 20
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs