[LIBCLOUD-826] [GCE]: Improve performance of list nodes by caching volume information#813
Closed
supertom wants to merge 1 commit into
Closed
[LIBCLOUD-826] [GCE]: Improve performance of list nodes by caching volume information#813supertom wants to merge 1 commit into
supertom wants to merge 1 commit into
Conversation
| :rtype: :class:`StorageVolume` or raise ``ResourceNotFoundError``. | ||
| """ | ||
| if volume_name not in self.volume_dict: | ||
| raise ResourceNotFoundError( |
Contributor
There was a problem hiding this comment.
Should this instead make an API call in case the cache is missing a recently created disk?
sayap
reviewed
Sep 21, 2016
|
|
||
| return response | ||
|
|
||
| def request_aggregated_items(self, api_name): |
Contributor
There was a problem hiding this comment.
I think this always returns only up to 500 items, as the if self.gce_params: condition few lines above will always evaluate to false.
35c5381 to
ce7b9f5
Compare
We leverage the aggregated disk call and store the result. For the list node operation, we've added an extra parameter to use the cached data, which results to true. Tests and fixtures updated as well.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[GCE] Improve performance of list nodes by caching volume information
Description
When listing nodes, the GCE driver currently calls the disk API for each disk attached to the node. This PR changes that behavior by using the aggregatedLIst call for disks (once per list_node request) and using that information to provide disk details.
See sample performance info in LIBCLOUD-826
Implementation:
For disk information, aggregated calls are now always used and the disk information is stored in a dictionary, called 'volume_dict'. If the user would like the most current information, they may set the use_cache keyword to false and the call (and subsequent population of volume_dict) will be made prior to returning disk information.
Code was added/changed in two classes. In GCENodeDriver, added two methods and an additional parameter to build, lookup and toggle the refresh of the volume cache. In GCEConnection, added convenience and helper methods to the class, which not only support this performance improvement but also support the longer term vision of leveraging aggregatedList calls elsewhere.
GCEConnection
GCENodeDriver
Status
Checklist (tick everything that applies)
/cc @erjohnso /cc @tonybaloney