Project

General

Profile

Bug #11834

host status migration is very slow

Added by Ohad Levy almost 4 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
DB migrations
Target version:
Difficulty:
Triaged:
Bugzilla link:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

On a largish db, calculating the host status takes a whole lot of time.

it seems that many queries are repeating them selfs are simply could be eager loaded for the migration.


Related issues

Related to Foreman - Feature #10782: Add global status for hostsClosed2015-06-11

Associated revisions

Revision 553665c2 (diff)
Added by Marek Hulán over 3 years ago

Fixes #11834 - improve host status migration performance

Revision 7922ad2f (diff)
Added by Marek Hulán over 3 years ago

Fixes #11834 - improve host status migration performance

(cherry picked from commit 553665c2a458b949d85c45aac9fea33271a2a9a0)

History

#1 Updated by Ohad Levy almost 4 years ago

#2 Updated by Dominic Cleal almost 4 years ago

  • Assignee deleted (Marek Hulán)
  • Legacy Backlogs Release (now unused) set to 63

Can you provide some logs to show which queries?

#3 Updated by Ohad Levy almost 4 years ago

  1. we do host.each, not sure if we can avoid it, but we could try to loop in batches and load associated data.
  2. the status calculation is done per host, which might not be avoidable, but I would like to see if we can wrap it in a host collection instead of a single host to avoid many n+1 queries.

#4 Updated by The Foreman Bot almost 4 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/2860 added
  • Pull request deleted ()

#5 Updated by Marek Hulán almost 4 years ago

I tried to fix some (n+1) queries and do the processing in batches (batch size didn't seem to have much effect), I don't see any major improvement. On the other hand, my DB is quite small.

#6 Updated by Dominic Cleal over 3 years ago

  • Assignee set to Marek Hulán
  • Legacy Backlogs Release (now unused) changed from 63 to 104

#7 Updated by Marek Hulán over 3 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF