"Select N+1" issue in catalog's SQL backend

Bug #1206725 reported by Roman Verchikov
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Fix Released
Medium
Roman Verchikov

Bug Description

DESCRIPTION

SQL backend for keystone catalog has classic select n+1 issue in get_catalog() and get_v3_catalog() methods (for each endpoint get service). Even though the number of endpoints and services is usually not very high, given methods are executed on each authenticate request, which impacts performance of each openstack service regardless of keystone identity backend used.

FILES
keystone/catalog/backends/sql.py

EXPECTED BEHAVIOR
Single "select ... join" SQL statement generated

ACTUAL BEHAVIOR
N+1 select statements generated, where N is the number of endpoints.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to keystone (master)

Fix proposed to branch: master
Review: https://review.openstack.org/39386

Changed in keystone:
assignee: nobody → Roman Verchikov (rverchikov)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to keystone (master)

Reviewed: https://review.openstack.org/39386
Committed: http://github.com/openstack/keystone/commit/b920d15b01b21831999030b0becbc1da988ee638
Submitter: Jenkins
Branch: master

commit b920d15b01b21831999030b0becbc1da988ee638
Author: Roman Verchikov <email address hidden>
Date: Wed Aug 7 14:56:24 2013 -0700

    Fix select n+1 issue in keystone catalog

    keystone.catalog.backends.sql.get_catalog() and get_v3_catalog() methods
    generate N+1 select statements for each endpoint. Use sqlalchemy's
    eager load to generate single select statement instead of generating N+1
    select statents for each endpoint.

    Given change does not modify DB schema and is runtime-only, since it's a
    one-to-many relationship.

    Change-Id: Ia72b8603fc13f01696771f6116b320364bd50f51
    Fixes: bug #1206725

Changed in keystone:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in keystone:
milestone: none → havana-3
status: Fix Committed → Fix Released
Dolph Mathews (dolph)
Changed in keystone:
importance: Undecided → Medium
Thierry Carrez (ttx)
Changed in keystone:
milestone: havana-3 → 2013.2
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.