Bug #7259
closedRendering hosts/show.html.erb very slow (40s)
Description
Hi,
we are using foreman 1.5.2 on debian wheezy and a puppet interval of 5 Minutes,
so we get quiet a view reports.
When viewing a host via https://foreman.../hosts/node
foreman is burning CPU and it takes around 40 Seconds for the default range of
7 Days.
The Logfile shows something like that:
Started GET "/hosts/....?range=7" for ...
Processing by HostsController#show as HTML
Parameters: {"range"=>"7", "id" => "node5"}
Rendered hosts/_overview.html.erb (33.0ms)
Rendered hosts/_metrics.html.erb (0.2ms)
Rendered hosts/show.html.erb within layouts/application (40714.1ms)
...
Completed 200 OK in 41113.9 ms (Views: 40673.2ms | ActiveRecord: 86.6ms)
For above timing example there are "1978" reports found. However, I think
there is something wrong, if it takes this longs on a reasonable fast
machine to display. As said, while viewing this page, the foreman/Rack
process handling this request is burning 100% cpu, so the database seems
out of the question here.
Updated by Frank Wall over 10 years ago
I can confirm this issue. It's the same here running two instances of foreman (1.5.1 and 1.5.2) and the page loads slow for all "older" hosts (i.e. the ones with many reports).
Updated by Elodie B about 10 years ago
Same problem here with foreman 1.6.2. It is not very very slow but I have to wait at least 11s.
Processing by HostsController#show as HTML
Parameters: {"id"=>"hostname.domain"}
Rendered hosts/_overview.html.erb (9.6ms)
Rendered hosts/show.html.erb within layouts/application (11962.8ms)
Rendered home/_user_dropdown.html.erb (1.7ms)
Read fragment views/tabs_and_title_records-2 0.1ms
Rendered home/_topbar.html.erb (3.4ms)
Rendered layouts/base.html.erb (116.9ms)
Completed 200 OK in 12120.9ms (Views: 12071.6ms | ActiveRecord: 14.0ms)
Is there something we can do in our server to reduce this time ?
Updated by Ohad Levy about 10 years ago
- Is duplicate of Refactor #2232: Can we speed up loading of Host overview page. added
Updated by Ohad Levy about 10 years ago
- Status changed from New to Duplicate
this is fixed as part of 1.7, would be great if you can give 1.7RC1 a try.. thanks!
Updated by Andre Timmermann about 10 years ago
If someone can't update to 1.7 right now, deleting reports might be a workaround.
http://theforeman.org/manuals/1.6/index.html#3.5.4PuppetReports
Expire reports automatically You will probably want to delete your reports after some time to limit database growth. To do so, you can set a cronjob: Available conditions: days => number of days to keep reports (defaults to 7) status => status of the report (defaults to 0 --> "reports with no errors") Example: Expires all reports regardless of their status foreman-rake reports:expire days=7 expires all non interesting reports after one day foreman-rake reports:expire days=1 status=0
Without the reports the node-page takes 319.7ms instead of 22215.3ms