Bug 1352526 - Concurrent contentview publish cause high memory usage of mongodb & Ruby
Summary: Concurrent contentview publish cause high memory usage of mongodb & Ruby
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Content Views
Version: 6.2.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: Unspecified
Assignee: John Mitsch
QA Contact:
URL: http://projects.theforeman.org/issues...
Whiteboard:
Depends On: 1368103
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-07-04 09:48 UTC by Pradeep Kumar Surisetty
Modified: 2021-04-06 18:00 UTC (History)
18 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-09-04 17:44:37 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
mongodb usage (57.65 KB, image/png)
2016-07-04 09:48 UTC, Pradeep Kumar Surisetty
no flags Details
ruby mem usage (63.64 KB, image/png)
2016-07-04 09:48 UTC, Pradeep Kumar Surisetty
no flags Details
ruby mem usage while concurent registration of 290 hosts (78.38 KB, image/png)
2016-07-22 06:30 UTC, Pradeep Kumar Surisetty
no flags Details
The increase in Dynflow memory during the publishing of 10 CVs (34.82 KB, image/png)
2017-09-17 03:45 UTC, sbadhwar
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 16181 0 High New Concurrent contentview publish cause high memory usage of mongodb & Ruby 2020-08-28 03:30:26 UTC
Pulp Redmine 1716 0 Normal CLOSED - CURRENTRELEASE As a user, I can have better memory performance on Publish by using SAX instead of etree for comps and updateinfo XML pr... 2016-07-12 20:31:27 UTC
Red Hat Bugzilla 1362168 0 high CLOSED Memory leak in several processes (mainly dynflow_executor) when (un)installing a package in loop 2024-03-25 14:56:55 UTC

Internal Links: 1362168

Description Pradeep Kumar Surisetty 2016-07-04 09:48:12 UTC
Created attachment 1175926 [details]
mongodb usage

Description of problem:


Created 10 content views added 5 repos ( rhel7 x86_64, rhel6 x86_64, rhel 6 i386, rhel5 x86_64, rhel 5 i386) to all of them.  Published all of them concurrently.  It cause huge spikes in memory usage of mongodb, ruby 

mongodb:  9G
ruby: 6G

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. Created 10 content views added 5 repos ( rhel7 x86_64, rhel6 x86_64, rhel 6 i386, rhel5 x86_64, rhel 5 i386).
2.
3.

Actual results:



Expected results:


Additional info:

Comment 1 Pradeep Kumar Surisetty 2016-07-04 09:48:37 UTC
Created attachment 1175927 [details]
ruby mem usage

Comment 2 Pradeep Kumar Surisetty 2016-07-04 09:49:40 UTC
Noticed high cpu usage from pgsql too

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                          
22448 postgres  20   0  275260  82456  38584 R  97.7  0.2   3:52.81 postgres                                         
23557 postgres  20   0  285144  91440  38240 R  97.7  0.2   4:16.66 postgres                                         
 6381 postgres  20   0  280892  87268  38524 R  97.0  0.2   4:09.29 postgres

Comment 3 Pradeep Kumar Surisetty 2016-07-04 12:16:04 UTC
Mongodb is growing very fast for every next version.
5 iterations reached 18G of mongodb mem usage.

Comment 4 Chris Duryee 2016-07-05 12:17:31 UTC
It can be difficult to get an accurate read of mongo's memory usage (http://blog.mongodb.org/post/101911655/mongo-db-memory-usage). I'm not sure if the mongo behavior you see is an issue or not.

The ruby memory may be an issue, is that from the foreman-tasks process?

Also, was postgres slow query logging enabled? If so, did any queries stand out?

Comment 6 Pradeep Kumar Surisetty 2016-07-05 17:12:30 UTC
(In reply to Chris Duryee from comment #4)
> It can be difficult to get an accurate read of mongo's memory usage
> (http://blog.mongodb.org/post/101911655/mongo-db-memory-usage). I'm not sure
> if the mongo behavior you see is an issue or not.
> 
> The ruby memory may be an issue, is that from the foreman-tasks process?
> 

Yes. foreman tasks

> Also, was postgres slow query logging enabled? If so, did any queries stand
> out?


2016-07-05 13:06:11 EDT LOG:  duration: 179.050 ms  execute <unnamed>: SELECT COUNT(*) FROM "katello_errata" INNER JOIN katello_erratum_packages on katello_erratum_packages.erratum_id = katello_errata.id INNER JOIN katello_repository_errata on katello_repository_errata.erratum_id = katello_errata.id INNER JOIN katello_rpms on katello_rpms.filename = katello_erratum_packages.filename INNER JOIN katello_repository_rpms on katello_repository_rpms.rpm_id = katello_rpms.id WHERE "katello_repository_rpms"."repository_id" = 50 AND "katello_repository_errata"."repository_id" = 50
2016-07-05 13:06:11 EDT LOG:  duration: 167.819 ms  execute <unnamed>: SELECT katello_errata.id FROM "katello_errata" INNER JOIN katello_erratum_packages on katello_erratum_packages.erratum_id = katello_errata.id INNER JOIN katello_repository_errata on katello_repository_errata.erratum_id = katello_errata.id INNER JOIN katello_rpms on katello_rpms.filename = katello_erratum_packages.filename INNER JOIN katello_repository_rpms on katello_repository_rpms.rpm_id = katello_rpms.id WHERE "katello_repository_rpms"."repository_id" = 50 AND "katello_repository_errata"."repository_id" = 50


cpu usage of pgsql process. 

10686 postgres  20   0  269380  76404  38564 R 100.0  0.2   4:25.69 postgres                                   
19150 postgres  20   0  280796  84724  38536 R  98.7  0.2   3:50.12 postgres                                   
20833 postgres  20   0  269172  73780  38384 S  97.3  0.1   4:06.80 postgres  

I

Comment 7 Brad Buckingham 2016-07-05 17:39:07 UTC
Hi Pradeep, you may want to create a separate bug to track mongo vs ruby, since they will involve different solutions.

Comment 9 Michael Hrivnak 2016-07-06 16:48:23 UTC
I'm not sure what to file upstream. MongoDB will use as much RAM as it can get its hands on for caching, but as the link Chris shared points out, it is relatively friendly about relinquishing that RAM.

The one area pulp does have control of, that may have exacerbated the problem seen, is a known inefficiency during publish of lots of errata. That's fixed upstream in pulp 2.9 by using a different XML library.

https://pulp.plan.io/issues/1716

Otherwise, getting off of MongoDB is the best solution. ;)

Comment 10 Brad Buckingham 2016-07-06 17:08:29 UTC
Michael, that is a totally valid and fair assessment.  Thanks! I will switch the component on this back to content views to see if there is anything on the ruby side.

Comment 11 pulp-infra@redhat.com 2016-07-06 17:30:51 UTC
The Pulp upstream bug status is at MODIFIED. Updating the external tracker on this bug.

Comment 12 pulp-infra@redhat.com 2016-07-06 17:30:53 UTC
The Pulp upstream bug priority is at Normal. Updating the external tracker on this bug.

Comment 13 pulp-infra@redhat.com 2016-07-12 20:31:28 UTC
The Pulp upstream bug status is at CLOSED - CURRENTRELEASE. Updating the external tracker on this bug.

Comment 14 Pradeep Kumar Surisetty 2016-07-22 06:29:34 UTC
Looks like ruby is culprit. 
We were trying concurrent registration of 290 hosts with increased passenger queue, pgsql max connections. 

Ruby is using close to 9G of mem

Comment 15 Pradeep Kumar Surisetty 2016-07-22 06:30:18 UTC
Created attachment 1182716 [details]
ruby mem usage while concurent registration of 290 hosts

Comment 17 John Mitsch 2016-08-18 18:46:22 UTC
Created redmine issue http://projects.theforeman.org/issues/16181 from this bug

Comment 18 John Mitsch 2016-08-26 19:17:36 UTC
Unfortunately there is not much we can do at this moment for Content View publishes to make them less resource-intensive.

Dynflow does not allow for global throttling limits currently, so if trying to run many different tasks at the same time, this will eat up resources. There are discussions about adding these global throttling limits which will solve this problem.

For anything that is a Bulk Action in Dynflow, we can make use of a concurrency limit that is built in to Dynflow. So for one task that has many concurrent actions, they will be limited to run only X at at time. Content View publishes are not Bulk Actions.

There is an open upstream issue to add the limit to Bulk Actions to katello which will help some the Bulk Actions tasks with memory usage: http://projects.theforeman.org/issues/16336

We will continue to look at any improvements we can make to the individual task's memory usage.

Comment 19 Jan Hutař 2016-08-29 07:22:27 UTC
I see. So we basically depends on bug 1368103 now. Thank you for explanation!

Comment 24 sbadhwar 2017-09-17 03:45:47 UTC
Created attachment 1326898 [details]
The increase in Dynflow memory during the publishing of 10 CVs

Comment 33 Bryan Kearney 2018-09-04 17:44:37 UTC
Thank you for your interest in Satellite 6. We have evaluated this request, and we do not expect this to be implemented in the product in the foreseeable future. We are therefore closing this out as WONTFIX. If you have any concerns about this, please feel free to contact Rich Jerrido or Bryan Kearney. Thank you.


Note You need to log in before you can comment on or make changes to this bug.