neutron/neutron/db/models
Rodolfo Alonso Hernandez 52662cad7a Change SG rules backref load method to "joined"
Since [1], we introduced a way to skip the load of the OVO synthetic
fields depending on the resource fields retrieved. In the case of the
security groups (SG), the SG rules are child objects to the SGs. The SG
rules are retrieved when a SG OVO is created.

The improvement done in [1] is to make the SG rules load dynamically,
that means using the load mode "lazy='dynamic'". That will issue a SQL
query only if the SG rules are read; if not, the query is never issued.

However since [2] (and this is previous to the [1] optimization), we
always add the field "shared" to the filters and thus to the fields to
retrieve, because it is a policy required field. Because "shared" is a
synthetic field [3], that will force the SG "synthetic_fields" load and
the retrieval of the SG rules always. This is undoing any performance
improvement.

This patch is changing the loading method to "joined"; that will request
the SG rules in the same SQL query, instead of issuing separate queries
for the SG rules. Until a method to load the SG "shared" field,
independently of the synthetic OVO fields is implemented, this change
will improve the SG retrieval performance. In a testing environment
with around 5500K SG and 4 rules (default ones) per SG:
* lazy='dynamic': 38 seconds
* lazy='select': 20 seconds
* lazy='joined': 12 seconds

[1]https://review.opendev.org/q/topic:%22bug/1810563%22
[2]https://review.opendev.org/c/openstack/neutron/+/328313
[3]b85b19e384/neutron/objects/rbac_db.py (L349)

Related-Bug: #2052419
Change-Id: I300464472f2348d148f2a3ddac384c883d9d815b
2024-02-09 01:09:50 +00:00
..
plugins Limit ml2_vlan_allocations.vlan_id value in DB backend 2020-06-05 10:04:52 +00:00
README Update README to reflect ML2 Exception in Dir Tree 2016-08-22 15:20:35 +00:00
__init__.py Add devref for Relocating DB models 2016-08-09 15:55:18 +02:00
address_group.py Change RBAC relationship loading method to "joined" 2023-05-29 05:14:18 +02:00
address_scope.py Change RBAC relationship loading method to "joined" 2023-05-29 05:14:18 +02:00
agent.py Create an index for "agents.host" column 2022-01-13 05:20:58 +00:00
allowed_address_pair.py Cleanup _find_related_obj 2017-02-25 06:29:33 +00:00
conntrack_helper.py Conntrack Helper - OVO and db script 2019-05-20 18:00:18 +02:00
data_plane_status.py [sqlalchemy-20] Remove redundant indexes from some tables 2023-06-23 11:24:22 +00:00
dns.py Merge "Revert "Use ``TextClause`` to define the DB model "server_default""" 2023-07-03 19:31:29 +00:00
dvr.py Ensure there is always at most 1 dvr fip gw port per agent and network 2020-02-07 08:32:33 +00:00
external_net.py Cleanup _find_related_obj 2017-02-25 06:29:33 +00:00
flavor.py Define orm relationships after db classes 2019-05-16 13:45:56 +04:00
l3.py Use neutron-lib standard_attr 2021-09-15 09:19:26 +00:00
l3_attrs.py Add extra router attributes for ECMP and BFD 2023-07-25 17:03:34 +02:00
l3agent.py Improve scheduling L3/DHCP agents, missing lower binding indexes 2023-02-08 13:14:19 +01:00
l3ha.py Make "project_id" in "L3HARouterNetwork" unique constraint 2023-05-10 09:15:05 +02:00
local_ip.py Add Local IP Extension and DB 2021-11-11 10:08:23 +03:00
loggingapi.py Use neutron-lib standard_attr 2021-09-15 09:19:26 +00:00
metering.py Replace "tenant_id" with "project_id" in metering service 2021-10-28 09:42:52 +00:00
ndp_proxy.py Forbid create ndp proxy on same router with same ip address 2022-06-04 10:27:13 +08:00
network_segment_range.py Fix some pylint indentation warnings 2022-11-03 19:50:54 -04:00
ovn.py ovn: Always use UTC for Hash ring timestamps 2020-09-08 12:09:48 -04:00
port_device_profile.py Add port device profile extension 2021-01-22 16:17:30 +00:00
port_forwarding.py Extend database to support portforwardings with port range 2022-03-15 09:10:23 -03:00
port_hardware_offload_type.py Add a "port" child table "porthardwareoffloadtype" 2023-08-19 06:08:51 +00:00
port_hints.py port-hints: api extension 2023-05-09 11:49:17 +02:00
port_numa_affinity_policy.py Add port NUMA affinity policy 2020-11-13 15:49:34 +00:00
provisioning_block.py Use neutron-lib standard_attr 2021-09-15 09:19:26 +00:00
securitygroup.py Change SG rules backref load method to "joined" 2024-02-09 01:09:50 +00:00
securitygroup_default_rules.py Default SG api rules template - DB and OVO models 2023-07-07 10:43:34 +02:00
segment.py [sqlalchemy-20] Remove redundant indexes from some tables 2023-06-23 11:24:22 +00:00
servicetype.py Use DB field sizes instead of _MAX_LEN constants 2016-12-23 13:48:57 +00:00
subnet_service_type.py Fix some pylint indentation warnings 2022-11-03 19:50:54 -04:00
tag.py Use HasStandardAttributes as parent class for Tags DB model 2023-08-16 14:00:41 +00:00
uplink_status_propagation.py [sqlalchemy-20] Remove redundant indexes from some tables 2023-06-23 11:24:22 +00:00

README

This directory is designed to contain all SQLAlchemy models shipped with core
Neutron.

* The expected directory structure is flat, except for the ML2 plugins. All ML2
  plugin models should fall under the plugins subdirectory (i.e. plugins/ml2/gre_allocation).
* Module names should use singular forms for nouns (port.py, not ports.py).