Project

General

Profile

Actions

Bug #11837

closed

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

Added by Alex Balk over 9 years ago. Updated almost 9 years ago.

Status:
Closed
Priority:
Normal
Category:
Discovery plugin
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

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.


Files

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

Related issues 2 (0 open2 closed)

Related to Discovery - Bug #9023: Provide a way to add own fact to the discovered list of hostsClosedLukas Zapletal01/19/2015Actions
Related to Foreman - Bug #11884: Turbolinks load some pages twiceDuplicateActions
Actions #1

Updated by Dominic Cleal over 9 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.

Actions #2

Updated by Dominic Cleal over 9 years ago

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

Updated by Dominic Cleal over 9 years ago

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

Actions #4

Updated by Lukas Zapletal over 9 years ago

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

Updated by The Foreman Bot over 9 years ago

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

Updated by The Foreman Bot almost 9 years ago

  • Assignee set to Lukas Zapletal
Actions #7

Updated by Anonymous almost 9 years ago

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

Also available in: Atom PDF