Blazar resource allocations API call very slow (15+ seconds)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Blazar |
New
|
High
|
Unassigned |
Bug Description
On our OS deployment (~500 nodes in two regions), the API call to retrieve host allocations can take longer than 15-20 seconds. This is way longer than is necessary for just a few hundred nodes. The problems seems to be with the ORM. The query_host_
def get_reservation
session = get_session()
border0 = models.
border1 = models.
query = (session.
if lease_id:
query = query.filter(
if reservation_id:
query = query.filter(
return query.all()
Changed in blazar: | |
importance: | Undecided → High |
Raw SQL provided in [1] is:
SELECT reservations.id AS reservations_id, reservations. lease_id AS reservations_ lease_id, computehost_ allocations. compute_ host_id AS computehost_ allocations_ compute_ host_id lease_id JOIN computehost_ allocations ON reservations.id = computehost_ allocations. reservation_ id allocations. compute_ host_id IN (?, ?) AND leases.end_date >= ? AND leases.start_date <= ?
FROM reservations JOIN leases ON leases.id = reservations.
WHERE computehost_
Raw SQL provided in [2] is:
SELECT reservations.id AS reservations_id, reservations. lease_id AS reservations_ lease_id, computehost_ allocations. compute_ host_id AS computehost_ allocations_ compute_ host_id lease_id JOIN computehost_ allocations ON reservations.id = computehost_ allocations. reservation_ id allocations. compute_ host_id IN (?, ?) AND (leases.status = ? OR leases.status = ?) AND (reservations. status = ? OR reservations.status = ?)
FROM reservations JOIN leases ON leases.id = reservations.
WHERE computehost_
[1] https:/ /review. opendev. org/#/c/ 678755 /review. opendev. org/#/c/ 679935
[2] https:/
-----
It would be nice to see the difference of the result of the following command in your environment for debugging
mysql> EXPLAIN ANALYZE [the raw sql above]