Get external networks too slowly because it would join subnet and rbac
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
neutron |
New
|
Medium
|
Unassigned |
Bug Description
Getting networks would join subnet and rbac tables.
When the number of rbac objects which belong to the network is huge, and the network has many subnets.
It would costs sqlachemy much time to instance the orm object of this network.
Such as, a external network with 25 subnets and share to 5000 project.
reproduce this case through the following steps:
1. neutron net-create test_net --router:external True ---> create a external network
2. for i in {1..5000}; do openstack project create test$i;done ----> create 5000 projects
3. for i in {1..25}; do neutron subnet-create test_net 192.168.
4. openstack project list | grep test | awk -F '|' '{print $2}' > tenant_ids -----> save 5000 project ids
5. for i in `cat tenant_ids`;do neutron rbac-create --tenant-id dd969098bfe1497
6. time neutron net-show test_net ---> this would cost 15+ seconds to get the info of the external network
summary: |
- Get external networks too slowly because subnet join rbac while there - are many rbac obj + Get external networks too slowly because it would join subnet and rbac |
tags: | added: loadimpact |
tags: | added: db |
Changed in neutron: | |
importance: | Undecided → Medium |
the DB sql: ------- ------- ------- ------- ----- tenant_ id AS networkrbacs_ tenant_ id, networkrbacs.id AS networkrbacs_id, networkrbacs. target_ tenant AS networkrbacs_ target_ tenant, networkrbacs.action AS networkrbacs_ action, networkrbacs. object_ id AS networkrbacs_ object_ id, subnets_ 1.network_ id AS subnets_ 1_network_ id object_ id s.network_ id segments ON networks.id = ml2_network_ segments. network_ id tes.id = networks. standard_ attr_id segments. is_dynamic IS false AND (networks.tenant_id = 'fd27c1f66a5d4f 888672a18b1b0c9 5b6' OR networkrbacs.action = 'access_as_shared' AND (networkrbacs. target_ tenant = 'fd27c1f66a5d4f 888672a18b1b0c9 5b6' OR networkrbacs. target_ tenant = '*')) AND networks.name IN ('cmnet01_net0116') AND externalnetwork s.network_ id IS NOT NULL) AS anon_1 1.network_ id 1.network_ id = networkrbacs. object_ id 1.network_ id ------- ------- ------- ------- ------- ------- ------- ------- -----
-------
SELECT networkrbacs.
FROM (
SELECT DISTINCT networks.id AS networks_id
FROM networks
LEFT OUTER JOIN networkrbacs ON networks.id = networkrbacs.
LEFT OUTER JOIN externalnetworks ON networks.id = externalnetwork
LEFT OUTER JOIN ml2_network_
JOIN standardattributes ON standardattribu
WHERE ml2_network_
JOIN subnets AS subnets_1 ON anon_1.networks_id = subnets_
JOIN networkrbacs ON subnets_
ORDER BY subnets_
-------
In fact,there is no need to join rbac after join subnet when get network. /github. com/openstack/ neutron- lib/blob/ master/ neutron_ lib/db/ model_query. py#L121
because before join subnet it process the rbac here:https:/