very poor perfomance with PKI tokens

Bug #1526686 reported by Bernhard M. Wiedemann
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
python-keystoneclient
Fix Released
Medium
Bernhard M. Wiedemann

Bug Description

bug 1404402 simplified the code by using python's textwrap library
but that library is geared toward processing natural text
and performs very poorly on strings of chars without spaces, because then it has O(n^2) complexity
http://bugs.python.org/issue25870

comparison of speed:
time python -c "import textwrap; textwrap.wrap('x'*16000, 64)"

real 0m11.627s
user 0m11.620s
sys 0m0.012s

time python -S -c "x='x'*16000; result=[x[n:n + 64] for n in range(0, len(x), 64)]"

real 0m0.010s
user 0m0.008s
sys 0m0.004s

typical sizes for PKI tokens varied between 4000 and 16000 in our testing.
devstack uses uuid-tokens by default so does not hit this issue.

Changed in python-keystoneclient:
assignee: nobody → Bernhard M. Wiedemann (ubuntubmw)
status: New → In Progress
Revision history for this message
Boris Bobrov (bbobrov) wrote :

Yeah, but PKI tokens have security bug and should not be used: https://bugs.launchpad.net/keystone/+bug/1490804 .

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

@boris, yeah, they do, but we should still accept security and (major) performance issues while PKI is deprecated. It'll make users happy while they transition over.

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

@ Bernhard thanks for the thorough details!

Changed in python-keystoneclient:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-keystoneclient (master)

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

commit fde0bf77d6a89ee84e62461bc0d4c2cdfd809c48
Author: Bernhard M. Wiedemann <email address hidden>
Date: Wed Dec 2 12:47:33 2015 +0100

    Replace textwrap with fast standard code

    This improves on commit 4350c176048b8d159d08b82b915e9544ac9dee6f

    We found a major performance regression in keystoneclient
    when using PKI tokens, related to http://bugs.python.org/issue25870

    It can be tested with
    time python -c "import textwrap; textwrap.wrap('x'*9000, 64)"

    which has a complexity of O(n*n)
    because it uses certain regexps in python versions before 3.5.

    Closes-Bug: #1526686
    Related-Bug: #1404402

    Change-Id: Ibc81907c4d9db2c09fff41ccf21345fbdb19202d

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

This issue was fixed in the openstack/python-keystoneclient 2.1.0 release.

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.