'juju status' asks for presence (IsAlive) for each object one-by-one

Bug #1703594 reported by John A Meinel
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Triaged
Low
Unassigned
2.2
Won't Fix
Medium
Unassigned

Bug Description

If you turn on "logging-config=juju.state.presence=TRACE" you can see some interesting information like:
machine-0: 15:50:15 TRACE juju.state.presence [8e869b] got request: presence.reqAlive{key:"m#2", result:(chan bool)(0xc422322a80)} for model
machine-0: 15:50:15 TRACE juju.state.presence [8e869b] Alive("m#2") -> true
machine-0: 15:50:15 TRACE juju.state.presence [8e869b] got request: presence.reqAlive{key:"m#0", result:(chan bool)(0xc42222db20)} for model
machine-0: 15:50:15 TRACE juju.state.presence [8e869b] Alive("m#0") -> true
machine-0: 15:50:15 TRACE juju.state.presence [8e869b] got request: presence.reqAlive{key:"m#1", result:(chan bool)(0xc422322ee0)} for model
machine-0: 15:50:15 TRACE juju.state.presence [8e869b] Alive("m#1") -> true
machine-0: 15:50:15 TRACE juju.state.presence [8e869b] got request: presence.reqAlive{key:"u#ul/11", result:(chan bool)(0xc4212f9d50)} for model
machine-0: 15:50:15 TRACE juju.state.presence [8e869b] Alive("u#ul/11") -> true
machine-0: 15:50:15 TRACE juju.state.presence [8e869b] got request: presence.reqAlive{key:"u#ul/5", result:(chan bool)(0xc421fac2a0)} for model
machine-0: 15:50:15 TRACE juju.state.presence [8e869b] Alive("u#ul/5") -> true
machine-0: 15:50:15 TRACE juju.state.presence [8e869b] got request: presence.reqAlive{key:"u#ul/6", result:(chan bool)(0xc421fac700)} for model
machine-0: 15:50:15 TRACE juju.state.presence [8e869b] Alive("u#ul/6") -> true
machine-0: 15:50:15 TRACE juju.state.presence [8e869b] got request: presence.reqAlive{key:"u#ul/8", result:(chan bool)(0xc422323c70)} for model
machine-0: 15:50:15 TRACE juju.state.presence [8e869b] Alive("u#ul/8") -> true
machine-0: 15:50:15 TRACE juju.state.presence [8e869b] got request: presence.reqAlive{key:"u#ul/3", result:(chan bool)(0xc421facc40)} for model
machine-0: 15:50:15 TRACE juju.state.presence [8e869b] Alive("u#ul/3") -> true
machine-0: 15:50:15 TRACE juju.state.presence [8e869b] got request: presence.reqAlive{key:"u#ul/4", result:(chan bool)(0xc4223345b0)} for model
machine-0: 15:50:15 TRACE juju.state.presence [8e869b] Alive("u#ul/4") -> true
machine-0: 15:50:15 TRACE juju.state.presence [8e869b] got request: presence.reqAlive{key:"u#ul/7", result:(chan bool)(0xc421facf50)} for model
machine-0: 15:50:15 TRACE juju.state.presence [8e869b] Alive("u#ul/7") -> true
machine-0: 15:50:15 TRACE juju.state.presence [8e869b] got request: presence.reqAlive{key:"u#ul/9", result:(chan bool)(0xc422279500)} for model
machine-0: 15:50:15 TRACE juju.state.presence [8e869b] Alive("u#ul/9") -> true
machine-0: 15:50:15 TRACE juju.state.presence [8e869b] got request: presence.reqAlive{key:"u#ul/10", result:(chan bool)(0xc422279c70)} for model
machine-0: 15:50:15 TRACE juju.state.presence [8e869b] Alive("u#ul/10") -> true
machine-0: 15:50:15 TRACE juju.state.presence [8e869b] got request: presence.reqAlive{key:"u#ul/0", result:(chan bool)(0xc4218f8070)} for model
machine-0: 15:50:15 TRACE juju.state.presence [8e869b] Alive("u#ul/0") -> true
machine-0: 15:50:15 TRACE juju.state.presence pingbatcher has 0 pings to record
machine-0: 15:50:15 TRACE juju.state.presence [8e869b] got request: presence.reqAlive{key:"u#ul/1", result:(chan bool)(0xc421fadb20)} for model
machine-0: 15:50:15 TRACE juju.state.presence [8e869b] Alive("u#ul/1") -> true
machine-0: 15:50:15 TRACE juju.state.presence [8e869b] got request: presence.reqAlive{key:"u#ul/2", result:(chan bool)(0xc4218f8540)} for model
machine-0: 15:50:15 TRACE juju.state.presence [8e869b] Alive("u#ul/2") -> true
machine-0: 15:50:15 TRACE juju.state.presence [8e869b] got request: presence.reqAlive{key:"u#peer-xplod/0", result:(chan bool)(0xc4229873b0)} for model
machine-0: 15:50:15 TRACE juju.state.presence [8e869b] Alive("u#peer-xplod/0") -> true
machine-0: 15:50:15 TRACE juju.state.presence [8e869b] got request: presence.reqAlive{key:"u#peer-xplod/1", result:(chan bool)(0xc421468e70)} for model
machine-0: 15:50:15 TRACE juju.state.presence [8e869b] Alive("u#peer-xplod/1") -> true
machine-0: 15:50:15 TRACE juju.state.presence [8e869b] got request: presence.reqAlive{key:"u#peer-xplod/2", result:(chan bool)(0xc422335180)} for model
machine-0: 15:50:15 TRACE juju.state.presence [8e869b] Alive("u#peer-xplod/2") -> true

We're not doing a "sync" for each of these, so its just returning whatever the current cached lifetime is in memory for each object. But it is a fair bit of overhead (creating a channel to return the response on, putting the request into the channel, handling it, returning the values, etc.). It would be better if we asked for the presence information in a large batch with a single return.

Revision history for this message
John A Meinel (jameinel) wrote :

https://github.com/jameinel/juju/tree/2.2-presence-multi-1703594

The above branch is a start at changing the presence code to support a batch call of the presence for all agents in one request.

However, apiserver/client/status.go is still written very much as:
 for _, machine := range machines {
    infoForMachine = getStatusInformation(machine)
 }
 for _, app := range applications {
    infoForApp = processApp(app)
 }

So none of that code builds up a list of things to ask about, and then asks about them all at once. So it isn't worth updating Presence until we have a good caller that can actually call it in a meaningful way. Not worth it yet.

Changed in juju:
importance: High → Medium
assignee: John A Meinel (jameinel) → nobody
Revision history for this message
Anastasia (anastasia-macmood) wrote :

We will not be fixing this in 2.2 as there are no further point releases planned in this series.

Changed in juju:
importance: Medium → Low
tags: added: tech-debt
Revision history for this message
Canonical Juju QA Bot (juju-qa-bot) wrote :

This bug has not been updated in 2 years, so we're marking it Low importance. If you believe this is incorrect, please update the importance.

tags: added: expirebugs-bot
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.