Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
[LIBCLOUD-826] [GCE]: Improve performance of list nodes by caching volume information #813
[GCE] Improve performance of list nodes by caching volume information
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
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.
Checklist (tick everything that applies)
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.