openstackclient is really slow

Bug #1431649 reported by Joe Gordon
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
python-keystoneclient
Fix Released
Low
Robert Collins
python-openstackclient
Fix Released
Low
Dean Troyer

Bug Description

$ time openstack user
ERROR: openstack Unknown command ['user']

real 0m1.324s
user 0m0.391s
sys 0m0.517s

$ time openstack user list
+----------------------------------+----------+
| ID | Name |
+----------------------------------+----------+
| 7718d751518e484aaffb59d974ca5da7 | cinder |
| 9141087593634d6b99fd46f3f060b3ee | demo |
| 919408d5fc21467abaa8633e7c5fabe6 | heat |
| d3dac348cd51489aaf3954a13543d81b | glance |
| e0914637d4cd43198ebd590527f51198 | alt_demo |
| f58667e7eeb546f298903ba6a4d3cfd2 | nova |
| fc5bbb2c91474f7ba108e05bf49c0473 | admin |
+----------------------------------+----------+

real 0m2.209s
user 0m0.680s
sys 0m0.752s

We use openstackclient in devstack to set things up. And since we use this a lot in devstack it slows stack.sh way down.

Revision history for this message
Steve Martinelli (stevemar) wrote :

steve:devstack$ time openstack user list
+----------------------------------+--------+
| ID | Name |
+----------------------------------+--------+
| 15667c13cb244bb2888b4e7d123877d4 | nova |
| 3a7b989e9f084771afebd8db09d9aab4 | demo |
| 71f264c486b044b9bc11d2f4302ecd8e | admin |
| c47d11733d5b473dbd57728a5420bc80 | glance |
| f6d4d6f96d0247e08ae1a24063024857 | cinder |
+----------------------------------+--------+

real 0m6.174s
user 0m1.560s
sys 0m0.184s

steve:devstack$ time keystone user-list
+----------------------------------+--------+---------+------------------+
| id | name | enabled | email |
+----------------------------------+--------+---------+------------------+
| 71f264c486b044b9bc11d2f4302ecd8e | admin | True | |
| f6d4d6f96d0247e08ae1a24063024857 | cinder | True | |
| 3a7b989e9f084771afebd8db09d9aab4 | demo | True | <email address hidden> |
| c47d11733d5b473dbd57728a5420bc80 | glance | True | |
| 15667c13cb244bb2888b4e7d123877d4 | nova | True | |
+----------------------------------+--------+---------+------------------+

real 0m2.957s
user 0m0.499s
sys 0m0.100s

Tried it again, both were faster

steve:devstack$ time openstack user list
+----------------------------------+--------+
| ID | Name |
+----------------------------------+--------+
| 15667c13cb244bb2888b4e7d123877d4 | nova |
| 3a7b989e9f084771afebd8db09d9aab4 | demo |
| 71f264c486b044b9bc11d2f4302ecd8e | admin |
| c47d11733d5b473dbd57728a5420bc80 | glance |
| f6d4d6f96d0247e08ae1a24063024857 | cinder |
+----------------------------------+--------+

real 0m4.096s
user 0m1.539s
sys 0m0.156s

steve:devstack$ time keystone user-list
+----------------------------------+--------+---------+------------------+
| id | name | enabled | email |
+----------------------------------+--------+---------+------------------+
| 71f264c486b044b9bc11d2f4302ecd8e | admin | True | |
| f6d4d6f96d0247e08ae1a24063024857 | cinder | True | |
| 3a7b989e9f084771afebd8db09d9aab4 | demo | True | <email address hidden> |
| c47d11733d5b473dbd57728a5420bc80 | glance | True | |
| 15667c13cb244bb2888b4e7d123877d4 | nova | True | |
+----------------------------------+--------+---------+------------------+

real 0m0.810s
user 0m0.471s
sys 0m0.129s

Changed in python-openstackclient:
assignee: nobody → Vivekanandan mahadevan (anandanvivopenstack)
Revision history for this message
Joe Gordon (jogo) wrote :

Part of this is keystoneclient.session is really slow to load:

On my current box, before: 0.16 seconds after: 0.10 seconds
and scale those times up for slow devstack boxes
Tested with:
 python -c "import timeit; print timeit.timeit('from keystoneclient import session',number=1)"

https://review.openstack.org/#/c/164066/

Revision history for this message
Robert Collins (lifeless) wrote :

One thing about the test here is that it can be misleading - we need to measure the actual wall time for the use case that matters to assess performance, because deferring importing code that is eventually used is just waste heat :) - its deferring loading of code that isn't needed that gives a win.

'keystone help' might be a useful metric, but I've in the past seen that optimised hugely without any change on things that actually matter like (for a concrete example) 'bzr st', which needed separate optimisation work.

Changed in python-keystoneclient:
assignee: nobody → Robert Collins (lifeless)
status: New → In Progress
Changed in python-keystoneclient:
assignee: Robert Collins (lifeless) → Brant Knudson (blk-u)
Revision history for this message
Brant Knudson (blk-u) wrote :
Changed in python-keystoneclient:
assignee: Brant Knudson (blk-u) → Robert Collins (lifeless)
Changed in python-openstackclient:
status: New → Confirmed
importance: Undecided → High
milestone: none → m9
Dean Troyer (dtroyer)
Changed in python-openstackclient:
importance: High → Low
milestone: m9 → none
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-keystoneclient (master)

Reviewed: https://review.openstack.org/164066
Committed: https://git.openstack.org/cgit/openstack/python-keystoneclient/commit/?id=c0145e5fe1a8abdcfe8f95bdb0f6cad647db0465
Submitter: Jenkins
Branch: master

commit c0145e5fe1a8abdcfe8f95bdb0f6cad647db0465
Author: Joe Gordon <email address hidden>
Date: Thu Mar 12 20:43:36 2015 -0700

    Make non-import packages lazy

    6659902a731767b3405d68e515c8edcc3af81119 caused a lot of importing a
    lot of things in __init__ which makes loading anything, say session,
    really slow. The load time for keystoneclient is really critical since
    every client uses it. And having a CLI take several seconds to do
    nothing is really bad user experience.

    This drops the hot cache import time of keystoneclient.session down to
    160ms which is about 60ms faster (down from 220ms without this patch)
    for me.

    Change-Id: I917503ae54c9abcff417f0a0368abb765a847b6e
    Partial-Bug: #1431649
    Co-Authored-By: Robert Collins <email address hidden>

Revision history for this message
Steve Martinelli (stevemar) wrote :

There was also a fix for this in openstackclient: https://review.openstack.org/#/c/173098/

Changed in python-openstackclient:
assignee: Vivekanandan mahadevan (anandanvivopenstack) → nobody
Changed in python-keystoneclient:
importance: Undecided → Low
status: In Progress → Fix Released
Changed in python-openstackclient:
assignee: nobody → Dean Troyer (dtroyer)
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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