improve-db-performance

Registered by Aaron Rosen

Improve db perfomance of quantum. There are several issues that this blueprint aims to fix.

In quantum/db/models_v2.py in the Ports class we define:

fixed_ips = orm.relationship(IPAllocation, backref='ports', lazy="dynamic")

When get_ports() is called:

        items = [self._make_port_dict(c, fields, context=context)
                 for c in query.all()]

generates a:

SELECT ipallocations.port_id AS ipallocations_port_id, ipallocations.ip_address AS ipallocations_ip_address, ipallocations.subnet_id AS ipallocations_subnet_id, ipallocations.network_id AS ipallocations_network_id, ipallocations.expiration AS ipallocations_expiration
FROM ipallocations
WHERE '04f508b7-0d62-431c-a8e3-4148603b8a58' = ipallocations.port_id

for each port when we could have done this in one query via:

        query = query.options(orm.subqueryload(models_v2.Port.fixed_ips))

if we weren't using lazy="dynamic" (though code needs to change in order to account for this)

Lastly, we need a better solution for how we have been extended fields for the return of results i.e:

            for net in quantum_lswitches:
                self._extend_network_dict_provider(context, net)
                self._extend_network_port_security_dict(context, net)
                self._extend_network_dict_l3(context, net)
                self._extend_network_qos_queue(context, net)

as this generates tons of selects as well.

This blueprint will probably be implemented in a few patch sets.

Blueprint information

Status:
Complete
Approver:
Aaron Rosen
Priority:
Medium
Drafter:
Aaron Rosen
Direction:
Approved
Assignee:
Aaron Rosen
Definition:
Approved
Series goal:
Accepted for havana
Implementation:
Implemented
Milestone target:
milestone icon 2013.2
Started by
Aaron Rosen
Completed by
Aaron Rosen

Related branches

Sprints

Whiteboard

Gerrit topic: https://review.openstack.org/#q,topic:bp/improve-db-performance,n,z

Addressed by: https://review.openstack.org/30648
    Make get_ports() get all the ports from the db in one query

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.