Comment 3 for bug 2037107

Revision history for this message
Max (maxlamprecht) wrote :

I also discovered that we use subquery for the subnets in the network class -> [1]
This will load all subnets and filters afterwards for the right network. I would propose to change the lazy option to lazy="selectin". [2]
With that option we will move the filtering to mysql and will benefit from less sqlalchemy orm parsing.
before:
 GET http://10.1.0.70:9696/networking/v2.0/networks/64a06492-c675-418b-8b6d-9f5a875795e9 = 2.932295 sec
after:
 GET http://10.1.0.70:9696/networking/v2.0/networks/64a06492-c675-418b-8b6d-9f5a875795e9 = 0.886842 sec

I also would like to change the rbac filtering.
Things like [3] are not really performant and should be handeled by mysql.

[1]https://opendev.org/openstack/neutron/src/commit/8e38e57b8000ca6ce9ab84692a9aba6220556a3d/neutron/db/models_v2.py#L320
[2]https://docs.sqlalchemy.org/en/14/orm/loading_relationships.html
[3]https://opendev.org/openstack/neutron/src/commit/8e38e57b8000ca6ce9ab84692a9aba6220556a3d/neutron/db/db_base_plugin_common.py#L348-L356