Dhcp db interaction is horribly inefficient

Bug #959378 reported by Vish Ishaya
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
High
Vish Ishaya

Bug Description

In linux_net:get_dhcp_leases and get_dhcp_hosts two db requests are made for every running instance in the db. The implication is that 2 * instances queries are made every time an instance is launched or terminated.

Ultimately this code needs to be refactored to just send in the relevant information to linux_net The information seems to be:
network_id
instance_hostname
instance_host
fixed_ip_address
vif_address
instance_id (could probably use hostname in place of this)

This is too large of a change for essex though so I think we need something like the following:

a) use joins to load the instance and vif in the db.network_get_associated_fixed_ips query (only used in linux_net)

b) optionally pass in a host parameter to filter the query

Revision history for this message
Vish Ishaya (vishvananda) wrote :

The included patch is what the interface should look like. Underlying query needs to be written.

Changed in nova:
importance: Undecided → High
status: New → In Progress
assignee: nobody → Brian Waldon (bcwaldon)
milestone: none → essex-rc1
Changed in nova:
assignee: Brian Waldon (bcwaldon) → Vish Ishaya (vishvananda)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

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

Reviewed: https://review.openstack.org/5518
Committed: http://github.com/openstack/nova/commit/ffb9361596c1708d7d009c195b4b3bc74d00a01c
Submitter: Jenkins
Branch: master

commit ffb9361596c1708d7d009c195b4b3bc74d00a01c
Author: Vishvananda Ishaya <email address hidden>
Date: Mon Mar 19 09:01:16 2012 -0700

    Improve performance of generating dhcp leases

     * Dont make 2 * instances queries when generating dhcp leases
     * Uses some nasty joins to minimize necessary changes
     * Adds test to verify functionality
     * Uses old sqlalchemy compatible join syntax
     * Uses vif_id as nw identifier for single_host_gateway mode
     * Cleans up tests in linux_net
     * Fixes bug 959378

    Change-Id: I1c74d114dd7caad1781180585bb65691e536bcf9

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: essex-rc1 → 2012.1
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.