No Code Attached Yet bug
avatar trananhmanh89
trananhmanh89
7 Nov 2023

Steps to reproduce the issue

  1. Utilize a VPS with 4 GB of RAM and 2 CPU Cores.
  2. Create a website with approximately 20,000 articles.
  3. Add several Articles - Category modules to the frontend.
  4. You can access my backup here https://drive.google.com/file/d/1TUBXrxGEbKNKjaakbk4YfLGgnWxN_wEq/view?usp=sharing

Expected result

  • Article listing page speed should be fine
  • Home page speed should be fine

Actual result

  • It takes around 10 seconds to load the article listing in the backend.
  • Loading the website's homepage takes approximately 20 seconds.

System information (as much as possible)

  • Hawkhost vps 4G Ram, 2 CPU Cores

Additional comments

  • The performance issue is mainly due to selecting too many fields in the listing query, especially introtext and fulltext.
  • After modifying the query to select only the id field, the speed significantly increased.
  • While upgrading the server is an option, I believe Joomla can be optimized further to address this performance concern.
avatar trananhmanh89 trananhmanh89 - open - 7 Nov 2023
avatar joomla-cms-bot joomla-cms-bot - change - 7 Nov 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 7 Nov 2023
avatar trananhmanh89 trananhmanh89 - change - 7 Nov 2023
The description was changed
avatar trananhmanh89 trananhmanh89 - edited - 7 Nov 2023
avatar richard67
richard67 - comment - 11 Nov 2023

The fulltext column had once been added with PR #28384 .

avatar trananhmanh89
trananhmanh89 - comment - 11 Nov 2023

The fulltext column had once been added with PR #28384 .

I see, but not only the backend, the frontend is slow too.

avatar mavrosxristoforos
mavrosxristoforos - comment - 21 Dec 2023

I just unpacked your backup on my localhost. I know it's not a web server with limitations, but I just wanted to share my results:
Homepage: 225ms average loading time
Back-end articles page with 20 items: 1.10s average loading time

Is it possible that anything else on your configuration may be slowing it down?

avatar mavrosxristoforos
mavrosxristoforos - comment - 21 Dec 2023

I found your test component, so I ran it to add a few more articles. I let it add just over 50 articles. Interestingly enough, the homepage loading time went up to ~2.5s. I deleted them, but the homepage is still slow now.

avatar trananhmanh89
trananhmanh89 - comment - 21 Dec 2023

With a sufficiently powerful PC, for example, with a Core i5 12th generation, M.2 SSD, and 16GB of RAM, the performance will be satisfactory after several refreshes (F5). This implies that you would need to invest in a VPS costing at least $40 per month to achieve relatively smooth performance with 20,000 articles. However, I don't consider this to be an ideal solution.

And this is the result on my live site, hawkhost vps 8Gb ram, 4 core (8GB LAX package).

image

avatar mavrosxristoforos
mavrosxristoforos - comment - 21 Dec 2023

What happens if you make a backup of your live site and try on localhost? Is the loading time the same?
What I'm trying to figure out here is why did it load well for me when I downloaded your backup and why doesn't it now.

In my case, the three queries that take up most of the loading time are three consecutive queries to the #__content with a lot of columns on BaseDatabaseModel.php:164. They take 900ms, 770ms and 770ms.

avatar trananhmanh89
trananhmanh89 - comment - 21 Dec 2023

What happens if you make a backup of your live site and try on localhost? Is the loading time the same? What I'm trying to figure out here is why did it load well for me when I downloaded your backup and why doesn't it now.

This might because mysql cache your query result on ram. But sometimes it does, sometimes not.
And at my local, the backend article list gets even more time to load, it takes 8s.

In my case, the three queries that take up most of the loading time are three consecutive queries to the #__content with a lot of columns on BaseDatabaseModel.php:164. They take 900ms, 770ms and 770ms.

You can comment out these code on file administrator\components\com_content\src\Model\ArticlesModel.php to get better speed.
image

avatar mavrosxristoforos
mavrosxristoforos - comment - 21 Dec 2023

This might because mysql cache your query result on ram. But sometimes it does, sometimes not. And at my local, the backend article list gets even more time to load, it takes 8s to load.

Yup, that was it. After restarting MySQL, I have a homepage with 225ms loading time.

I added some articles using your test component, again. Homepage > 2.5s. Restart MySQL server > 225ms.

avatar mavrosxristoforos
mavrosxristoforos - comment - 21 Dec 2023

You can comment out these code on file administrator\components\com_content\src\Model\ArticlesModel.php to get better speed.

Commenting the lines you mentioned drops the back-end loading time from 1.25s to 450ms and does not seem to affect the functionality otherwise.

The content: search functionality still works, and a simple search for introtext and fulltext in the back-end reveals no further uses of these columns in the list view, as far as I can tell. I would suggest you make a PR so that others can check as well.

avatar trananhmanh89
trananhmanh89 - comment - 21 Dec 2023

@mavrosxristoforos those code was added since 4.0. I think we have to check carefully before making any PR

8d436f8
cf9f0fd

avatar mavrosxristoforos
mavrosxristoforos - comment - 21 Dec 2023

That is correct.
I'm thinking now that despite the fact that the articles listing back-end doesn't use these two columns directly in the list view, any extension that loads articles using the ArticlesModel will probably require them.

avatar Hackwar Hackwar - change - 26 Mar 2024
Labels Added: bug
avatar Hackwar Hackwar - labeled - 26 Mar 2024

Add a Comment

Login with GitHub to post a comment