Angular policy checks causing too many API calls - slows down pages

Bug #1551815 reported by Travis Tripp
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Medium
Travis Tripp

Bug Description

On Angular panels that use client side routing and also have policy checks (just about any angular panel with actions), you'll see that the exact same policy API check is repeated when you switch from the table listing to the details and back.

Example:

http://127.0.0.1:8005/project/ngimages/

[01/Mar/2016 15:40:53] "POST /api/policy/ HTTP/1.1" 200 17
[01/Mar/2016 15:40:53] "POST /api/policy/ HTTP/1.1" 200 17
[01/Mar/2016 15:40:53] "POST /api/policy/ HTTP/1.1" 200 17
[01/Mar/2016 15:40:53] "GET /api/keystone/user-session/ HTTP/1.1" 200 383
[01/Mar/2016 15:40:53] "GET /api/keystone/svc-catalog/ HTTP/1.1" 200 7404
[01/Mar/2016 15:40:53] "POST /api/policy/ HTTP/1.1" 200 17

Go to the details page:

[01/Mar/2016 15:41:07] "GET /api/glance/images/2c23ae8e-f7bb-4239-9a94-e011a9b636fc/ HTTP/1.1" 200 429

Click back to the Table:

[01/Mar/2016 15:41:15] "POST /api/policy/ HTTP/1.1" 200 17
[01/Mar/2016 15:41:15] "POST /api/policy/ HTTP/1.1" 200 17
[01/Mar/2016 15:41:15] "POST /api/policy/ HTTP/1.1" 200 17
[01/Mar/2016 15:41:15] "POST /api/policy/ HTTP/1.1" 200 17

The policy being checked will not change between these clicks. These checks are using the policy service:

https://github.com/openstack/horizon/blob/master/openstack_dashboard/static/app/core/openstack-service-api/policy.service.js#L105

This service doesn't have caching like the other services (User session, service catalog, cinder extensions), causing many extra API hits as the page is navigated.

Revision history for this message
Travis Tripp (travis-tripp) wrote :
Changed in horizon:
assignee: nobody → Travis Tripp (travis-tripp)
milestone: none → mitaka-3
Changed in horizon:
status: New → In Progress
Changed in horizon:
assignee: Travis Tripp (travis-tripp) → Matt Borland (palecrow)
Changed in horizon:
assignee: Matt Borland (palecrow) → Travis Tripp (travis-tripp)
Changed in horizon:
assignee: Travis Tripp (travis-tripp) → Matt Borland (palecrow)
David Lyle (david-lyle)
Changed in horizon:
importance: Undecided → Medium
Changed in horizon:
milestone: mitaka-3 → mitaka-rc1
summary: - Angular policy checks repeated
+ Angular policy checks causing too many API calls - slows down pages
Changed in horizon:
assignee: Matt Borland (palecrow) → Travis Tripp (travis-tripp)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/286268
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=6c2eaff49924cef767f0dd6fddff700bccc37838
Submitter: Jenkins
Branch: master

commit 6c2eaff49924cef767f0dd6fddff700bccc37838
Author: Travis Tripp <email address hidden>
Date: Mon Feb 29 13:35:59 2016 -0700

    Angular Policy Caching

    With angular routing, every time a view / page is shown, any
    policy checks are performed again. Policy decisions are fairly
    static and should not change as long as the inputs are the same.

    This patch makes it so that the results are cached until
    a django page reload is triggered (such as when region, user,
    project, panel are changed).

    Change-Id: Ib8c133f680a7bf0357c26263fb26bb76eb13d65a
    Closes-Bug: 1551815
    Co-Authored-By: Matt Borland <email address hidden>

Changed in horizon:
status: In Progress → Fix Released
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/horizon 9.0.0.0rc1

This issue was fixed in the openstack/horizon 9.0.0.0rc1 release candidate.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.