Comment 6 for bug 1479090

Revision history for this message
Andrew Woodward (xarses) wrote :

output from python profile of nailgun.api.v1.handlers.orchestrator.DefaultDeploymentInfo

http://paste.openstack.org/show/406326/

6749077 function calls (6496262 primitive calls) in 36.288 seconds

1) There appear to be alot of calls to get_node_networks

      305 0.032 0.000 31.528 0.103 ./fuel-web/nailgun/nailgun/network/manager.py:637(get_node_networks)

2) Which results in alot of calls to _get_admin_node_network
      305 0.028 0.000 25.372 0.083 ./fuel-web/nailgun/nailgun/network/manager.py:581(_get_admin_node_network)

3) Then we see its called 8 (number of nodes, suspicious...) less times in get_node_network_by_netname

      297 0.000 0.000 30.560 0.103 ./fuel-web/nailgun/nailgun/network/manager.py:601(get_node_network_by_netname)

We can see that https://github.com/stackforge/fuel-web/blob/master/nailgun/nailgun/network/manager.py#L601-605 is actually in-efficient, it relies on https://github.com/stackforge/fuel-web/blob/master/nailgun/nailgun/network/manager.py#L638-657 which will make networks*3+1 DB calls (with default networks=4*3+1 = 13) instead of 3 for the data we need.

I think we can cut the db trips by 1/4 if we change get_node_networks to call get_node_network_by_netname with an empty filter and move the getting / and add filtering logic to get_node_network_by_netname

Looking at what changed in the calling of get_node_network_by_netname, we can see that the new neutron serializer
https://github.com/stackforge/fuel-web/blob/master/nailgun/nailgun/orchestrator/neutron_serializers.py#L823

I'm not 100% but I think it's in the difference of the old static list, vs the new dynamic one
https://github.com/stackforge/fuel-web/blob/master/nailgun/nailgun/orchestrator/neutron_serializers.py#L846-847
vs
https://github.com/stackforge/fuel-web/blob/master/nailgun/nailgun/orchestrator/neutron_serializers.py#L279-291