When deleting a network, delete the segment RP only when the segment is deleted

Bug #1878916 reported by Rodolfo Alonso
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Medium
Rodolfo Alonso

Bug Description

When a network is deleted, those are some of the operations executed (in order):
- First we check the network is not used.
- Then the subnets are deleted.
- The segments are deleted.
- The network is deleted.

For each network, the segment plugin updates the Placement resource provider of the segment. When no subnets are allocated in this segment, the segment RP is deleted.

Having more than one subnet per segment, will lead to an unnecessary Placement API load. When the network is being deleted, instead of updating the segment RP, we can wait until the segment is deleted and then we can delete the RP. This will same some time in the Neutron server call "network delete" and will reduce the load in the Placement server.

As an example, some figures. With a network created, I've created another segment and 10 subnets in this new segment.

                  CLI time (s)..Neutron API time (s)
Code as is now
                  9.71..........8.23
                  9.63..........8.19
                  9.62..........8.11

Skipping the subnet RP update
                  7.42..........5.96
                  7.49..........6.05

Skipping the subnet route update (host_routes_after_delete) too
                  5.49..........4.05
                  5.74..........4.26

Now adding the segment RP deletion when the segment is deleted
                  5.99..........4.46
                  5.79..........4.31

During a network deletion, we can save time and Placement calls just deleting the segment RP only when the segment is already deleted (AFTER_DELETE event).

description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/ussuri)

Fix proposed to branch: stable/ussuri
Review: https://review.opendev.org/728443

Changed in neutron:
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.opendev.org/728507

Changed in neutron:
assignee: nobody → Rodolfo Alonso (rodolfo-alonso-hernandez)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron (stable/ussuri)

Change abandoned by Rodolfo Alonso Hernandez (<email address hidden>) on branch: stable/ussuri
Review: https://review.opendev.org/728443
Reason: My bad, that initial patch should have been submitted to master

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.opendev.org/728507
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=7f40e626d6de5ec895343453b032b747c02e59f5
Submitter: Zuul
Branch: master

commit 7f40e626d6de5ec895343453b032b747c02e59f5
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Fri May 15 13:26:15 2020 +0000

    Delete segment RPs when network is deleted

    When a network is deleted, only one Placement call per segment
    is done to remove the associated (if existing) resource provider.

    Before this patch, each time a subnet was deleted, the segment
    resource provider was updated. When no subnets were present in the
    related segment, the associated resource provider was deleted.

    This optimization improves the network deletion time (see Launchpad
    bug). E.g.: a network with two segments and ten subnets, the Neutron
    server processing time dropped from 8.2 seconds to 4.4 seconds (note
    that the poor performance was due to the modest testing environment).

    Along with the segment RP optimization during the network deletion,
    this patch also skips the router subnet update. Because all subnets
    in the network are going to be deleted, there is no need to update
    them during the network deletion process.

    Change-Id: Ifd50027911a9ca3508e80e0de9a6cc45b67006cf
    Closes-Bug: #1878916

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/train)

Fix proposed to branch: stable/train
Review: https://review.opendev.org/730888

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/train)

Reviewed: https://review.opendev.org/730888
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=415755015aa7b5ff3ce4aa9a3b88adbe6283161c
Submitter: Zuul
Branch: stable/train

commit 415755015aa7b5ff3ce4aa9a3b88adbe6283161c
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Fri May 15 13:26:15 2020 +0000

    Delete segment RPs when network is deleted

    When a network is deleted, only one Placement call per segment
    is done to remove the associated (if existing) resource provider.

    Before this patch, each time a subnet was deleted, the segment
    resource provider was updated. When no subnets were present in the
    related segment, the associated resource provider was deleted.

    This optimization improves the network deletion time (see Launchpad
    bug). E.g.: a network with two segments and ten subnets, the Neutron
    server processing time dropped from 8.2 seconds to 4.4 seconds (note
    that the poor performance was due to the modest testing environment).

    Along with the segment RP optimization during the network deletion,
    this patch also skips the router subnet update. Because all subnets
    in the network are going to be deleted, there is no need to update
    them during the network deletion process.

    Conflicts:
        neutron/db/db_base_plugin_v2.py

    Change-Id: Ifd50027911a9ca3508e80e0de9a6cc45b67006cf
    Closes-Bug: #1878916
    (cherry picked from commit 7f40e626d6de5ec895343453b032b747c02e59f5)
    (cherry picked from commit 2614637a697eeeafb0b9979ba2024bcd03658988)

tags: added: in-stable-train
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/ussuri)

Reviewed: https://review.opendev.org/728443
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=2614637a697eeeafb0b9979ba2024bcd03658988
Submitter: Zuul
Branch: stable/ussuri

commit 2614637a697eeeafb0b9979ba2024bcd03658988
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Fri May 15 13:26:15 2020 +0000

    Delete segment RPs when network is deleted

    When a network is deleted, only one Placement call per segment
    is done to remove the associated (if existing) resource provider.

    Before this patch, each time a subnet was deleted, the segment
    resource provider was updated. When no subnets were present in the
    related segment, the associated resource provider was deleted.

    This optimization improves the network deletion time (see Launchpad
    bug). E.g.: a network with two segments and ten subnets, the Neutron
    server processing time dropped from 8.2 seconds to 4.4 seconds (note
    that the poor performance was due to the modest testing environment).

    Along with the segment RP optimization during the network deletion,
    this patch also skips the router subnet update. Because all subnets
    in the network are going to be deleted, there is no need to update
    them during the network deletion process.

    Change-Id: Ifd50027911a9ca3508e80e0de9a6cc45b67006cf
    Closes-Bug: #1878916
    (cherry picked from commit 7f40e626d6de5ec895343453b032b747c02e59f5)

tags: added: in-stable-ussuri
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.