Skip to content

Performance gain - new featured article#8576

Merged
rdeutz merged 1 commit intojoomla:stagingfrom
alikon:performance-1
Apr 15, 2016
Merged

Performance gain - new featured article#8576
rdeutz merged 1 commit intojoomla:stagingfrom
alikon:performance-1

Conversation

@alikon
Copy link
Copy Markdown
Contributor

@alikon alikon commented Dec 1, 2015

Follow up

How to reproduce the issue

this issue arise when you create a new article (featured) in a category of 100 or more articles
when you save a new one you should notice that it takes a lot of time

How to test

  1. You need to have 100 articles in one category

  2. at the begin of prepareTable() https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_content/models/article.php#L222 add

JDEBUG ? $time=microtime(true) : null;
JDEBUG ? JLog::addLogger(array('text_file' => 'testPR8576.php', ), JLog::INFO) : null;

at the end https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_content/models/article.php#L243 add

JDEBUG ? JLog::add('prepareTable():'.round(microtime(true) - $time, 3), JLog::INFO) : null;
  1. we do the same on featured() https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_content/models/article.php#L595 add
JDEBUG ? $time=microtime(true) : null;

and

JDEBUG ? JLog::add('Featured():'.round(microtime(true) - $time, 3), JLog::INFO) : null;

at the end

  1. enable the debug plugin

  2. create a new featured article in the category with 100 articles

repeat 5) two or 3 times

in the logs folder open testPR8576.php you'll see how much time cost

Apply the pacth

and redo the same hack 2), 3) as before
repeat 5) two or 3 times
reopen testPR8576.php you should notice the gain

logimage

performance gain measurements

i've runned a cli script that create 100 featured articles in 1 category without the patch
bulk100

it takes something like 500 seconds

i've runned the same script as before with the patch applyed
bulk100p

as you can see now takes only something like 70 seconds

Comments

the $table->reorder() was insanely invoked in the artcle model
and this cause to run a lot of unncessary updates for the ordering field on the #__ content , #__content_frontapage tables

@sovainfo
Copy link
Copy Markdown
Contributor

sovainfo commented Dec 6, 2015

As requested I performed a code review and it looks ok to me, apart from the fact the comments need to reflect the changed code.

Struggling to determine the impact of your change, not being familiar enough with this part of com_content.

@Bodge-IT
Copy link
Copy Markdown
Contributor

Not seeing these times when creating new featured articles.
Can you be specific for final line number in featured(). Should it sit after "return true;" (L683)
Do the 100 articles all need to be featured?

@alikon
Copy link
Copy Markdown
Contributor Author

alikon commented Feb 15, 2016

should go before https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_content/models/article.php#L672

if the 100 articles are featured already, the slowness should be more evident

@Bodge-IT
Copy link
Copy Markdown
Contributor

Now have a 109 articles.
New featured articles:
2016-02-15T20:08:33+00:00 INFO 82.69.61.42 - prepareTable():0.865
2016-02-15T20:08:33+00:00 INFO 82.69.61.42 - Featured():0.008
2016-02-15T20:09:40+00:00 INFO 82.69.61.42 - prepareTable():0.87
2016-02-15T20:09:40+00:00 INFO 82.69.61.42 - Featured():0.14
2016-02-15T20:10:14+00:00 INFO 82.69.61.42 - prepareTable():0.952
2016-02-15T20:10:14+00:00 INFO 82.69.61.42 - Featured():0.131

@alikon
Copy link
Copy Markdown
Contributor Author

alikon commented Feb 16, 2016

are these result from before apply this #pr or after ?
can you publish both results

@AmayAgrawal
Copy link
Copy Markdown

Sir you have written that in the logs folder open testpr8576.php but it does not have such file.Can u specify the url or something where should i test.

@waader
Copy link
Copy Markdown
Contributor

waader commented Feb 27, 2016

I have tested this item ✅ successfully on 0e61eda

Category with 500 featured articles:

results before:
2016-02-27T18:11:43+00:00 INFO 127.0.0.1 - prepareTable():0.872
2016-02-27T18:11:44+00:00 INFO 127.0.0.1 - Featured():0.75
2016-02-27T18:12:02+00:00 INFO 127.0.0.1 - prepareTable():0.78
2016-02-27T18:12:03+00:00 INFO 127.0.0.1 - Featured():0.77

and after:
2016-02-27T18:16:48+00:00 INFO 127.0.0.1 - prepareTable():0.002
2016-02-27T18:16:48+00:00 INFO 127.0.0.1 - Featured():0.012
2016-02-27T18:16:51+00:00 INFO 127.0.0.1 - prepareTable():0
2016-02-27T18:16:51+00:00 INFO 127.0.0.1 - Featured():0.02


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8576.

@webmiep
Copy link
Copy Markdown

webmiep commented Apr 15, 2016

I have tested this succesfully

#Date: 2016-04-15 15:09:59 UTC
#Software: Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT

#Fields: datetime priority clientip category message
----------before patch-----------
2016-04-15T15:09:59+00:00 INFO 159.100.68.158 - prepareTable():0.08
2016-04-15T15:10:21+00:00 INFO 159.100.68.158 - prepareTable():0.116
2016-04-15T15:10:44+00:00 INFO 159.100.68.158 - prepareTable():0.088
-----------after patch-------------
2016-04-15T15:17:00+00:00 INFO 159.100.68.158 - prepareTable():0.001
2016-04-15T15:17:21+00:00 INFO 159.100.68.158 - prepareTable():0.003
2016-04-15T15:17:41+00:00 INFO 159.100.68.158 - prepareTable():0.001


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8576.

@webmiep
Copy link
Copy Markdown

webmiep commented Apr 15, 2016

I have tested this item ✅ successfully on 0e61eda


#Date: 2016-04-15 15:09:59 UTC
#Software: Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT

#Fields: datetime priority clientip category message
----------before patch-----------
2016-04-15T15:09:59+00:00 INFO 159.100.68.158 - prepareTable():0.08
2016-04-15T15:10:21+00:00 INFO 159.100.68.158 - prepareTable():0.116
2016-04-15T15:10:44+00:00 INFO 159.100.68.158 - prepareTable():0.088
-----------after patch-------------
2016-04-15T15:17:00+00:00 INFO 159.100.68.158 - prepareTable():0.001
2016-04-15T15:17:21+00:00 INFO 159.100.68.158 - prepareTable():0.003
2016-04-15T15:17:41+00:00 INFO 159.100.68.158 - prepareTable():0.001


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8576.

@roland-d
Copy link
Copy Markdown
Contributor

Setting RTC as we have 2 successful commits


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8576.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Apr 15, 2016
@rdeutz rdeutz added this to the Joomla 3.5.2 milestone Apr 15, 2016
@rdeutz rdeutz merged commit 584440d into joomla:staging Apr 15, 2016
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Apr 15, 2016
@rdeutz rdeutz modified the milestones: Joomla 3.5.2, Joomla! 3.6.0 May 1, 2016
@alikon alikon deleted the performance-1 branch June 7, 2016 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants