Dhcp db interaction is horribly inefficient

Bug #959378 reported by Vish Ishaya on 2012-03-19
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
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:
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

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)

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) on 2012-03-20
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2012-04-05
Changed in nova:
milestone: essex-rc1 → 2012.1
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers