Project

General

Profile

Bug #11837

Serching for "facts.blah" in discovery takes a long time

Added by Alex Balk over 7 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
Normal
Category:
Discovery plugin
Difficulty:
Triaged:
No
Bugzilla link:
Fixed in Releases:
Found in Releases:
Red Hat JIRA:

Description

Attached is the debug log of a sample query (facts.site = chidc2). It's possible that there's missing indexes in the facts table. In this case the DB is PG, but we've also tried mysql with similar results.

production.log production.log 91 KB Alex Balk, 09/15/2015 04:51 PM

Related issues

Related to Discovery - Bug #9023: Provide a way to add own fact to the discovered list of hostsClosed2015-01-19
Related to Foreman - Bug #11884: Turbolinks load some pages twiceDuplicate

Associated revisions

Revision c3b1b2cb (diff)
Added by Lukas Zapletal about 7 years ago

Fixes #11837 - optimized fact loading on index

History

#1 Updated by Dominic Cleal over 7 years ago

  • Project changed from Foreman to Discovery
  • Category set to Discovery plugin

Looks like the initial search is actually fast, but needlessly run twice:

2015-09-15T14:16:43 [sql] [D]    (163.0ms)  SELECT COUNT(*) FROM "hosts" INNER JOIN "fact_values" fact_values_579987 ON (hosts.id = fact_values_579987.host_id)
 |  INNER JOIN "fact_names" fact_names_579987 ON (fact_names_579987.id = fact_values_579987.fact_name_id) WHERE "hosts"."type" IN ('Host::Discovered') AND ((fact_names_579987."name" = 'site') AND ("hosts"."id" IN (SELECT "host_id" FROM "fact_values" WHERE "fact_values_579987"."value" = 'chidc2' )))
2015-09-15T14:16:43 [sql] [D]   CACHE (0.0ms)  SELECT COUNT(*) FROM "hosts" INNER JOIN "fact_values" fact_values_579987 ON (hosts.id = fact_values_579987.host_id)
 |  INNER JOIN "fact_names" fact_names_579987 ON (fact_names_579987.id = fact_values_579987.fact_name_id) WHERE "hosts"."type" IN ('Host::Discovered') AND ((fact_names_579987."name" = 'site') AND ("hosts"."id" IN (SELECT "host_id" FROM "fact_values" WHERE "fact_values_579987"."value" = 'chidc2' )))

The rest looks like a very inefficient rendering of the host list, where it appears to be retrieving the list of facts for every host separately by calling .facts_hash, without preloading the necessary data.

#2 Updated by Dominic Cleal over 7 years ago

  • Related to Bug #9023: Provide a way to add own fact to the discovered list of hosts added

#3 Updated by Dominic Cleal over 7 years ago

Appears to have been added in #9023, without any optimisation.

#4 Updated by Lukas Zapletal over 7 years ago

  • Related to Bug #11884: Turbolinks load some pages twice added

#5 Updated by The Foreman Bot over 7 years ago

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

#6 Updated by The Foreman Bot about 7 years ago

  • Assignee set to Lukas Zapletal

#7 Updated by Anonymous about 7 years ago

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

Also available in: Atom PDF