Bug 1656371 - API requests with attributes work slow
Summary: API requests with attributes work slow
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Performance
Version: unspecified
Hardware: All
OS: Linux
medium
medium
Target Milestone: GA
: 5.11.0
Assignee: Nick LaMuro
QA Contact: Parthvi Vala
Red Hat CloudForms Documentation
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-12-05 11:07 UTC by abekasau
Modified: 2019-12-12 13:35 UTC (History)
8 users (show)

Fixed In Version: 5.11.0.2
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-12-12 13:34:53 UTC
Category: ---
Cloudforms Team: CFME Core
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:4199 0 None None None 2019-12-12 13:35:08 UTC

Description abekasau 2018-12-05 11:07:51 UTC
Description of problem:

Commit below highly slows down performance of API requests with attributes

https://github.com/ManageIQ/manageiq-api/commit/1845785bf7c3d7019df3c8002cff4c0cb9d33d36#diff-00bf332c6d31e69fa897ff19cd3e0bc5

E. g.:

This request is used by ui-service

api/services?expand=resources&limit=20&offset=0&attributes=picture%2Cpicture.image_href%2Cchargeback_report%2Cevm_owner.userid%2Cv_total_vms%2Cpower_state%2Call_service_children%2Ctags&filter[]=ancestry%3Dnull&sort_by=created_at&sort_options=&sort_order=desc

Rbac is called for each attribute for each service
8 attributes * 20 services (default limit is 20) = 160 rbac calls

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


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 3 Keenan Brock 2018-12-13 03:22:57 UTC
Even before the rbac was added, this report was also quite query intensive.
It has to do access of vms from services/service templates.


Looking into ways to reduce the number of queries.
We've had a number of attempts here in the past, so it may be difficult to get much improvement
Still looking into this

Comment 4 Keenan Brock 2019-01-03 18:08:14 UTC
Still looking at this.

Trying to find a way that each collection running through rbac does not cause multiple database queries.

Comment 11 Parthvi Vala 2019-06-14 14:45:54 UTC
FIXED. Verified on 5.11.0.8.

Query: 
GET api/services?expand=resources&limit=20&offset=0&attributes=picture%2Cpicture.image_href%2Cchargeback_report%2Cevm_owner.userid%2Cv_total_vms%2Cpower_state%2Call_service_children%2Ctags&filter[]=ancestry%3Dnull&sort_by=created_at&sort_options=&sort_order=desc

Of total 30 services, the request took about 4.32sec on 5.10.6 and 2.3sec on 5.11.0.8.

Comment 15 errata-xmlrpc 2019-12-12 13:34:53 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:4199


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