J4 Issue ?
avatar ChristoforosKor
ChristoforosKor
3 Aug 2019

Steps to reproduce the issue

I am making test on joomla site with about 160.000 articles adn about 50000 tags. I open the backend for listing the articles to select one or some of them for manipulation.

Expected result

I am eexpeting to see the list of the articles.

Actual result

The list is taking to long to appear and sometimes it reponse nothing.

System information (as much as possible)

Joomla 4, mariadb 10.4, 16 cpu, 32 GB ram ( 24 on pool buffer size of the mariadb), nginx 1.10.

Additional comments

The problem is how the Joomla\CMS\MVC\Model\BaseDatabaseModel: _getListCount() works.
If it finds ,group or merge or querySet or having clause in the query then, as it is written on the own method comments:
// Otherwise fall back to inefficient way of counting all results.
The above for 160.000 articles is exhausting.

I have override the method
Joomla\CMS\MVC\Model\ListModel::getTotal() which calls _getListCount().

The override made at the:
Joomla\Component\Content\Administrator\Model class. I added the method:

 public function getTotal()
        {
            // Get a storage key.
            $store = $this->getStoreId('getTotal');

            // Try to load the data from internal storage.
            if (isset($this->cache[$store]))
            {
                    return $this->cache[$store];
            }

            try
            {
                $query = clone $this->_getListQuery();
                $query->clear('select')->clear('order')->clear('limit')->clear('offset')->clear('group') -> select('COUNT(*)');
                $this->getDbo()->setQuery($query);
               $this->cache[$store] =  (int) $this->getDbo()->loadResult();
            }
            catch (\RuntimeException $e)
            {
                    $this->setError($e->getMessage());

                    return false;
            }

            return $this->cache[$store];
        }

which solved this problem for me.
Perhaps you could imported it on the joomla code.

I can not attach the database backup because of its size. I have below a link to wetransfer were you can downloaded it:
https://we.tl/t-43tKJWNkZ7
The above link will be valid unti 17 August, 2019

avatar ChristoforosKor ChristoforosKor - open - 3 Aug 2019
avatar joomla-cms-bot joomla-cms-bot - change - 3 Aug 2019
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 3 Aug 2019
avatar franz-wohlkoenig franz-wohlkoenig - change - 3 Aug 2019
Labels Added: J4 Issue
avatar franz-wohlkoenig franz-wohlkoenig - labeled - 3 Aug 2019
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 4 Aug 2019

@wilsonge can you please comment?

avatar franz-wohlkoenig franz-wohlkoenig - change - 4 Aug 2019
Status New Information Required
avatar SharkyKZ
SharkyKZ - comment - 6 Aug 2019

Proposed solution returns incorrect results. We do need the slow query if we have a group clause. Maybe associations could be retrieved separately like in frontend. This would remove the group clause.

avatar richard67
richard67 - comment - 6 Aug 2019

@SharkyKZ which DB columns of which tables are in that group by clause? By making a combined index on these columns in DB we could speed up the query. @alikon Correct?

avatar SharkyKZ
SharkyKZ - comment - 6 Aug 2019

All columns of all tables

$associationsGroupBy = array(
'a.id',
'a.title',
'a.alias',
'a.checked_out',
'a.checked_out_time',
'a.state',
'a.access',
'a.created',
'a.created_by',
'a.created_by_alias',
'a.modified',
'a.ordering',
'a.featured',
'a.language',
'a.hits',
'a.publish_up',
'a.publish_down',
'a.catid',
'l.title',
'l.image',
'uc.name',
'ag.title',
'c.title',
'c.created_user_id',
'c.level',
'ua.name',
'ws.title',
'ws.workflow_id',
'ws.condition',
'wa.stage_id',
'parent.id',

avatar richard67
richard67 - comment - 6 Aug 2019

Omg! No, for this we should not make an index!

avatar Quy Quy - change - 6 Aug 2019
Title
[4.0] Many articles cause backend listing to stale
[4.0] Many articles cause backend listing to stall
avatar Quy Quy - edited - 6 Aug 2019
avatar alikon
alikon - comment - 6 Aug 2019

even if i haven't had the opportunity to test/explain a query with a so large dataset, and as already reported previously like #24536, we need to full redesign/rethink that kind of queries.... there is no index that can help us in this situation imho

avatar GCLW
GCLW - comment - 6 Aug 2019

I'm interested in knowing what size datasets are being used for 4.0 development. I have two News based sites that have article counts over 30K each, with one being drastically higher and it would be great to know.


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

avatar rdeutz
rdeutz - comment - 7 Aug 2019

We don't use large dataset in development for obvious reasons. My guess is that 99% of all Joomla sites have a article count less than 1000, so having a really big site needs more work and a bigger server and so on. I will not say we should not look into such issues and we should work to make in better and more perfomant but, hoenstly, this isn't a priority in development.

avatar GCLW
GCLW - comment - 7 Aug 2019

I'm sorry but I don't agree with your philosophy at all and I hope this is not how the entire team feels.


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

avatar Hackwar
Hackwar - comment - 7 Aug 2019

Sorry if that came across the wrong way. Of course performance for large sites is important for us, but at this point in time we are working more on making everything feature complete than to tweak performance. Performance (especially for large sites) will be a high priority as soon as we are feature complete.

Besides the focus of the developers, we also have an issue with our tooling. Large datasets for testing are sparse and while some have SQL files of large sites and I know that someone had a script to generate large sets of dummy data, but at least as far as I know, there is no official way to generate dummy testing data for a large site. No rocket science there, just again something that we have to get around to creating.

My personal guess would be, that we will work on performance improvements around the PBF in October. Maybe you want to help out then? ?

avatar richard67
richard67 - comment - 7 Aug 2019

For explanation of the previous comment by hackwar: "PBF" means "Pizza, bugs and Fun", see https://community.joomla.org/events/pizza-bugs-fun/3992-pizza-bugs-fun-2019-worldwide.html

avatar alikon
alikon - comment - 7 Aug 2019

bad performance = bad design, most of the times
or this is what i've learned in my experience

avatar ChristoforosKor
ChristoforosKor - comment - 11 Aug 2019

I'm interested in knowing what size datasets are being used for 4.0 development. I have two News based sites that have article counts over 30K each, with one being drastically higher and it would be great to know.

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

My databases holds about 160.000 articles with about 50.000 tags

I have updated my post and included a link to the database backup.

avatar ChristoforosKor
ChristoforosKor - comment - 11 Aug 2019

Proposed solution returns incorrect results. We do need the slow query if we have a group clause. Maybe associations could be retrieved separately like in frontend. This would remove the group clause.

I made very few test indeed but it did worked. If you provide me a scenario with wrong results I would like to give it a try.

avatar ChristoforosKor
ChristoforosKor - comment - 11 Aug 2019

I think that the articles listing is very crucial to have a good performance. After all is the cenrtal point for the cms content. I think it should not be left with generic function for caclulating total rows but make an override with better performance.
I am preparing an copy of the db with dummy data, but it is about 4G. I don't know if I can uploaded it here.

avatar ChristoforosKor ChristoforosKor - change - 11 Aug 2019
The description was changed
avatar ChristoforosKor ChristoforosKor - edited - 11 Aug 2019
avatar ChristoforosKor ChristoforosKor - change - 11 Aug 2019
The description was changed
avatar ChristoforosKor ChristoforosKor - edited - 11 Aug 2019
avatar ChristoforosKor
ChristoforosKor - comment - 11 Aug 2019

I have updated my post. I have included an wetransert link to recent database backup with dummy data.
No we can have a database with a large amount of articles.

avatar ChristoforosKor ChristoforosKor - change - 11 Aug 2019
The description was changed
avatar ChristoforosKor ChristoforosKor - edited - 11 Aug 2019
avatar ChristoforosKor ChristoforosKor - change - 11 Aug 2019
The description was changed
avatar ChristoforosKor ChristoforosKor - edited - 11 Aug 2019
avatar SharkyKZ
SharkyKZ - comment - 22 Sep 2019

If you provide me a scenario with wrong results I would like to give it a try.

No special scenario. Just look at the number of results returned. It's going to be higher than it should be. You can add this to the article list view layout to see exact number of results:

<?php echo $this->pagination->getResultsCounter(); ?>

I was unable to import your database due to issues with included 3rd party tables. But maybe you can test this and see if it makes any difference 4.0-dev...SharkyKZ:j4/query/articlesMultilang

avatar SharkyKZ
SharkyKZ - comment - 4 Oct 2019

@ChristoforosKor @GCLW Please test PR #26465.

avatar joomla-cms-bot joomla-cms-bot - change - 4 Oct 2019
Status Information Required Closed
Closed_Date 0000-00-00 00:00:00 2019-10-04 13:52:41
Closed_By joomla-cms-bot
avatar alikon alikon - change - 4 Oct 2019
Closed_By joomla-cms-bot alikon
avatar joomla-cms-bot joomla-cms-bot - close - 4 Oct 2019
avatar joomla-cms-bot
joomla-cms-bot - comment - 4 Oct 2019

Set to "closed" on behalf of @alikon by The JTracker Application at issues.joomla.org/joomla-cms/25770

Add a Comment

Login with GitHub to post a comment