Project

General

Profile

Actions

Bug #14562

open

Host index listing takes a long while

Added by Ohad Levy about 8 years ago. Updated about 7 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Performance
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

I've noticed in my production server, that listing hosts takes a while, I've started investiagting, first, the logs:

2016-04-10T12:47:08 [app] [I] Completed 200 OK in 4034ms (Views: 878.4ms | ActiveRecord: 2776.9ms)

Seeing active record takes nearly 3 seconds, made me wonder, so enabling SQL debugging showed one sql query in particular:

2016-04-10T12:47:15 [sql] [D]    (2645.7ms)  SELECT MAX(`reports`.`id`) AS maximum_id, host_id AS host_id FROM `reports`  WHERE `reports`.`type` IN ('ConfigReport') AND `reports`.`host_id` IN (2035, 394, 1951, 1991, 194, 182, 2005, 84666, 84668, 1960, 179, 84680, 1993, 84686, 84672, 84681, 541) GROUP BY `reports`.`host_id`

which made we wonder, why do we need the to query the reports table at all? there are two report related info in the list:
1. link to report (under the last report column), however it always generate the hosts/host/config_reports/last) so in this case its not required.
2. the host config status - but afaik this was stored in a separate table and also we used to keep a bit based value in order to not query the large report table.

I would suggest we avoid doing any queries on the report table while listing the hosts, if we must, it should be async based not to block the entire page to render.


Related issues 1 (0 open1 closed)

Related to Foreman - Bug #18481: Host index listing takes a long whileClosedTimo Goebel02/13/2017Actions
Actions

Also available in: Atom PDF