commit 27857c337378472205c37db6ab79fe8404406129
Author: Matt Riedemann <email address hidden>
Date: Fri Aug 3 17:26:00 2018 -0400
Optimize AZ lookup during schedule_and_build_instances
If we're creating multiple servers, there is a chance
the scheduler returned the same host for more than
one of them, which means we could be redundantly
looking up the AZ for the same host multiple times.
This could happen when creating multiple servers in
the same strict affinity group, or simply if the
scheduler is configured with a pack-first strategy
for filling up hosts. The get_host_availability_zone()
method does not use its own internal cache, so this
change adds a simple cache to the schedule_and_build_instances
method itself so that we only lookup the AZ per unique
host once.
Note that build_instances suffers from the same issue
but that is only called for scheduling with cells v1
which is deprecated so we shouldn't need to care about
optimizing that method.
Reviewed: https:/ /review. openstack. org/588665 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=27857c33737 8472205c37db6ab 79fe8404406129
Committed: https:/
Submitter: Zuul
Branch: master
commit 27857c337378472 205c37db6ab79fe 8404406129
Author: Matt Riedemann <email address hidden>
Date: Fri Aug 3 17:26:00 2018 -0400
Optimize AZ lookup during schedule_ and_build_ instances
If we're creating multiple servers, there is a chance availability_ zone() and_build_ instances
the scheduler returned the same host for more than
one of them, which means we could be redundantly
looking up the AZ for the same host multiple times.
This could happen when creating multiple servers in
the same strict affinity group, or simply if the
scheduler is configured with a pack-first strategy
for filling up hosts. The get_host_
method does not use its own internal cache, so this
change adds a simple cache to the schedule_
method itself so that we only lookup the AZ per unique
host once.
Note that build_instances suffers from the same issue
but that is only called for scheduling with cells v1
which is deprecated so we shouldn't need to care about
optimizing that method.
Change-Id: I2ae5ae7240e518 3acca7492ddad01 7c0c878835b
Closes-Bug: #1785327