get_security_groups_on_port takes a long time slowing down neutron

Bug #1315097 reported by Sudheendra Murthy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
High
Sudheendra Murthy
Havana
Fix Released
Undecided
Unassigned
Icehouse
New
Undecided
Unassigned

Bug Description

In Havana neutron, there is a _get_security_groups_on_port(...) which checks that all security groups on port belong to tenant. This method is called every time a port is created. This method calls get_security_groups(...) and with 'service' tenant, this results in getting security groups of all tenants from the database, which is time consuming if there are hundreds of tenants. get_security_groups(...) then applies filter on the security groups returned from db query to select security groups associated with the port. In our environment with around 700 tenants, we saw this method take > 30 seconds and also cause slowdown of other API request processing on this worker instance. This can be made more efficient by supplying 'id' filter so that the database query itself filters on the tenant-id. In our environment, this patch resulted in the method taking 0.1 seconds, down from 30 seconds.

Changed in neutron:
assignee: nobody → Sudheendra Murthy (sudhi-vm)
tags: added: neutron-core
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.openstack.org/91654

Changed in neutron:
status: New → In Progress
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/91654
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=89b01ca24ba95e36568352b4e5c7abf0cd04e4af
Submitter: Jenkins
Branch: master

commit 89b01ca24ba95e36568352b4e5c7abf0cd04e4af
Author: Sudheendra Murthy <email address hidden>
Date: Fri May 2 15:25:28 2014 -0700

    Optimize querying for security groups

    In the check for all security groups on port belong to tenant,
    add a filter to get security groups for the tenant which are in
    common with the security groups of the port.

    Change-Id: I66f31755525fca37f9dbce6fb43e475791f82495
    Closes-Bug: #1315097

Changed in neutron:
status: In Progress → Fix Committed
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix proposed to neutron (stable/icehouse)

Fix proposed to branch: stable/icehouse
Review: https://review.openstack.org/92044

Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix proposed to neutron (stable/havana)

Fix proposed to branch: stable/havana
Review: https://review.openstack.org/92045

Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix merged to neutron (stable/icehouse)

Reviewed: https://review.openstack.org/92044
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=2a7164a01b9527fcf7b078f140550ff89cc2dffd
Submitter: Jenkins
Branch: stable/icehouse

commit 2a7164a01b9527fcf7b078f140550ff89cc2dffd
Author: Sudheendra Murthy <email address hidden>
Date: Fri May 2 15:25:28 2014 -0700

    Optimize querying for security groups

    In the check for all security groups on port belong to tenant,
    add a filter to get security groups for the tenant which are in
    common with the security groups of the port.

    Change-Id: I66f31755525fca37f9dbce6fb43e475791f82495
    Closes-Bug: #1315097
    (cherry picked from commit 89b01ca24ba95e36568352b4e5c7abf0cd04e4af)

tags: added: in-stable-icehouse
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix merged to neutron (stable/havana)

Reviewed: https://review.openstack.org/92045
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=a8417d78c2675a2ceb5dbfcee70948a88d69e747
Submitter: Jenkins
Branch: stable/havana

commit a8417d78c2675a2ceb5dbfcee70948a88d69e747
Author: Sudheendra Murthy <email address hidden>
Date: Fri May 2 15:25:28 2014 -0700

    Optimize querying for security groups

    In the check for all security groups on port belong to tenant,
    add a filter to get security groups for the tenant which are in
    common with the security groups of the port.

    Change-Id: I66f31755525fca37f9dbce6fb43e475791f82495
    Closes-Bug: #1315097
    (cherry picked from commit 89b01ca24ba95e36568352b4e5c7abf0cd04e4af)

tags: added: in-stable-havana
Kyle Mestery (mestery)
Changed in neutron:
milestone: none → juno-1
importance: Undecided → High
Thierry Carrez (ttx)
Changed in neutron:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in neutron:
milestone: juno-1 → 2014.2
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.