Juju status slow on large model
Bug #1865172 reported by
Tim Penhey
This bug affects 2 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Canonical Juju |
Fix Released
|
High
|
Tim Penhey |
Bug Description
The code that is fetching the network interfaces is doing a database query to load the space name for every interface.
Line 620 in apiserver/
Changed in juju: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
The code already does model.AllSubnets() at the beginning, but as it iterates all of the machine interfaces, it then calls interface. subnet. SpaceName( ) which does a DB query to resolve the SpaceID on the subnet doc into the SpaceName in the space doc.
We could do the same caching of subnet CIDR to SpaceName. This is dangerous in the long term if we ever want to support multiple Networks inside a model. but it would solve the immediate problem. (There is, already, a State.AllSpaces() that would let us load it in a single pass.)
Looking a different way, Status also doesn't filter down to just the machines we care about (if you do 'juju status ubuntu/0' it will read all the machine interfaces on all machines to build the map, and then filter it down to just the instances we care about.)
So ideally we would figure out the machines we care about, then use those ids to load all the interfaces we care about, build the set of the subnet ids, use that to load just the subnets we care about, and use that to load just the spaces that we care about.