With ~4K ports, a port-create with fixed-mac takes about 7 secs

Bug #1424785 reported by Vedamurthy Joshi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Juniper Openstack
Status tracked in Trunk
R4.0
Fix Committed
Medium
Sahil Sabharwal
Trunk
Fix Committed
Medium
Sahil Sabharwal

Bug Description

R2.1 Build 26 Ubuntu 12.04 Icehouse Multi-node (2 cfgm ) setup

A normal port-create on a VN takes less than a second
In a VN, i have ~4K ports.

Now, a port-create with fixed-mac takes more than 7sec. Per Ajay, some optimization can be done here.

root@nodei34:/var/log/contrail# time neutron port-create 6943e235-f74d-4d59-883d-a829a3778b63 --mac-address 00:01:00:00:0f:3c
Created a new port:
+-----------------+------------------------------------------------------------------------------------+
| Field | Value |
+-----------------+------------------------------------------------------------------------------------+
| admin_state_up | True |
| device_id | |
| device_owner | |
| fixed_ips | {"subnet_id": "7dab9edf-a475-429f-b554-70f0f8a77f1d", "ip_address": "10.1.15.123"} |
| id | b84107f7-05bc-4260-b806-1fdae417f0ca |
| mac_address | 00:01:00:00:0f:3c |
| name | b84107f7-05bc-4260-b806-1fdae417f0ca |
| network_id | 6943e235-f74d-4d59-883d-a829a3778b63 |
| security_groups | 505bf680-364d-4554-8990-3451e281e894 |
| status | DOWN |
| tenant_id | 2be87ae2cd7f4e14a1345576237152e7 |
+-----------------+------------------------------------------------------------------------------------+

real 0m7.782s
user 0m0.317s
sys 0m0.063s
root@nodei34:/var/log/contrail#

---------------------

from neutron_plugin_db.py:
def port_create(self, context, port_q):
    <snip>
            # if mac-address is specified, check against the exisitng ports
        # to see if there exists a port with the same mac-address
        if 'mac_address' in port_q:
            ports = self._vnc_lib.virtual_machine_interfaces_list(
                parent_id=proj_id, back_ref_id=net_id, detail=True)
            for port in ports:
                macs = port.get_virtual_machine_interface_mac_addresses()
                for mac in macs.get_mac_address():
                    if mac == port_q['mac_address']:
                        raise self._raise_contrail_exception("MacAddressInUse",
                            net_id=net_id, mac=port_q['mac_address'])

--------------------------

root@nodei34:~# time neutron port-create 6943e235-f74d-4d59-883d-a829a3778b63 --mac-address 00:01:00:00:0f:3c
127.0.0.1 - - [2015-02-24 00:37:34] "GET /virtual-network/6943e235-f74d-4d59-883d-a829a3778b63?exclude_back_refs=True&exclude_children=True HTTP/1.1" 200 1740 0.012771
192.168.1.2 - - [2015-02-24 00:37:34] "POST /neutron/network HTTP/1.1" 200 592 0.081134
127.0.0.1 - - [2015-02-24 00:37:34] "GET /virtual-network/6943e235-f74d-4d59-883d-a829a3778b63?exclude_back_refs=True&exclude_children=True HTTP/1.1" 200 1740 0.011175
127.0.0.1 - - [2015-02-24 00:37:38] "GET /virtual-machine-interfaces?count=False&parent_id=2be87ae2-cd7f-4e14-a134-5576237152e7&detail=True&back_ref_id=6943e235-f74d-4d59-883d-a829a3778b63 HTTP/1.1" 200 7307300 4.147361
127.0.0.1 - - [2015-02-24 00:37:41] "GET /project/2be87ae2-cd7f-4e14-a134-5576237152e7?exclude_back_refs=True&exclude_children=True HTTP/1.1" 200 916 0.016286
127.0.0.1 - - [2015-02-24 00:37:41] "POST /virtual-machine-interfaces HTTP/1.1" 200 552 0.040738
INFO:api-0:Sending request(xid=7706): Create(path=u'/api-server/subnets/default-domain:admin:vn1:10.1.0.0/16/0167841659', data='54250743-b873-4f78-9508-b6bf4a5bf80b', acl=[ACL(perms=31, acl_list=['ALL'], id=Id(scheme='world', id='anyone'))], flags=0)
INFO:api-0:Received response(xid=7706): u'/api-server/subnets/default-domain:admin:vn1:10.1.0.0/16/0167841659'
127.0.0.1 - - [2015-02-24 00:37:41] "POST /instance-ips HTTP/1.1" 200 357 0.082358
127.0.0.1 - - [2015-02-24 00:37:41] "GET /virtual-machine-interface/ea4afdf7-f452-46a2-8385-a1159bd41aaf?fields=logical_router_back_refs%2Cinstance_ip_back_refs%2Cfloating_ip_back_refs HTTP/1.1" 200 1845 0.008665
INFO:api-0:Sending request(xid=7707): GetData(path=u'/api-server/subnets/default-domain:admin:vn1:10.1.0.0/16/0167841659', watcher=None)
INFO:api-0:Received response(xid=7707): ('54250743-b873-4f78-9508-b6bf4a5bf80b', ZnodeStat(czxid=4294974077, mzxid=4294974077, ctime=1424718461168, mtime=1424718461168, version=0, cversion=0, aversion=0, ephemeralOwner=0, dataLength=36, numChildren=0, pzxid=4294974077))
127.0.0.1 - - [2015-02-24 00:37:41] "GET /virtual-network/6943e235-f74d-4d59-883d-a829a3778b63?exclude_back_refs=True&exclude_children=True HTTP/1.1" 200 1740 0.009173
127.0.0.1 - - [2015-02-24 00:37:41] "GET /instance-ip/8d7bb520-082a-4565-9a79-5849b444166a?exclude_back_refs=True&exclude_children=True HTTP/1.1" 200 1395 0.006799
192.168.1.3 - - [2015-02-24 00:37:41] "POST /neutron/port HTTP/1.1" 200 670 6.545466

Tags: config neutron
summary: - With ~4K ports, a port-create with fixed-mac, takes about 7 secs
+ With ~4K ports, a port-create with fixed-mac takes about 7 secs
Revision history for this message
Sachin Bansal (sbansal) wrote :

Instead of reading all ports, we should do filter on the mac address.

Changed in juniperopenstack:
assignee: Hampapur Ajay (hajay) → Sahil Sabharwal (ssabharwal)
Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] master

Review in progress for https://review.opencontrail.org/33345
Submitter: <email address hidden> (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/33345
Committed: http://github.com/Juniper/contrail-controller/commit/497ca1ce0ffe979f34586efd2777aae7910e048d
Submitter: Zuul (<email address hidden>)
Branch: master

commit 497ca1ce0ffe979f34586efd2777aae7910e048d
Author: Sahil <email address hidden>
Date: Fri Jun 30 00:07:15 2017 -0700

[vnc_openstack]: Optimization for port create

* During a port create with fixed mac, a call to _object_list
is made. We have modified the call to include filters (on mac address).

* This will provide optimization when creating large number of ports with
mac addresses.

Change-Id: Id7f1d836a0db0287c5c3f4b86b0dd54cfeaf34ff
Closes-Bug: 1424785

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] R4.0

Review in progress for https://review.opencontrail.org/33929
Submitter: ?douard Thuleau (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/33929
Committed: http://github.com/Juniper/contrail-controller/commit/fa60b9bc097a22df3b473b75f7e068b8144eb436
Submitter: Zuul (<email address hidden>)
Branch: R4.0

commit fa60b9bc097a22df3b473b75f7e068b8144eb436
Author: Sahil <email address hidden>
Date: Fri Jun 30 00:07:15 2017 -0700

[vnc_openstack]: Optimization for port create

* During a port create with fixed mac, a call to _object_list
is made. We have modified the call to include filters (on mac address).

* This will provide optimization when creating large number of ports with
mac addresses.

Change-Id: Id7f1d836a0db0287c5c3f4b86b0dd54cfeaf34ff
Closes-Bug: 1424785
(cherry picked from commit 497ca1ce0ffe979f34586efd2777aae7910e048d)

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.