Project

General

Profile

Actions

Bug #28723

closed

REX: /views/job_invocations consumes massive RAM and extremely slow for non-admin users

Added by SlickNetAaron please_edit_me almost 5 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
High
Assignee:
-
Category:
Foreman
Target version:
-
Difficulty:
Triaged:
No
Found in Releases:

Description

Please bare with me.. my first official bug report. Please let me know of issues!

Original report reference: https://community.theforeman.org/t/loading-job-invocations-extremely-slow-for-non-admin-users/16034

Problem: Listing and listing job invocations on Foreman gui as non-admin takes excessive RAM and user is painfully slow (20-90 seconds).

RAM use on the system goes from 7-8GB to 15GB+ and goes deep into the system's 4GB swap

Observed Endpoints:
/job_invocations
admin: 2-3 sec
non-admin: 4-6 sec

/job_invocations/[id]
admin: 3 sec
non-admin: 25-100 sec < Worst offender by far

template_invocations/[id]
admin: 3-4 sec
non-admin: 9 sec

Expected outcome: non-admin requests should be nearly as performant as a full admin

Foreman and Proxy versions: 1.23.0 and 1.23.1

Foreman Remote Execution version: 1.8.2

Distribution and version: CentOS 7.7.1908

Other relevant data:

CPU usage for passenger process goes to ~100% for the duration of the request (Passenger RackApp: /usr/share/foreman )
only 105 hosts in the Foreman system
16GB RAM and 2 vCPU - low utilization normally

This seems similar to Bug #19742: API call for fact_values is slow when user is non-admin , Foreman 1.15.0 - Foreman, just with Job Invocations instead of facts.

Note: We also had to disable batching due to Bug #28095 , which I suspect may be compounding the issue: Remote Execution job runs the command on all servers simultaneously, even when set to distribute over X seconds

I have debug logging and permissions logging enabled. I couldn’t find anything useful except to note that the rendered requests really did take a very long time.
e.g.

Completed 200 OK in 32792ms (Views: 31735.4ms | ActiveRecord: 961.6ms)
Completed 200 OK in 55735ms (Views: 47333.0ms | ActiveRecord: 7576.2ms)
Completed 200 OK in 42509ms (Views: 37509.6ms | ActiveRecord: 4392.4ms)
Completed 200 OK in 23215ms (Views: 22198.0ms | ActiveRecord: 923.7ms)

The most recent event I dug into had severe timings:

2020-01-10T04:59:17 [I|app|20099029]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.8.2/app/views/template_invocations/show.html.erb within layouts/application (81972.3ms)
2020-01-10T04:59:16 [I|app|d3971957]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.8.2/app/views/template_invocations/show.html.erb within layouts/application (83887.9ms)
2020-01-10T04:59:15 [I|app|69267482]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.8.2/app/views/template_invocations/show.html.erb within layouts/application (84842.5ms)
2020-01-10T04:59:05 [I|app|2aec0912]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.8.2/app/views/template_invocations/show.html.erb within layouts/application (78597.8ms)
2020-01-10T04:57:15 [I|app|3f3de6df]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.8.2/app/views/template_invocations/show.html.erb within layouts/application (94779.2ms)
2020-01-10T04:57:15 [I|app|62be3656]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.8.2/app/views/template_invocations/show.html.erb within layouts/application (92773.5ms)
2020-01-10T04:57:12 [I|app|a5da604d]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.8.2/app/views/template_invocations/show.html.erb within layouts/application (94065.5ms)
2020-01-10T04:57:10 [I|app|c3f699ce]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.8.2/app/views/template_invocations/show.html.erb within layouts/application (92016.9ms)
2020-01-10T04:57:02 [I|app|431f304e]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.8.2/app/views/template_invocations/show.html.erb within layouts/application (89568.3ms)
2020-01-10T04:54:58 [I|app|1c4321b5]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.8.2/app/views/template_invocations/show.html.erb within layouts/application (87785.9ms)
2020-01-10T04:54:58 [I|app|edf85e53]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.8.2/app/views/template_invocations/show.html.erb within layouts/application (93964.0ms)
2020-01-10T04:54:57 [I|app|f026c7ca]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.8.2/app/views/template_invocations/show.html.erb within layouts/application (95719.9ms)
2020-01-10T04:54:57 [I|app|bd03307c]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.8.2/app/views/template_invocations/show.html.erb within layouts/application (91968.9ms)
2020-01-10T04:54:42 [I|app|404bd02d]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.8.2/app/views/template_invocations/show.html.erb within layouts/application (81909.5ms)
2020-01-10T04:51:39 [I|app|30fe9753]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.8.2/app/views/template_invocations/show.html.erb within layouts/application (35361.5ms)
2020-01-10T04:51:35 [I|app|4f739e84]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.8.2/app/views/template_invocations/show.html.erb within layouts/application (33960.5ms)
2020-01-10T04:48:19 [I|app|da0c6a34]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.8.2/app/views/template_invocations/show.html.erb within layouts/application (65648.0ms)
2020-01-10T04:48:16 [I|app|ffe015e5]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.8.2/app/views/template_invocations/show.html.erb within layouts/application (60804.2ms)
2020-01-10T04:48:16 [I|app|ff20e799]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.8.2/app/views/template_invocations/show.html.erb within layouts/application (68352.7ms)
2020-01-10T04:48:01 [I|app|e1ed1819]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.8.2/app/views/template_invocations/show.html.erb within layouts/application (63092.3ms)
2020-01-10T04:47:15 [I|app|b70a360e]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.8.2/app/views/template_invocations/show.html.erb within layouts/application (35297.0ms)
2020-01-10T04:43:40 [I|app|8dc1b6f8]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.8.2/app/views/job_invocations/show.html.erb within layouts/application (378909.1ms)
2020-01-10T04:40:40 [I|app|4e340aca]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.8.2/app/views/job_invocations/show.html.erb within layouts/application (201886.4ms)
2020-01-10T04:36:29 [I|app|9857093b]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.8.2/app/views/job_invocations/index.html.erb within layouts/application (2036.4ms)
2020-01-10T04:36:26 [I|app|72aa498e]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.8.2/app/views/job_invocations/index.html.erb within layouts/application (2156.0ms)

Also attaching production.log for the hour of the event

Cheers!
Aaron


Files

production-0400.log production-0400.log 2.81 MB SlickNetAaron please_edit_me, 01/10/2020 08:03 PM
Actions #1

Updated by SlickNetAaron please_edit_me almost 5 years ago

  • Subject changed from Loading Job and Template Invocations consumes massive RAM and extremely for non-admin users to Loading Job and Template Invocations consumes massive RAM and extremely slow for non-admin users
Actions #2

Updated by SlickNetAaron please_edit_me almost 5 years ago

  • Description updated (diff)
Actions #3

Updated by SlickNetAaron please_edit_me almost 5 years ago

  • Priority changed from Normal to High

bumping this up to high as it's causing services to crash almost daily

Actions #4

Updated by SlickNetAaron please_edit_me almost 5 years ago

New development:

This issue was getting worse and worse. This morning it took 20 minutes+ to display the Job Invocations page for my NOC.

I brought in a Ruby guy to help troubleshoot... After enabling debug logging, we found one template was taking 30 seconds. He commented out a single bit that renders Host Actions. This restored performance, at the expense of losing Host Actions buttons. I hope this info allows for a comprehensive fix:

/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.8.2/app/views/job_invocations
commented out partial template called

<%= render 'host_actions_td', options %>

Actions #5

Updated by SlickNetAaron please_edit_me over 4 years ago

  • Subject changed from Loading Job and Template Invocations consumes massive RAM and extremely slow for non-admin users to REX: /views/job_invocations consumes massive RAM and extremely slow for non-admin users
Actions #6

Updated by The Foreman Bot over 4 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman_remote_execution/pull/493 added
Actions #7

Updated by The Foreman Bot over 4 years ago

  • Fixed in Releases foreman_remote_execution 3.3.2 added
Actions #8

Updated by Leos Stejskal over 4 years ago

  • Status changed from Ready For Testing to Closed
Actions

Also available in: Atom PDF