Content View list takes too long

Hmm, not really sure :sweat_smile:
When I did the changes the second time - after “complaining” about the Not yet published messages the only difference I saw was on file app/controllers/katello/api/v2/content_views_controller.rb which I reverted.
All the other files already looked correct.

  • app/models/katello/content_view.rb +21
   has_one :latest_version_object, -> { latest }, :class_name => "Katello::ContentViewVersion", :dependent => :destroy
  • app/models/katello/content_view_version.rb +69
    scope :latest, -> { order('major DESC', 'minor DESC').limit(1) }

Did I miss something?

No, this should be enough. This will reduce the amount of sql queries enormously.

Now that Fixes #37109 - allow to use eager loading on latest_version_object by sbernhard · Pull Request #10865 · Katello/katello · GitHub is merged, I’d love to get some more feedback from the folks who were having the extreme slowness issues. Does this speed things up, and how much? The fix should be in current nightlies and also in 4.12 RC1 which is coming next week, or if you’re adventurous feel free to apply the patch yourself :wink:

2 Likes

Hello @jeremylenz

We’re already using the patch - manually applied, for some time now.
As I said here it solves the slowness issues.
The only downside is that on the list on the Content Views on the Last version column we get the message Not yet published for all the non composite CVs. But we can live with that :grinning:

I think you are using a version of the PR which introduces a new bug. This should be fixed in the final PR but this will be slower again.

Yes, I haven’t seen this “not yet published issue” myself. If others are seeing that too, please let us know.

Hello,

I think @Bernhard_Suttner is right, I was still using an older patch…
So, i just rollback everything - dnf reinstall rubygem-katello-4.11.0-1.el8.noarch, and applied the changes on this pull request:

After this, listing content views with hammer timeout after 4 minutes and using the interface it takes almost 6 minutes to finish loading the page. The listing includes the correct latest version.

So it’s slow again… I’ll have to find out which change made this fast and applied it again.

I hope you know you can add .patch to a PR. https://github.com/Katello/katello/pull/10865.patch will redirect you to https://patch-diff.githubusercontent.com/raw/Katello/katello/pull/10865.patch. So you can use curl --location https://github.com/Katello/katello/pull/10865.patch | patch -p1 && systemctl restart foreman in the right directory.

It would be interesting to see the EXPLAIN query. It could very well be that the database somehow doesn’t use the index that should exist (https://github.com/Katello/katello/blob/master/db/migrate/20180806205420_add_index_to_content_view_version.rb) and resorts to a full table scan.

Hello @ekohl

No i did not know about the patch url, that will come in handy :slight_smile:

To ensure i properly applied the patch I reverted everything and applied it using that command.
I still got the timeout using hammer and the usual slowness on the web interface - but the latest version has proper info.

I tried to find out which changes made everything really fast but they are no longer available - probably some git rebase is to blame.

Another patch to try, courtesy of @sajha :slight_smile:

1 Like

Hello @jeremylenz and @sajha

Just applied this patch, listing CVs now take less than 5 seconds using hammer and less than 10 seconds using the web interface.
Thank you all for the effort in restoring the performance.

4 Likes