Qos plugin performs too many queries

Bug #1905726 reported by Lucian Petrut
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
neutron
Fix Released
High
Oleg Bondarev

Bug Description

Whenever retrieving the port list while having the QoS plugin enabled, Neutron performs about 10 DB queries per port, most of them being QoS related: http://paste.openstack.org/raw/800461/

For 1000 ports, we end up with 10 000 sequential DB queries. A simple "neutron port-list" or "nova list" command will exceed 1 minute, which is likely to hit timeouts.

This seems to be the problem: https://github.com/openstack/neutron/blob/17.0.0/neutron/db/db_base_plugin_v2.py#L1566-L1570

For each of the retrieved ports, the plugins are then supposed to provide additional details, so for each port we get a certain number of extra queries.

One idea would be to add a flag such as 'detailed' or 'include_extensions' to 'get_ports' and then propagate it to '_make_port_dict' through the 'process_extensions' parameter. Another idea would be to let the plugins extend the query but that might be less feasible.

Worth mentioning that there were a couple of commits meant to reduce the number of queries but it's still excessive:
https://review.opendev.org/c/openstack/neutron/+/667998
https://review.opendev.org/c/openstack/neutron/+/667981/

no longer affects: cinder
Revision history for this message
Oleg Bondarev (obondarev) wrote :
Changed in neutron:
importance: Undecided → High
assignee: nobody → Oleg Bondarev (obondarev)
tags: added: load
tags: added: db loadimpact qos
removed: load
Revision history for this message
Lucian Petrut (petrutlucian94) wrote :

@Oleg: Thanks for taking care of this issue. Indeed, both plugins would benefit from a similar approach.

@Sean: I'm really sorry about filing the bug on Cinder, thanks for moving it!

Revision history for this message
Oleg Bondarev (obondarev) wrote :
Revision history for this message
Oleg Bondarev (obondarev) wrote :
Revision history for this message
Oleg Bondarev (obondarev) wrote :

@Lucian, can you please try above patches on your environment?

Changed in neutron:
status: New → In Progress
Revision history for this message
Lucian Petrut (petrutlucian94) wrote :

@Oleg from what I can tell, that "bulk" check should avoid the DB queries when listing ports. I'll give it a try ASAP.

Revision history for this message
Lucian Petrut (petrutlucian94) wrote :

@Oleg I finally got the time to test the patches. We were hitting those issues on Train, so I've backported the patches there.

I did have an issue: the port_res['resource_request'] fields used internally (qos_id, vnic_type and network_id) are leaked to Nova, which then rejects live migrations: http://paste.openstack.org/raw/801620/

Worth mentioning that this Nova check was removed in Wallaby and backported to Ussuri: https://review.opendev.org/c/openstack/nova/+/738482. Still, I guess it would be safer if we avoided leaking those fields.

I'm attaching an archive containing the Train backports as well as the patch that avoids leaking those resource request fields in case anyone's interested in it.

Revision history for this message
Lucian Petrut (petrutlucian94) wrote :

Minor correction: the Nova check was removed by this patch and wasn't backported: https://review.opendev.org/c/openstack/nova/+/735570

tags: added: neutron-proactive-backport-potential
Revision history for this message
Rodolfo Alonso (rodolfo-alonso-hernandez) wrote :
Changed in neutron:
status: In Progress → Fix Released
milestone: none → wallaby-3
status: Fix Released → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 15.3.3

This issue was fixed in the openstack/neutron 15.3.3 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 16.3.1

This issue was fixed in the openstack/neutron 16.3.1 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 17.1.1

This issue was fixed in the openstack/neutron 17.1.1 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 18.0.0.0rc1

This issue was fixed in the openstack/neutron 18.0.0.0rc1 release candidate.

Changed in neutron:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.