← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1559279] Re: Glance JS API getImage() is inefficient

 

Reviewed:  https://review.openstack.org/294789
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=2d6e0fb0b816ef3809ad0a8f6a15632a8511d38f
Submitter: Jenkins
Branch:    master

commit 2d6e0fb0b816ef3809ad0a8f6a15632a8511d38f
Author: Matt Borland <matt.borland@xxxxxxx>
Date:   Fri Mar 18 13:54:53 2016 -0600

    Fix bad/inefficient API call for JS getImage()
    
    The Angular API library for Glance has a function getImage().  This
    function currently calls to an API like:
    
    /api/glance/images/abasdfasdfas
    
    However, that returns a 301 and redirects to:
    
    /api/glance/images/abasdfasdfas/ <-- trailing slash
    
    This causes latency and unnecessary overhead.
    
    To test this fix, first verify the 301 problem before applying:
    
    Run Horizon in debug (watch the server responses)
    Enable the NG Images panel (enable _1051_ng_image...).
    Go to the NG Images panel, then as you click on a Details view,
    withess the 301 call with no trailing slash, followed by a
    successful call with a 200 and trailing slash.
    
    Then apply the patch.
    
    Then do the same, but notice how there is only one 200 call, with
    the trailing slash.
    
    Change-Id: I0f119e2568d41c4aa63176a8bf8f2fabfbed1b47
    Closes-Bug: 1559279


** Changed in: horizon
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Dashboard (Horizon).
https://bugs.launchpad.net/bugs/1559279

Title:
  Glance JS API getImage() is inefficient

Status in OpenStack Dashboard (Horizon):
  Fix Released

Bug description:
  The Glance API JS has a getImage() function that calls
  '/api/glance/images/' + id, with no trailing slash.  When this hits
  the API, it is redirected via a 301 to '/api/glance/images/' + id +
  '/' (with a trailing slash).  This adds a second network communication
  and thus increases latency.

  If the API is just called with a trailing slash, the API responds
  directly with the result, which is a bit faster.

  You can verify the bug and fix by watching the server in dev mode when
  going to the Angular Image Detail page.  You will see a 301 call
  immediately followed by another call with the trailing slash.  You can
  see this in the JavaScript window as well.

  After applying the fix, you should no longer see the 301 result as
  there will be no call for the resource without the trailing slash.

To manage notifications about this bug go to:
https://bugs.launchpad.net/horizon/+bug/1559279/+subscriptions


References